diff options
author | Valerio Virgillito | 2012-07-09 14:35:44 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-09 14:35:44 -0700 |
commit | 84b3327bd92faafab7954b5eb64c7abe24a3fe13 (patch) | |
tree | 3f56cbed2f08c5a81ea79eaf0bcb9bd031d8a627 /js/panels/color/colorpopup-manager.js | |
parent | c0a42c56f768a873ba637f5b86d5f6a84d4a3312 (diff) | |
parent | 40c6eb2c06b34f65a74d59ef9687251952858bab (diff) | |
download | ninja-84b3327bd92faafab7954b5eb64c7abe24a3fe13.tar.gz |
Merge branch 'normalize' of https://github.com/kriskowal/ninja-internal
Conflicts:
js/components/gradientpicker.reel/gradientpicker.js
js/components/tools-properties/text-properties.reel/text-properties.js
js/document/views/base.js
js/document/views/design.js
js/helper-classes/3D/StageLine.js
js/helper-classes/3D/draw-utils.js
js/lib/drawing/world.js
js/lib/geom/circle.js
js/lib/geom/line.js
js/lib/geom/rectangle.js
js/lib/geom/shape-primitive.js
js/lib/rdge/materials/bump-metal-material.js
js/lib/rdge/materials/flag-material.js
js/lib/rdge/materials/fly-material.js
js/lib/rdge/materials/julia-material.js
js/lib/rdge/materials/keleidoscope-material.js
js/lib/rdge/materials/mandel-material.js
js/lib/rdge/materials/material.js
js/lib/rdge/materials/plasma-material.js
js/lib/rdge/materials/pulse-material.js
js/lib/rdge/materials/radial-gradient-material.js
js/lib/rdge/materials/taper-material.js
js/lib/rdge/materials/twist-vert-material.js
js/lib/rdge/materials/water-material.js
js/panels/Materials/materials-library-panel.reel/materials-library-panel.html
js/panels/Materials/materials-library-panel.reel/materials-library-panel.js
js/panels/Materials/materials-popup.reel/materials-popup.html
js/panels/Materials/materials-popup.reel/materials-popup.js
js/tools/LineTool.js
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/panels/color/colorpopup-manager.js')
-rwxr-xr-x | js/panels/color/colorpopup-manager.js | 1254 |
1 files changed, 627 insertions, 627 deletions
diff --git a/js/panels/color/colorpopup-manager.js b/js/panels/color/colorpopup-manager.js index 7daf0e97..5667fbe7 100755 --- a/js/panels/color/colorpopup-manager.js +++ b/js/panels/color/colorpopup-manager.js | |||
@@ -27,156 +27,156 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |||
27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | POSSIBILITY OF SUCH DAMAGE. | 28 | POSSIBILITY OF SUCH DAMAGE. |
29 | </copyright> */ | 29 | </copyright> */ |
30 | 30 | ||
31 | //////////////////////////////////////////////////////////////////////// | 31 | //////////////////////////////////////////////////////////////////////// |
32 | // | 32 | // |
33 | var Montage = require("montage/core/core").Montage, | 33 | var Montage = require("montage/core/core").Montage, |
34 | Component = require("montage/ui/component").Component, | 34 | Component = require("montage/ui/component").Component, |
35 | ColorPanelPopup = require("js/panels/Color/colorpanelpopup.reel").ColorPanelPopup, | 35 | ColorPanelPopup = require("js/panels/Color/colorpanelpopup.reel").ColorPanelPopup, |
36 | ColorModel = require("js/models/color-model").ColorModel; | 36 | ColorModel = require("js/models/color-model").ColorModel; |
37 | //////////////////////////////////////////////////////////////////////// | 37 | //////////////////////////////////////////////////////////////////////// |
38 | //Exporting as ColorPopupManager | 38 | //Exporting as ColorPopupManager |
39 | exports.ColorPopupManager = Montage.create(Component, { | 39 | exports.ColorPopupManager = Montage.create(Component, { |
40 | //////////////////////////////////////////////////////////////////// | 40 | //////////////////////////////////////////////////////////////////// |
41 | // | 41 | // |
42 | hasTemplate: { | 42 | hasTemplate: { |
43 | value: false | 43 | value: false |
44 | }, | 44 | }, |
45 | //////////////////////////////////////////////////////////////////// | 45 | //////////////////////////////////////////////////////////////////// |
46 | // | 46 | // |
47 | _hasCloseEvents: { | 47 | _hasCloseEvents: { |
48 | value: false | 48 | value: false |
49 | }, | 49 | }, |
50 | //////////////////////////////////////////////////////////////////// | 50 | //////////////////////////////////////////////////////////////////// |
51 | // | 51 | // |
52 | addCloseEvents: { | 52 | addCloseEvents: { |
53 | value: function () { | 53 | value: function () { |
54 | // | 54 | // |
55 | this._hasCloseEvents = true; | 55 | this._hasCloseEvents = true; |
56 | //////////////////////////////////////////////////////////// | 56 | //////////////////////////////////////////////////////////// |
57 | //Closing popups on resize | 57 | //Closing popups on resize |
58 | window.addEventListener('resize', this, false); | 58 | window.addEventListener('resize', this, false); |
59 | //Closing popups if outside limits | 59 | //Closing popups if outside limits |
60 | document.addEventListener('mousedown', this, false); | 60 | document.addEventListener('mousedown', this, false); |
61 | //////////////////////////////////////////////////////////// | 61 | //////////////////////////////////////////////////////////// |
62 | } | 62 | } |
63 | }, | 63 | }, |
64 | //////////////////////////////////////////////////////////////////// | 64 | //////////////////////////////////////////////////////////////////// |
65 | // | 65 | // |
66 | removeCloseEvents: { | 66 | removeCloseEvents: { |
67 | value: function () { | 67 | value: function () { |
68 | // | 68 | // |
69 | this._hasCloseEvents = false; | 69 | this._hasCloseEvents = false; |
70 | //////////////////////////////////////////////////////////// | 70 | //////////////////////////////////////////////////////////// |
71 | //Closing popups on resize | 71 | //Closing popups on resize |
72 | window.removeEventListener('resize', this, false); | 72 | window.removeEventListener('resize', this, false); |
73 | //Closing popups if outside limits | 73 | //Closing popups if outside limits |
74 | document.removeEventListener('mousedown', this, false); | 74 | document.removeEventListener('mousedown', this, false); |
75 | //////////////////////////////////////////////////////////// | 75 | //////////////////////////////////////////////////////////// |
76 | } | 76 | } |
77 | }, | 77 | }, |
78 | //////////////////////////////////////////////////////////////////// | 78 | //////////////////////////////////////////////////////////////////// |
79 | // | 79 | // |
80 | handleMousedown: { | 80 | handleMousedown: { |
81 | value: function (e) { | 81 | value: function (e) { |
82 | // | 82 | // |
83 | this.closeAllPopups(e); | 83 | this.closeAllPopups(e); |
84 | } | 84 | } |
85 | }, | 85 | }, |
86 | //////////////////////////////////////////////////////////////////// | 86 | //////////////////////////////////////////////////////////////////// |
87 | // | 87 | // |
88 | handleResize: { | 88 | handleResize: { |
89 | value: function (e) { | 89 | value: function (e) { |
90 | // | 90 | // |
91 | this.hideColorPopup(); | 91 | this.hideColorPopup(); |
92 | } | 92 | } |
93 | }, | 93 | }, |
94 | //////////////////////////////////////////////////////////////////// | 94 | //////////////////////////////////////////////////////////////////// |
95 | // | 95 | // |
96 | closeAllPopups: { | 96 | closeAllPopups: { |
97 | value: function (e) { | 97 | value: function (e) { |
98 | // | 98 | // |
99 | if (this._popupBase && !this._popupChipBase && !this._popupGradientChipBase) { | 99 | if (this._popupBase && !this._popupChipBase && !this._popupGradientChipBase) { |
100 | if(!this.popupHitCheck(this._popupBase, e)) { | 100 | if(!this.popupHitCheck(this._popupBase, e)) { |
101 | this.hideColorPopup(); | 101 | this.hideColorPopup(); |
102 | } | 102 | } |
103 | } else if (!this._popupBase && this._popupChipBase && !this._popupGradientChipBase) { | 103 | } else if (!this._popupBase && this._popupChipBase && !this._popupGradientChipBase) { |
104 | if(!this.popupHitCheck(this._popupChipBase, e)) { | 104 | if(!this.popupHitCheck(this._popupChipBase, e)) { |
105 | this.hideColorChipPopup(); | 105 | this.hideColorChipPopup(); |
106 | } | 106 | } |
107 | } else if (this._popupBase && this._popupChipBase && !this._popupGradientChipBase) { | 107 | } else if (this._popupBase && this._popupChipBase && !this._popupGradientChipBase) { |
108 | if(!this.popupHitCheck(this._popupBase, e) && !this.popupHitCheck(this._popupChipBase, e)) { | 108 | if(!this.popupHitCheck(this._popupBase, e) && !this.popupHitCheck(this._popupChipBase, e)) { |
109 | this.hideColorPopup(); | 109 | this.hideColorPopup(); |
110 | } | 110 | } |
111 | } else if (this._popupBase && this._popupChipBase && this._popupGradientChipBase) { | 111 | } else if (this._popupBase && this._popupChipBase && this._popupGradientChipBase) { |
112 | if(!this.popupHitCheck(this._popupBase, e) && !this.popupHitCheck(this._popupChipBase, e) && !this.popupHitCheck(this._popupGradientChipBase, e)) { | 112 | if(!this.popupHitCheck(this._popupBase, e) && !this.popupHitCheck(this._popupChipBase, e) && !this.popupHitCheck(this._popupGradientChipBase, e)) { |
113 | this.hideColorPopup(); | 113 | this.hideColorPopup(); |
114 | } | 114 | } |
115 | } else if (!this._popupBase && this._popupChipBase && this._popupGradientChipBase) { | 115 | } else if (!this._popupBase && this._popupChipBase && this._popupGradientChipBase) { |
116 | if(!this.popupHitCheck(this._popupChipBase, e) && !this.popupHitCheck(this._popupGradientChipBase, e)) { | 116 | if(!this.popupHitCheck(this._popupChipBase, e) && !this.popupHitCheck(this._popupGradientChipBase, e)) { |
117 | this.hideColorChipPopup(); | 117 | this.hideColorChipPopup(); |
118 | } | 118 | } |
119 | } else if (this._popupBase && !this._popupChipBase && this._popupGradientChipBase) { | 119 | } else if (this._popupBase && !this._popupChipBase && this._popupGradientChipBase) { |
120 | if(!this.popupHitCheck(this._popupBase, e) && !this.popupHitCheck(this._popupGradientChipBase, e)) { | 120 | if(!this.popupHitCheck(this._popupBase, e) && !this.popupHitCheck(this._popupGradientChipBase, e)) { |
121 | this.hideColorPopup(); | 121 | this.hideColorPopup(); |
122 | } | 122 | } |
123 | } | 123 | } |
124 | } | 124 | } |
125 | }, | 125 | }, |
126 | //////////////////////////////////////////////////////////////////// | 126 | //////////////////////////////////////////////////////////////////// |
127 | // | 127 | // |
128 | popupHitCheck: { | 128 | popupHitCheck: { |
129 | value: function (element, e) { | 129 | value: function (element, e) { |
130 | //Prevent any action for button to handle toggling | 130 | //Prevent any action for button to handle toggling |
131 | if (e._event.target.inputType || e._event.target.colorMode) return true; | 131 | if (e._event.target.inputType || e._event.target.colorMode) return true; |
132 | //Storing limits of popup | 132 | //Storing limits of popup |
133 | var top, bottom, left, right; | 133 | var top, bottom, left, right; |
134 | //Checking for popup to be opened otherwise nothing happens | 134 | //Checking for popup to be opened otherwise nothing happens |
135 | if (element && element.opened && element.popup && element.popup.element) { | 135 | if (element && element.opened && element.popup && element.popup.element) { |
136 | //Getting horizontal limits | 136 | //Getting horizontal limits |
137 | left = parseInt(element.popup.element.style.left) + parseInt(element.popup.element.style.marginLeft); | 137 | left = parseInt(element.popup.element.style.left) + parseInt(element.popup.element.style.marginLeft); |
138 | right = left + parseInt(element.popup.element.offsetWidth); | 138 | right = left + parseInt(element.popup.element.offsetWidth); |
139 | //Getting vertical limits | 139 | //Getting vertical limits |
140 | top = parseInt(element.popup.element.style.top) + parseInt(element.popup.element.style.marginTop); | 140 | top = parseInt(element.popup.element.style.top) + parseInt(element.popup.element.style.marginTop); |
141 | bottom = top + parseInt(element.popup.element.offsetHeight); | 141 | bottom = top + parseInt(element.popup.element.offsetHeight); |
142 | //Checking click position in relation to limits | 142 | //Checking click position in relation to limits |
143 | if ((e._event.clientX < left || e._event.clientX > right) || (e._event.clientY < top || e._event.clientY > bottom)) { | 143 | if ((e._event.clientX < left || e._event.clientX > right) || (e._event.clientY < top || e._event.clientY > bottom)) { |
144 | //Hides popups since click is outside limits | 144 | //Hides popups since click is outside limits |
145 | return false; | 145 | return false; |
146 | } else { | 146 | } else { |
147 | //Keeps popup open since click inside area | 147 | //Keeps popup open since click inside area |
148 | return true; | 148 | return true; |
149 | } | 149 | } |
150 | } else { | 150 | } else { |
151 | //Hides popups since element not detected | 151 | //Hides popups since element not detected |
152 | return false; | 152 | return false; |
153 | } | 153 | } |
154 |