mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-21 14:34:43 +00:00
Add uniScaleTransform and centerTransform parameters to canvas, which control how objects are transformed
This commit is contained in:
parent
fcfe5052f8
commit
4bcc0bd80f
1 changed files with 16 additions and 2 deletions
|
|
@ -48,6 +48,20 @@
|
|||
|
||||
var InteractiveMethods = /** @scope fabric.Canvas.prototype */ {
|
||||
|
||||
/**
|
||||
* When true, objects can be transformed by one side (unproportionally)
|
||||
* @property
|
||||
* @type Boolean
|
||||
*/
|
||||
uniScaleTransform: false,
|
||||
|
||||
/**
|
||||
* When true, objects use center point as the origin of transformation
|
||||
* @property
|
||||
* @type Boolean
|
||||
*/
|
||||
centerTransform: false,
|
||||
|
||||
/**
|
||||
* Indicates that canvas is interactive. This property should not be changed.
|
||||
* @property
|
||||
|
|
@ -513,7 +527,7 @@
|
|||
// this._currentTransform.target.fire('scaling');
|
||||
// }
|
||||
|
||||
if (e.shiftKey) {
|
||||
if (e.shiftKey || this.uniScaleTransform) {
|
||||
this._currentTransform.currentAction = 'scale';
|
||||
this._scaleObject(x, y);
|
||||
}
|
||||
|
|
@ -584,7 +598,7 @@
|
|||
t.target.set('left', t.original.left);
|
||||
t.target.set('top', t.original.top);
|
||||
|
||||
if (e.altKey) {
|
||||
if (e.altKey || this.centerTransform) {
|
||||
if (t.originX !== 'center') {
|
||||
if (t.originX === 'right') {
|
||||
t.mouseXSign = -1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue