mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-24 15:34:42 +00:00
parent
ce996e2ec6
commit
0f559ad84f
3 changed files with 0 additions and 51 deletions
|
|
@ -40,10 +40,6 @@
|
|||
else {
|
||||
this._createActiveGroup(target, e);
|
||||
}
|
||||
|
||||
if (this._activeGroup) {
|
||||
this._activeGroup.saveCoords();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -126,7 +122,6 @@
|
|||
});
|
||||
group.addWithUpdate();
|
||||
this.setActiveGroup(group, e);
|
||||
group.saveCoords();
|
||||
this.fire('selection:created', { target: group, e: e });
|
||||
this.renderAll();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,6 @@
|
|||
}
|
||||
|
||||
this.setCoords();
|
||||
this.saveCoords();
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -464,27 +463,6 @@
|
|||
return this._restoreObjectsState();
|
||||
},
|
||||
|
||||
/**
|
||||
* Saves coordinates of this instance (to be used together with `hasMoved`)
|
||||
* @saveCoords
|
||||
* @return {fabric.Group} thisArg
|
||||
* @chainable
|
||||
*/
|
||||
saveCoords: function() {
|
||||
this._originalLeft = this.get('left');
|
||||
this._originalTop = this.get('top');
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks whether this group was moved (since `saveCoords` was called last)
|
||||
* @return {Boolean} true if an object was moved (since fabric.Group#saveCoords was called)
|
||||
*/
|
||||
hasMoved: function() {
|
||||
return this._originalLeft !== this.get('left') ||
|
||||
this._originalTop !== this.get('top');
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets coordinates of all objects inside group
|
||||
* @return {fabric.Group} thisArg
|
||||
|
|
|
|||
|
|
@ -305,30 +305,6 @@
|
|||
equal(firstObject.get('top'), initialTopValue, 'should restore initial top value');
|
||||
});
|
||||
|
||||
test('saveCoords', function() {
|
||||
var group = makeGroupWith2Objects();
|
||||
|
||||
ok(typeof group.saveCoords == 'function');
|
||||
equal(group.saveCoords(), group, 'should be chainable');
|
||||
});
|
||||
|
||||
test('hasMoved', function() {
|
||||
var group = makeGroupWith2Objects();
|
||||
|
||||
ok(typeof group.hasMoved == 'function');
|
||||
equal(group.hasMoved(), false);
|
||||
|
||||
function moveBy10(value) {
|
||||
return value + 10;
|
||||
}
|
||||
group.set('left', moveBy10);
|
||||
equal(group.hasMoved(), true);
|
||||
group.saveCoords();
|
||||
equal(group.hasMoved(), false);
|
||||
group.set('top', moveBy10);
|
||||
equal(group.hasMoved(), true);
|
||||
});
|
||||
|
||||
test('setObjectCoords', function(){
|
||||
var group = makeGroupWith2Objects();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue