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