mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-05 12:24:46 +00:00
Merge pull request #1644 from ChrisBuergi/scaling-strokewidth-fix
Scaling strokewidth fix
This commit is contained in:
commit
98a1eb496d
1 changed files with 7 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue