var height = Math.ceil(this.imageEl.OriginHeight * this.getScaleLevel() / minScale);
console.log("ZOOM");
- console.log("WIDTH: " + width);
- console.log("HEIGHT: " + height);
+ console.log("WIDTH: " + (this.thumbEl.getWidth() / this.getScaleLevel()));
+ console.log("HEIGHT: " + (this.thumbEl.getHeight() / this.getScaleLevel()));
var maxWidth = this.imageEl.OriginWidth;
var context = canvas.getContext("2d");
- console.log("GETSCALELEVLE: " + this.getScaleLevel());
+ canvas.width = this.thumbEl.getWidth() / this.getScaleLevel();
+
+ canvas.height = this.thumbEl.getHeight() / this.getScaleLevel();
+
+ console.log("CANVAS WIDTH: " + canvas.width);
+ console.log("CANVAS HEIGHT: " + canvas.height);
+
+ console.log("SCALELEVLE: " + scaleLevel);
switch (this.rotate) {
case 0 :
console.log("WIDTH: " + width);
console.log("HEIGHT: " + height);
-
- canvas.width = width;
-
- canvas.height = height;
-
- console.log("CANVAS WIDTH: " + canvas.width);
- console.log("CANVAS HEIGHT: " + canvas.height);
var x = (this.thumbEl.getLeft(true) > this.previewEl.getLeft(true)) ? 0 : ((this.previewEl.getLeft(true) - this.thumbEl.getLeft(true)) / this.getScaleLevel());
var y = (this.thumbEl.getTop(true) > this.previewEl.getTop(true)) ? 0 : ((this.previewEl.getTop(true) - this.thumbEl.getTop(true)) / this.getScaleLevel());
// context.scale(scale, scale);
- var sx = Math.min(this.canvasEl.width - this.thumbEl.getWidth(), this.thumbEl.getLeft(true) - this.previewEl.getLeft(true));
- var sy = Math.min(this.canvasEl.height - this.thumbEl.getHeight(), this.thumbEl.getTop(true) - this.previewEl.getTop(true));
+ var sx = this.thumbEl.getLeft(true) - this.previewEl.getLeft(true);
+ var sy = this.thumbEl.getTop(true) - this.previewEl.getTop(true);
console.log("sx: " + sx);
console.log("sy: " + sy);
sx = sx < 0 ? 0 : (sx / this.getScaleLevel());
sy = sy < 0 ? 0 : (sy / this.getScaleLevel());
- // context.drawImage(imageCanvas, sx, sy, width, height, x, y, width, height);
-
- context.drawImage(imageCanvas, 0, 0);
+ context.drawImage(imageCanvas, sx, sy, width, height, x, y, width, height);
break;
case 90 :