Skip to content

Commit

Permalink
Build distribution. Version 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kangax committed Jun 14, 2013
1 parent be8e921 commit cdc2d41
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 21 deletions.
2 changes: 1 addition & 1 deletion HEADER.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*! Fabric.js Copyright 2008-2013, Printio (Juriy Zaytsev, Maxim Chernyak) */

var fabric = fabric || { version: "1.1.21" };
var fabric = fabric || { version: "1.2.0" };

if (typeof exports !== 'undefined') {
exports.fabric = fabric;
Expand Down
43 changes: 30 additions & 13 deletions dist/all.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* build: `node build.js modules=ALL exclude=gestures` */
/*! Fabric.js Copyright 2008-2013, Printio (Juriy Zaytsev, Maxim Chernyak) */

var fabric = fabric || { version: "1.1.21" };
var fabric = fabric || { version: "1.2.0" };

if (typeof exports !== 'undefined') {
exports.fabric = fabric;
Expand Down Expand Up @@ -8612,17 +8612,34 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
}
}

// adjust the mouse coordinates when dealing with padding
if (abs(localMouse.x) > target.padding) {
if (localMouse.x < 0 ) {
localMouse.x += target.padding;
} else {
localMouse.x -= target.padding;
}
} else { // mouse is within the padding, set to 0
localMouse.x = 0;
}

if (abs(localMouse.y) > target.padding) {
if (localMouse.y < 0 ) {
localMouse.y += target.padding;
} else {
localMouse.y -= target.padding;
}
} else {
localMouse.y = 0;
}

// Actually scale the object
var newScaleX = target.scaleX, newScaleY = target.scaleY;
if (by === 'equally' && !lockScalingX && !lockScalingY) {
var dist = Math.sqrt(Math.pow(localMouse.y,2) + Math.pow(localMouse.x,2));
var lastDist = Math.sqrt(Math.pow((target.height + (target.padding/2) + (target.strokeWidth/2)) * t.original.scaleY,2) +
Math.pow((target.width + (target.padding/2) + (target.strokeWidth/2)) * t.original.scaleX,2));

if (localMouse.y < 0 || localMouse.x < 0) {
dist *= -1;
}

var dist = localMouse.y + localMouse.x;
var lastDist = (target.height + (target.strokeWidth)) * t.original.scaleY +
(target.width + (target.strokeWidth)) * t.original.scaleX;

// We use t.scaleX/Y instead of target.scaleX/Y because the object may have a min scale and we'll loose the proportions
newScaleX = t.original.scaleX * dist/lastDist;
newScaleY = t.original.scaleY * dist/lastDist;
Expand All @@ -8631,18 +8648,18 @@ fabric.PatternBrush = fabric.util.createClass(fabric.PencilBrush, /** @lends fab
target.set('scaleY', newScaleY);
}
else if (!by) {
newScaleX = localMouse.x/(target.width+(target.padding/2)+(target.strokeWidth/2));
newScaleY = localMouse.y/(target.height+(target.padding/2)+(target.strokeWidth/2));
newScaleX = localMouse.x/(target.width+target.strokeWidth);
newScaleY = localMouse.y/(target.height+target.strokeWidth);

lockScalingX || target.set('scaleX', newScaleX);
lockScalingY || target.set('scaleY', newScaleY);
}
else if (by === 'x' && !target.get('lockUniScaling')) {
newScaleX = localMouse.x/(target.width+(target.padding/2)+(target.strokeWidth/2));
newScaleX = localMouse.x/(target.width + target.strokeWidth);
lockScalingX || target.set('scaleX', newScaleX);
}
else if (by === 'y' && !target.get('lockUniScaling')) {
newScaleY = localMouse.y/(target.height+(target.padding/2)+(target.strokeWidth/2));
newScaleY = localMouse.y/(target.height + target.strokeWidth);
lockScalingY || target.set('scaleY', newScaleY);
}

Expand Down
12 changes: 6 additions & 6 deletions dist/all.min.js

Large diffs are not rendered by default.

Binary file modified dist/all.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fabric",
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
"version": "1.1.21",
"version": "1.2.0",
"author": "Juriy Zaytsev <[email protected]>",
"keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],
"repository": "git://github.com/kangax/fabric.js",
Expand Down

0 comments on commit cdc2d41

Please sign in to comment.