Skip to content
Snippets Groups Projects
Commit a490d0ad authored by Fabian Homborg's avatar Fabian Homborg
Browse files

Simplify moving/resizing code

parent 05f67e20
No related branches found
No related tags found
No related merge requests found
......@@ -209,6 +209,9 @@ Tile.prototype.onClientGeometryChanged = function(client) {
this._savedGeometry = null;
this.screenChanged.emit();
}
if (client.move || client.resize) {
return;
}
if (this._moving || this.resizing) {
return;
}
......@@ -256,33 +259,16 @@ Tile.prototype.onClientStartUserMovedResized = function(client) {
Tile.prototype.onClientStepUserMovedResized = function(client) {
var newGeometry = client.geometry;
if (newGeometry.width != this._lastGeometry.width
|| newGeometry.height != this._lastGeometry.height) {
if (this._moving) {
this.movingEnded.emit();
this._moving = false;
}
if (this._resizing) {
if (client.resize) {
this.resizingStep.emit();
} else {
this._resizing = true;
this.resizingStarted.emit();
}
}
if (newGeometry.x != this._lastGeometry.x
|| newGeometry.y != this._lastGeometry.y) {
if (this._resizing) {
this.resizingEnded.emit();
this._resizing = false;
return;
}
if (this._moving) {
if (client.move) {
this.movingStep.emit();
} else {
this._moving = true;
this.movingStarted.emit();
}
return;
}
this._lastGeometry = newGeometry;
};
Tile.prototype.onClientFinishUserMovedResized = function(client) {
......@@ -293,5 +279,4 @@ Tile.prototype.onClientFinishUserMovedResized = function(client) {
this.resizingEnded.emit();
this._resizing = false;
}
this._lastGeometry = null;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment