Merge pull request #1644 from ChrisBuergi/scaling-strokewidth-fix

Scaling strokewidth fix
This commit is contained in:
Juriy Zaytsev 2014-10-21 12:26:17 +02:00
commit 98a1eb496d

View file

@ -498,10 +498,11 @@
* @private
*/
_setObjectScale: function(localMouse, transform, lockScalingX, lockScalingY, by, lockScalingFlip) {
var target = transform.target, forbidScalingX = false, forbidScalingY = false;
var target = transform.target, forbidScalingX = false, forbidScalingY = false,
strokeWidth = target.stroke ? target.strokeWidth : 0;
transform.newScaleX = localMouse.x / (target.width + target.strokeWidth);
transform.newScaleY = localMouse.y / (target.height + target.strokeWidth);
transform.newScaleX = localMouse.x / (target.width + strokeWidth / 2);
transform.newScaleY = localMouse.y / (target.height + strokeWidth / 2);
if (lockScalingFlip && transform.newScaleX <= 0 && transform.newScaleX < target.scaleX) {
forbidScalingX = true;
@ -535,8 +536,9 @@
_scaleObjectEqually: function(localMouse, target, transform) {
var dist = localMouse.y + localMouse.x,
lastDist = (target.height + (target.strokeWidth)) * transform.original.scaleY +
(target.width + (target.strokeWidth)) * transform.original.scaleX;
strokeWidth = target.stroke ? target.strokeWidth : 0,
lastDist = (target.height + (strokeWidth / 2)) * transform.original.scaleY +
(target.width + (strokeWidth / 2)) * transform.original.scaleX;
// We use transform.scaleX/Y instead of target.scaleX/Y
// because the object may have a min scale and we'll loose the proportions