var context = canvas.getContext("2d");
- var scaleLevel = this.getScaleLevel();
-
- if(this.thumbEl.getWidth() / this.getScaleLevel() > 1200) {
- scaleLevel = this.thumbEl.getWidth() / 1200;
- }
-
- canvas.width = this.thumbEl.getWidth() / scaleLevel;
+ canvas.width = this.thumbEl.getWidth() / this.getScaleLevel();
- canvas.height = this.thumbEl.getHeight() / scaleLevel;
-
+ canvas.height = this.thumbEl.getHeight() / this.getScaleLevel();
console.log("CANVAS WIDTH: " + canvas.width);
console.log("CANVAS HEIGHT: " + canvas.height);
- console.log("SCALELEVLE: " + scaleLevel);
+ console.log("SCALELEVLE: " + this.getScaleLevel());
switch (this.rotate) {
case 0 :
- var width = (this.thumbEl.getWidth() / this.getScaleLevel() > this.imageEl.OriginWidth) ? this.imageEl.OriginWidth : (this.thumbEl.getWidth() / scaleLevel);
- var height = (this.thumbEl.getHeight() / this.getScaleLevel() > this.imageEl.OriginHeight) ? this.imageEl.OriginHeight : (this.thumbEl.getHeight() / scaleLevel);
+ var width = (this.thumbEl.getWidth() / this.getScaleLevel() > this.imageEl.OriginWidth) ? this.imageEl.OriginWidth : (this.thumbEl.getWidth() / this.getScaleLevel());
+ var height = (this.thumbEl.getHeight() / this.getScaleLevel() > this.imageEl.OriginHeight) ? this.imageEl.OriginHeight : (this.thumbEl.getHeight() / this.getScaleLevel());
console.log("WIDTH: " + width);
console.log("HEIGHT: " + height);
sx = sx < 0 ? 0 : (sx / this.getScaleLevel());
sy = sy < 0 ? 0 : (sy / this.getScaleLevel());
+ if(canvas.width > 1200) {
+ canvas.height = 1200 * canvas.height / canvas.width;
+ canvas.width = 1200;
+ }
+
context.drawImage(imageCanvas, sx, sy, width, height, x, y, width, height);
break;