mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-03-16 22:10:32 +00:00
small-changes (#5454)
This commit is contained in:
parent
a8bdd40612
commit
576f34ab68
3 changed files with 17 additions and 11 deletions
|
|
@ -65,25 +65,30 @@
|
|||
var scaledWidth = (cropping.width || this.width) * multiplier,
|
||||
scaledHeight = (cropping.height || this.height) * multiplier,
|
||||
zoom = this.getZoom(),
|
||||
originalWidth = this.width,
|
||||
originalHeight = this.height,
|
||||
newZoom = zoom * multiplier,
|
||||
vp = this.viewportTransform,
|
||||
translateX = (vp[4] - (cropping.left || 0)) * multiplier,
|
||||
translateY = (vp[5] - (cropping.top || 0)) * multiplier,
|
||||
originalInteractive = this.interactive,
|
||||
originalOffscreen = this.skipOffscreen,
|
||||
originalContext = this.contextContainer,
|
||||
newVp = [newZoom, 0, 0, newZoom, translateX, translateY],
|
||||
canvasEl = fabric.util.createCanvasElement();
|
||||
canvasEl.width = scaledWidth;
|
||||
canvasEl.height = scaledHeight;
|
||||
this.skipOffscreen = false;
|
||||
this.interactive = false;
|
||||
this.viewportTransform = newVp;
|
||||
this.width = scaledWidth;
|
||||
this.height = scaledHeight;
|
||||
this.calcViewportBoundaries();
|
||||
this.contextContainer = canvasEl.getContext('2d');
|
||||
// will be renderAllExport();
|
||||
this.renderAll();
|
||||
this.viewportTransform = vp;
|
||||
this.skipOffscreen = originalOffscreen;
|
||||
this.width = originalWidth;
|
||||
this.height = originalHeight;
|
||||
this.calcViewportBoundaries();
|
||||
this.contextContainer = originalContext;
|
||||
this.interactive = originalInteractive;
|
||||
return canvasEl;
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@
|
|||
/**
|
||||
* Checks if object is contained within the canvas with current viewportTransform
|
||||
* the check is done stopping at first point that appears on screen
|
||||
* @param {Boolean} [calculate] use coordinates of current position instead of .oCoords
|
||||
* @param {Boolean} [calculate] use coordinates of current position instead of .aCoords
|
||||
* @return {Boolean} true if object is fully or partially contained within canvas
|
||||
*/
|
||||
isOnScreen: function(calculate) {
|
||||
|
|
|
|||
|
|
@ -1366,18 +1366,19 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var multX = (this.canvas && this.canvas.viewportTransform[0]) || 1,
|
||||
multY = (this.canvas && this.canvas.viewportTransform[3]) || 1,
|
||||
var shadow = this.shadow, canvas = this.canvas,
|
||||
multX = (canvas && canvas.viewportTransform[0]) || 1,
|
||||
multY = (canvas && canvas.viewportTransform[3]) || 1,
|
||||
scaling = this.getObjectScaling();
|
||||
if (this.canvas && this.canvas._isRetinaScaling()) {
|
||||
if (canvas && canvas._isRetinaScaling()) {
|
||||
multX *= fabric.devicePixelRatio;
|
||||
multY *= fabric.devicePixelRatio;
|
||||
}
|
||||
ctx.shadowColor = this.shadow.color;
|
||||
ctx.shadowBlur = this.shadow.blur * fabric.browserShadowBlurConstant *
|
||||
ctx.shadowColor = shadow.color;
|
||||
ctx.shadowBlur = shadow.blur * fabric.browserShadowBlurConstant *
|
||||
(multX + multY) * (scaling.scaleX + scaling.scaleY) / 4;
|
||||
ctx.shadowOffsetX = this.shadow.offsetX * multX * scaling.scaleX;
|
||||
ctx.shadowOffsetY = this.shadow.offsetY * multY * scaling.scaleY;
|
||||
ctx.shadowOffsetX = shadow.offsetX * multX * scaling.scaleX;
|
||||
ctx.shadowOffsetY = shadow.offsetY * multY * scaling.scaleY;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue