Replaced x/y with h/v
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function ApertureHandler(canvas) {
|
function ApertureHandler(canvas) {
|
||||||
var _items = {x: [], y: []};
|
var _items = {h: [], v: []};
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
var bounds = canvas;
|
var bounds = canvas;
|
||||||
@@ -17,10 +17,10 @@ function ApertureHandler(canvas) {
|
|||||||
height: bounds.height
|
height: bounds.height
|
||||||
});
|
});
|
||||||
|
|
||||||
_items.x = [].concat([hRect, hRect.clone()]);
|
_items.h = [].concat([hRect, hRect.clone()]);
|
||||||
_items.y = [].concat([vRect, vRect.clone()]);
|
_items.v= [].concat([vRect, vRect.clone()]);
|
||||||
|
|
||||||
[].concat(_items.x, _items.y).forEach(function (o) {
|
[].concat(_items.h, _items.v).forEach(function (o) {
|
||||||
canvas.add(o);
|
canvas.add(o);
|
||||||
});
|
});
|
||||||
canvas.renderAll();
|
canvas.renderAll();
|
||||||
@@ -32,13 +32,13 @@ function ApertureHandler(canvas) {
|
|||||||
o.visible = false;
|
o.visible = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
var active = this.getApertures(axis === 'x' ? 'y' : 'x');
|
var active = this.getApertures(axis === 'h' ? 'v' : 'h');
|
||||||
|
|
||||||
active.forEach(function (o) {
|
active.forEach(function (o) {
|
||||||
o.visible = true;
|
o.visible = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (axis === 'y') {
|
if (axis === 'v') {
|
||||||
active[0].top = viewport.top - active[0].height + 0.5;
|
active[0].top = viewport.top - active[0].height + 0.5;
|
||||||
active[1].top = viewport.top + viewport.height - 0.5;
|
active[1].top = viewport.top + viewport.height - 0.5;
|
||||||
} else {
|
} else {
|
||||||
@@ -54,7 +54,7 @@ function ApertureHandler(canvas) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.getApertures = function (axis) {
|
this.getApertures = function (axis) {
|
||||||
return axis ? _items[axis] : [].concat(_items.x, _items.y);
|
return axis ? _items[axis] : [].concat(_items.h, _items.v);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setTransparent = function (apply) {
|
this.setTransparent = function (apply) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function calcCrop(obj, width, height) {
|
|||||||
|
|
||||||
var returnValue = {
|
var returnValue = {
|
||||||
image: obj,
|
image: obj,
|
||||||
axis: objRatio > cropRatio ? 'x' : 'y',
|
axis: objRatio > cropRatio ? 'h' : 'v',
|
||||||
dim: {
|
dim: {
|
||||||
width: Number(width),
|
width: Number(width),
|
||||||
height: Number(height)
|
height: Number(height)
|
||||||
|
|||||||
Reference in New Issue
Block a user