[the-board] [ui] Factor out code to set selected things from selection box
- From: Lucas Rocha <lucasr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [the-board] [ui] Factor out code to set selected things from selection box
- Date: Fri, 14 Jan 2011 01:37:08 +0000 (UTC)
commit ae1b8643b0334aea233017a5f31e5bd8679aad58
Author: Lucas Rocha <lucasr gnome org>
Date: Fri Jan 14 01:27:32 2011 +0000
[ui] Factor out code to set selected things from selection box
src/js/ui/page.js | 34 ++++++++++++++++++++++------------
1 files changed, 22 insertions(+), 12 deletions(-)
---
diff --git a/src/js/ui/page.js b/src/js/ui/page.js
index 2b7d914..0e51c7b 100644
--- a/src/js/ui/page.js
+++ b/src/js/ui/page.js
@@ -379,16 +379,10 @@ Page.prototype = {
return union;
},
- _updateSelectedThings : function() {
- if (this._selectionBox.visible) {
- let x1 = this._selectionBox.x - this._selectionBox.anchorX;
- let y1 = this._selectionBox.y - this._selectionBox.anchorY;
- let x2 = x1 + this._selectionBox.width;
- let y2 = y1 + this._selectionBox.height;
+ _setSelectedThings : function(selectedThings) {
+ this._selectedThings = selectedThings;
- this._selectedThings = this._getThingsInArea(x1, y1, x2, y2);
- } else {
- this._selectedThings = [];
+ if (this._selectedThings.length == 0) {
delete this._dragArea;
}
@@ -404,9 +398,25 @@ Page.prototype = {
this._things.forEach(Lang.bind(this, updateSelection));
},
+ _updateSelectedThingsFromBox : function() {
+ let selectedThings;
+
+ if (this._selectionBox.visible) {
+ let x1 = this._selectionBox.x - this._selectionBox.anchorX;
+ let y1 = this._selectionBox.y - this._selectionBox.anchorY;
+ let x2 = x1 + this._selectionBox.width;
+ let y2 = y1 + this._selectionBox.height;
+
+ selectedThings = this._getThingsInArea(x1, y1, x2, y2);
+ } else {
+ selectedThings = [];
+ }
+
+ this._setSelectedThings(selectedThings);
+ },
+
_unselectAllThings : function() {
- this._selectionBox.hide();
- this._updateSelectedThings();
+ this._setSelectedThings([]);
},
_ensureDragArea : function(draggedThing) {
@@ -444,7 +454,7 @@ Page.prototype = {
this._selectionBox.width = Math.abs(deltaX);
this._selectionBox.height = Math.abs(deltaY);
- this._updateSelectedThings();
+ this._updateSelectedThingsFromBox();
},
_onMainBoxDragBegin : function(action, actor, eventX, eventY, modifiers) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]