Commit 2492f36c by christian

update

parent 287f084e
......@@ -5,8 +5,7 @@ function ImageManager(canvasId) {
NONE = 0, MOVING = 1, SCALING = 2, ROTATING = 3;
this.mouseDown = false;
this.mousePrevX = 0;
this.mousePrevY = 0;
this.selectedLayer = null;
this.mousePrevY = 0;this.selectedLayer = null;
this.layerState = NONE;
this.canvasOffsetX = 0;
this.canvasOffsetY = 0;
......@@ -24,31 +23,23 @@ function ImageManager(canvasId) {
layers.push(layer);
return layer;
}
this.redraw = function() {
// this.canvasManager.changeShape(false);
}
this.getCanvas = function() {
return canvas;
}
this.getLayers = function() {
return layers;
}
this.getLayer = function(i) {
return layers[i];
}
this.isScalingArea = function (mX, mY, layer) {
var scaleOffsetX = layer.offsetX + layer.width;
var scaleOffsetY = layer.offsetY + layer.height;
var square = new Square(
new Vector(scaleOffsetX - this.scaleImg.width, scaleOffsetY - this.scaleImg.height),
new Vector(scaleOffsetX, scaleOffsetY - this.scaleImg.height),
new Vector(scaleOffsetX, scaleOffsetY),
new Vector(scaleOffsetX - this.scaleImg.width, scaleOffsetY));
square.rotate(layer.angle);
square.alignBottomRight(layer.getSquare().c);
return square.intersect(new Vector(mX, mY));
}
}
this.redraw = function(){this.canvasManager.changeShape(false);}
this.getCanvas = function(){return canvas;}
this.getLayers = function() {return layers;}
this.getLayer = function(i) {return layers[i];}
this.isScalingArea = function (mX, mY, layer) {
var scaleOffsetX = layer.offsetX + layer.width;
var scaleOffsetY = layer.offsetY + layer.height;
var square = new Square(
new Vector(scaleOffsetX - this.scaleImg.width, scaleOffsetY - this.scaleImg.height),
new Vector(scaleOffsetX, scaleOffsetY - this.scaleImg.height),
new Vector(scaleOffsetX, scaleOffsetY),
new Vector(scaleOffsetX - this.scaleImg.width, scaleOffsetY));
square.rotate(layer.angle);
square.alignBottomRight(layer.getSquare().c);
return square.intersect(new Vector(mX, mY));
}
}
function Layer(img,src) {
this.src = src;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment