Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed saveCoords hasMoved #3910

Merged
merged 2 commits into from
May 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/mixins/canvas_grouping.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
else {
this._createActiveGroup(target, e);
}

if (this._activeGroup) {
this._activeGroup.saveCoords();
}
},

/**
Expand Down Expand Up @@ -126,7 +122,6 @@
});
group.addWithUpdate();
this.setActiveGroup(group, e);
group.saveCoords();
this.fire('selection:created', { target: group, e: e });
this.renderAll();
}
Expand Down
22 changes: 0 additions & 22 deletions src/shapes/group.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
}

this.setCoords();
this.saveCoords();
},

/**
Expand Down Expand Up @@ -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
Expand Down
24 changes: 0 additions & 24 deletions test/unit/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down