ace-colorpicker-rpk 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/.babelrc +30 -0
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +35 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
  4. package/ChangeLogs.md +22 -0
  5. package/LICENSE +21 -0
  6. package/README.md +117 -0
  7. package/addon/ace-colorpicker.css +1074 -0
  8. package/addon/ace-colorpicker.js +9602 -0
  9. package/addon/sample/colorpicker.html +199 -0
  10. package/config/rollup.config.dev.js +52 -0
  11. package/config/rollup.config.prod.js +53 -0
  12. package/dist/ace-colorpicker.css +1074 -0
  13. package/dist/ace-colorpicker.js +9736 -0
  14. package/dist/ace-colorpicker.min.js +1 -0
  15. package/gl.html +56 -0
  16. package/index.html +172 -0
  17. package/package.json +87 -0
  18. package/resources/image/ace-editor.png +0 -0
  19. package/resources/image/colorpaletts.png +0 -0
  20. package/resources/image/colorpicker.png +0 -0
  21. package/resources/image/grapes.jpg +0 -0
  22. package/resources/image/palette-type.png +0 -0
  23. package/resources/image/scalecolors-title.png +0 -0
  24. package/resources/image/scalecolors.png +0 -0
  25. package/resources/image/screen-shot.png +0 -0
  26. package/resources/image/sketch-type.png +0 -0
  27. package/src/colorpicker/BaseBox.js +94 -0
  28. package/src/colorpicker/BaseColorPicker.js +404 -0
  29. package/src/colorpicker/BaseModule.js +19 -0
  30. package/src/colorpicker/BaseSlider.js +97 -0
  31. package/src/colorpicker/BaseStore.js +71 -0
  32. package/src/colorpicker/UIElement.js +46 -0
  33. package/src/colorpicker/VerticalSlider.js +57 -0
  34. package/src/colorpicker/chromedevtool/ColorControl.js +47 -0
  35. package/src/colorpicker/chromedevtool/index.js +36 -0
  36. package/src/colorpicker/index.js +37 -0
  37. package/src/colorpicker/macos/ColorControl.js +47 -0
  38. package/src/colorpicker/macos/index.js +38 -0
  39. package/src/colorpicker/mini/ColorControl.js +40 -0
  40. package/src/colorpicker/mini/index.js +24 -0
  41. package/src/colorpicker/mini-vertical/ColorControl.js +35 -0
  42. package/src/colorpicker/mini-vertical/index.js +23 -0
  43. package/src/colorpicker/module/ColorManager.js +111 -0
  44. package/src/colorpicker/module/ColorSetsList.js +132 -0
  45. package/src/colorpicker/ring/ColorControl.js +47 -0
  46. package/src/colorpicker/ring/index.js +42 -0
  47. package/src/colorpicker/ui/ColorInformation.js +216 -0
  48. package/src/colorpicker/ui/ColorPalette.js +130 -0
  49. package/src/colorpicker/ui/ColorRing.js +68 -0
  50. package/src/colorpicker/ui/ColorSetsChooser.js +96 -0
  51. package/src/colorpicker/ui/ColorWheel.js +257 -0
  52. package/src/colorpicker/ui/CurrentColorSets.js +81 -0
  53. package/src/colorpicker/ui/CurrentColorSetsContextMenu.js +63 -0
  54. package/src/colorpicker/ui/control/Hue.js +40 -0
  55. package/src/colorpicker/ui/control/Opacity.js +65 -0
  56. package/src/colorpicker/ui/control/Value.js +50 -0
  57. package/src/colorpicker/ui/control/VerticalHue.js +39 -0
  58. package/src/colorpicker/ui/control/VerticalOpacity.js +55 -0
  59. package/src/colorpicker/vscode/ColorControl.js +40 -0
  60. package/src/colorpicker/vscode/index.js +82 -0
  61. package/src/colorpicker/xd/ColorControl.js +36 -0
  62. package/src/colorpicker/xd/index.js +36 -0
  63. package/src/extension/ace/colorview.js +198 -0
  64. package/src/extension/ace/index.js +11 -0
  65. package/src/index.js +12 -0
  66. package/src/scss/colorpicker.scss +65 -0
  67. package/src/scss/colorview.scss +32 -0
  68. package/src/scss/component/button.scss +33 -0
  69. package/src/scss/component/colorchooser.scss +141 -0
  70. package/src/scss/component/colorsets-contextmenu.scss +33 -0
  71. package/src/scss/component/colorsets.scss +89 -0
  72. package/src/scss/component/control.scss +93 -0
  73. package/src/scss/component/gradient-editor.scss +260 -0
  74. package/src/scss/component/gradient-picker.scss +241 -0
  75. package/src/scss/component/information.scss +141 -0
  76. package/src/scss/component/palette.scss +45 -0
  77. package/src/scss/index.scss +5 -0
  78. package/src/scss/mixins.scss +21 -0
  79. package/src/scss/themes/macos.scss +71 -0
  80. package/src/scss/themes/mini-vertical.scss +94 -0
  81. package/src/scss/themes/mini.scss +76 -0
  82. package/src/scss/themes/palette.scss +85 -0
  83. package/src/scss/themes/ring.scss +57 -0
  84. package/src/scss/themes/sketch.scss +172 -0
  85. package/src/scss/themes/vscode.scss +93 -0
  86. package/src/scss/themes/xd.scss +88 -0
  87. package/src/util/Blender.js +29 -0
  88. package/src/util/Canvas.js +128 -0
  89. package/src/util/Color.js +27 -0
  90. package/src/util/ColorNames.js +14 -0
  91. package/src/util/Dom.js +361 -0
  92. package/src/util/Event.js +30 -0
  93. package/src/util/EventMachin.js +349 -0
  94. package/src/util/GL.js +8 -0
  95. package/src/util/HueColor.js +49 -0
  96. package/src/util/ImageFilter.js +9 -0
  97. package/src/util/ImageLoader.js +137 -0
  98. package/src/util/Kmeans.js +237 -0
  99. package/src/util/Matrix.js +196 -0
  100. package/src/util/State.js +42 -0
  101. package/src/util/blend/composite.js +124 -0
  102. package/src/util/blend/non-separable.js +118 -0
  103. package/src/util/blend/separable.js +76 -0
  104. package/src/util/filter/StackBlur.js +517 -0
  105. package/src/util/filter/functions.js +829 -0
  106. package/src/util/filter/image/crop.js +16 -0
  107. package/src/util/filter/image/flipH.js +23 -0
  108. package/src/util/filter/image/flipV.js +25 -0
  109. package/src/util/filter/image/histogram.js +45 -0
  110. package/src/util/filter/image/index.js +18 -0
  111. package/src/util/filter/image/resize.js +18 -0
  112. package/src/util/filter/image/rotate.js +39 -0
  113. package/src/util/filter/image/rotateDegree.js +53 -0
  114. package/src/util/filter/index.js +11 -0
  115. package/src/util/filter/matrix/blur.js +12 -0
  116. package/src/util/filter/matrix/emboss.js +17 -0
  117. package/src/util/filter/matrix/gaussian-blur-5x.js +17 -0
  118. package/src/util/filter/matrix/gaussian-blur.js +16 -0
  119. package/src/util/filter/matrix/grayscale2.js +16 -0
  120. package/src/util/filter/matrix/index.js +58 -0
  121. package/src/util/filter/matrix/kirsch-horizontal.js +13 -0
  122. package/src/util/filter/matrix/kirsch-vertical.js +13 -0
  123. package/src/util/filter/matrix/laplacian-5x.js +16 -0
  124. package/src/util/filter/matrix/laplacian.js +14 -0
  125. package/src/util/filter/matrix/motion-blur-2.js +18 -0
  126. package/src/util/filter/matrix/motion-blur-3.js +19 -0
  127. package/src/util/filter/matrix/motion-blur.js +18 -0
  128. package/src/util/filter/matrix/negative.js +16 -0
  129. package/src/util/filter/matrix/normal.js +11 -0
  130. package/src/util/filter/matrix/sepia2.js +16 -0
  131. package/src/util/filter/matrix/sharpen.js +14 -0
  132. package/src/util/filter/matrix/sobel-horizontal.js +11 -0
  133. package/src/util/filter/matrix/sobel-vertical.js +11 -0
  134. package/src/util/filter/matrix/stack-blur.js +15 -0
  135. package/src/util/filter/matrix/transparency.js +16 -0
  136. package/src/util/filter/matrix/unsharp-masking.js +16 -0
  137. package/src/util/filter/multi/index.js +9 -0
  138. package/src/util/filter/multi/kirsch.js +7 -0
  139. package/src/util/filter/multi/sobel.js +7 -0
  140. package/src/util/filter/multi/vintage.js +7 -0
  141. package/src/util/filter/pixel/bitonal.js +24 -0
  142. package/src/util/filter/pixel/brightness.js +19 -0
  143. package/src/util/filter/pixel/brownie.js +23 -0
  144. package/src/util/filter/pixel/clip.js +21 -0
  145. package/src/util/filter/pixel/contrast.js +18 -0
  146. package/src/util/filter/pixel/gamma.js +13 -0
  147. package/src/util/filter/pixel/gradient.js +52 -0
  148. package/src/util/filter/pixel/grayscale.js +27 -0
  149. package/src/util/filter/pixel/hue.js +28 -0
  150. package/src/util/filter/pixel/index.js +52 -0
  151. package/src/util/filter/pixel/invert.js +16 -0
  152. package/src/util/filter/pixel/kodachrome.js +23 -0
  153. package/src/util/filter/pixel/matrix.js +28 -0
  154. package/src/util/filter/pixel/noise.js +24 -0
  155. package/src/util/filter/pixel/opacity.js +14 -0
  156. package/src/util/filter/pixel/polaroid.js +23 -0
  157. package/src/util/filter/pixel/saturation.js +30 -0
  158. package/src/util/filter/pixel/sepia.js +28 -0
  159. package/src/util/filter/pixel/shade.js +21 -0
  160. package/src/util/filter/pixel/shift.js +23 -0
  161. package/src/util/filter/pixel/solarize.js +23 -0
  162. package/src/util/filter/pixel/technicolor.js +23 -0
  163. package/src/util/filter/pixel/threshold-color.js +35 -0
  164. package/src/util/filter/pixel/threshold.js +7 -0
  165. package/src/util/filter/pixel/tint.js +20 -0
  166. package/src/util/functions/formatter.js +99 -0
  167. package/src/util/functions/fromCMYK.js +17 -0
  168. package/src/util/functions/fromHSL.js +52 -0
  169. package/src/util/functions/fromHSV.js +64 -0
  170. package/src/util/functions/fromLAB.js +99 -0
  171. package/src/util/functions/fromRGB.js +220 -0
  172. package/src/util/functions/fromYCrCb.js +16 -0
  173. package/src/util/functions/func.js +194 -0
  174. package/src/util/functions/image.js +145 -0
  175. package/src/util/functions/math.js +56 -0
  176. package/src/util/functions/mixin.js +164 -0
  177. package/src/util/functions/parser.js +294 -0
  178. package/src/util/gl/filter/index.js +9 -0
  179. package/src/util/gl/filter/matrix/blur.js +9 -0
  180. package/src/util/gl/filter/matrix/emboss.js +17 -0
  181. package/src/util/gl/filter/matrix/gaussian-blur-5x.js +15 -0
  182. package/src/util/gl/filter/matrix/gaussian-blur.js +19 -0
  183. package/src/util/gl/filter/matrix/grayscale2.js +13 -0
  184. package/src/util/gl/filter/matrix/index.js +55 -0
  185. package/src/util/gl/filter/matrix/kirsch-horizontal.js +11 -0
  186. package/src/util/gl/filter/matrix/kirsch-vertical.js +11 -0
  187. package/src/util/gl/filter/matrix/laplacian-5x.js +13 -0
  188. package/src/util/gl/filter/matrix/laplacian.js +11 -0
  189. package/src/util/gl/filter/matrix/motion-blur-2.js +17 -0
  190. package/src/util/gl/filter/matrix/motion-blur-3.js +17 -0
  191. package/src/util/gl/filter/matrix/motion-blur.js +17 -0
  192. package/src/util/gl/filter/matrix/negative.js +13 -0
  193. package/src/util/gl/filter/matrix/normal.js +8 -0
  194. package/src/util/gl/filter/matrix/sepia2.js +13 -0
  195. package/src/util/gl/filter/matrix/sharpen.js +11 -0
  196. package/src/util/gl/filter/matrix/sobel-horizontal.js +11 -0
  197. package/src/util/gl/filter/matrix/sobel-vertical.js +11 -0
  198. package/src/util/gl/filter/matrix/transparency.js +13 -0
  199. package/src/util/gl/filter/matrix/unsharp-masking.js +14 -0
  200. package/src/util/gl/filter/multi/index.js +9 -0
  201. package/src/util/gl/filter/multi/kirsch.js +7 -0
  202. package/src/util/gl/filter/multi/sobel.js +7 -0
  203. package/src/util/gl/filter/multi/vintage.js +7 -0
  204. package/src/util/gl/filter/pixel/bitonal.js +22 -0
  205. package/src/util/gl/filter/pixel/brightness.js +14 -0
  206. package/src/util/gl/filter/pixel/brownie.js +11 -0
  207. package/src/util/gl/filter/pixel/chaos.js +20 -0
  208. package/src/util/gl/filter/pixel/clip.js +20 -0
  209. package/src/util/gl/filter/pixel/contrast.js +16 -0
  210. package/src/util/gl/filter/pixel/gamma.js +16 -0
  211. package/src/util/gl/filter/pixel/gradient.js +59 -0
  212. package/src/util/gl/filter/pixel/grayscale.js +22 -0
  213. package/src/util/gl/filter/pixel/hue.js +19 -0
  214. package/src/util/gl/filter/pixel/index.js +54 -0
  215. package/src/util/gl/filter/pixel/invert.js +18 -0
  216. package/src/util/gl/filter/pixel/kodachrome.js +11 -0
  217. package/src/util/gl/filter/pixel/matrix.js +29 -0
  218. package/src/util/gl/filter/pixel/noise.js +18 -0
  219. package/src/util/gl/filter/pixel/opacity.js +17 -0
  220. package/src/util/gl/filter/pixel/polaroid.js +11 -0
  221. package/src/util/gl/filter/pixel/saturation.js +20 -0
  222. package/src/util/gl/filter/pixel/sepia.js +19 -0
  223. package/src/util/gl/filter/pixel/shade.js +20 -0
  224. package/src/util/gl/filter/pixel/shift.js +11 -0
  225. package/src/util/gl/filter/pixel/solarize.js +21 -0
  226. package/src/util/gl/filter/pixel/technicolor.js +11 -0
  227. package/src/util/gl/filter/pixel/threshold-color.js +15 -0
  228. package/src/util/gl/filter/pixel/threshold.js +7 -0
  229. package/src/util/gl/filter/pixel/tint.js +25 -0
  230. package/src/util/gl/filter/util.js +185 -0
  231. package/src/util/gl/functions.js +158 -0
  232. package/src/util/gl/index.js +543 -0
  233. package/src/util/index.js +17 -0
  234. package/stand.html +975 -0
  235. package/test/util.Blend.spec.js +15 -0
  236. package/test/util.Color.spec.js +200 -0
  237. package/test/util.Filter.spec.js +12 -0
  238. package/test/util.ImageFilter.spec.js +16 -0
@@ -0,0 +1,361 @@
1
+ import ColorUtil from './Color'
2
+
3
+ const color = ColorUtil.color;
4
+
5
+ let counter = 0;
6
+ let cached = [];
7
+
8
+ export default class Dom {
9
+
10
+ constructor (tag, className, attr) {
11
+
12
+ if (typeof tag != 'string') {
13
+ this.el = tag;
14
+ } else {
15
+
16
+ var el = document.createElement(tag);
17
+ this.uniqId = counter++;
18
+
19
+ if (className) {
20
+ el.className = className;
21
+ }
22
+
23
+ attr = attr || {};
24
+
25
+ for(var k in attr) {
26
+ el.setAttribute(k, attr[k]);
27
+ }
28
+
29
+ this.el = el;
30
+ }
31
+ }
32
+
33
+ static getScrollTop () {
34
+ return Math.max(window.pageYOffset, document.documentElement.scrollTop, document.body.scrollTop)
35
+ }
36
+
37
+ static getScrollLeft () {
38
+ return Math.max(window.pageXOffset, document.documentElement.scrollLeft, document.body.scrollLeft)
39
+ }
40
+
41
+ attr (key, value) {
42
+ if (arguments.length == 1) {
43
+ return this.el.getAttribute(key);
44
+ }
45
+
46
+ this.el.setAttribute(key, value);
47
+
48
+ return this;
49
+ }
50
+
51
+ closest (cls) {
52
+
53
+ var temp = this;
54
+ var checkCls = false;
55
+
56
+ while(!(checkCls = temp.hasClass(cls))) {
57
+ if (temp.el.parentNode) {
58
+ temp = new Dom(temp.el.parentNode);
59
+ } else {
60
+ return null;
61
+ }
62
+ }
63
+
64
+ if (checkCls) {
65
+ return temp;
66
+ }
67
+
68
+ return null;
69
+ }
70
+
71
+ checked() {
72
+ return this.el.checked;
73
+ }
74
+
75
+ removeClass (cls) {
76
+ this.el.className = ((` ${this.el.className} `).replace(` ${cls} `, ' ')).trim();
77
+
78
+ return this;
79
+ }
80
+
81
+ hasClass (cls) {
82
+ if (!this.el.className)
83
+ {
84
+ return false;
85
+ } else {
86
+ var newClass = ` ${this.el.className} `;
87
+ return newClass.indexOf(` ${cls} `) > -1;
88
+ }
89
+ }
90
+
91
+ addClass (cls) {
92
+ if (!this.hasClass(cls)) {
93
+ this.el.className = `${this.el.className} ${cls}`;
94
+ }
95
+
96
+ return this;
97
+
98
+ }
99
+
100
+ toggleClass (cls) {
101
+ if (this.hasClass(cls)) {
102
+ this.removeClass(cls);
103
+ } else {
104
+ this.addClass(cls);
105
+ }
106
+ }
107
+
108
+ html (html) {
109
+ try {
110
+ if (typeof html == 'string') {
111
+ this.el.innerHTML = html;
112
+ } else {
113
+ this.empty().append(html);
114
+ }
115
+
116
+ } catch (e) {
117
+ console.log(html);
118
+ }
119
+
120
+ return this;
121
+ }
122
+
123
+ find (selector) {
124
+ return this.el.querySelector(selector)
125
+ }
126
+
127
+ $ (selector) {
128
+ return new Dom(this.find(selector))
129
+ }
130
+
131
+ findAll (selector) {
132
+ return this.el.querySelectorAll(selector)
133
+ }
134
+
135
+ $$ (selector) {
136
+ return [...this.findAll(selector)].map(el => new Dom(el))
137
+ }
138
+
139
+
140
+ empty () {
141
+ return this.html('');
142
+ }
143
+
144
+ append (el) {
145
+
146
+ if (typeof el == 'string') {
147
+ this.el.appendChild(document.createTextNode(el));
148
+ } else {
149
+ this.el.appendChild(el.el || el);
150
+ }
151
+
152
+ return this;
153
+ }
154
+
155
+ appendTo (target) {
156
+ var t = target.el ? target.el : target;
157
+
158
+ t.appendChild(this.el);
159
+
160
+ return this;
161
+ }
162
+
163
+ remove () {
164
+ if (this.el.parentNode) {
165
+ this.el.parentNode.removeChild(this.el);
166
+ }
167
+
168
+ return this;
169
+ }
170
+
171
+ text () {
172
+ return this.el.textContent;
173
+ }
174
+
175
+ css (key, value) {
176
+ if (arguments.length == 2) {
177
+ this.el.style[key] = value;
178
+ } else if (arguments.length == 1) {
179
+
180
+ if (typeof key == 'string') {
181
+ return getComputedStyle(this.el)[key];
182
+ } else {
183
+ var keys = key || {};
184
+ Object.keys(keys).forEach(k => {
185
+ this.el.style[k] = keys[k];
186
+ })
187
+ }
188
+
189
+ }
190
+
191
+ return this;
192
+ }
193
+
194
+ cssFloat (key) {
195
+ return parseFloat(this.css(key));
196
+ }
197
+
198
+ cssInt (key) {
199
+ return parseInt(this.css(key));
200
+ }
201
+
202
+ offset () {
203
+ var rect = this.el.getBoundingClientRect();
204
+
205
+ return {
206
+ top: rect.top + Dom.getScrollTop(),
207
+ left: rect.left + Dom.getScrollLeft()
208
+ };
209
+ }
210
+
211
+ rect () {
212
+ return this.el.getBoundingClientRect()
213
+ }
214
+
215
+ position () {
216
+
217
+ if (this.el.style.top) {
218
+ return {
219
+ top: parseFloat(this.css('top')),
220
+ left: parseFloat(this.css('left'))
221
+ };
222
+ } else {
223
+ return this.el.getBoundingClientRect();
224
+ }
225
+
226
+ }
227
+
228
+ size () {
229
+ return [this.width(), this.height()]
230
+ }
231
+
232
+ width () {
233
+ return this.el.offsetWidth || this.el.getBoundingClientRect().width;
234
+ }
235
+
236
+ contentWidth() {
237
+ return this.width() - this.cssFloat('padding-left') - this.cssFloat('padding-right');
238
+ }
239
+
240
+ height () {
241
+ return this.el.offsetHeight || this.el.getBoundingClientRect().height;
242
+ }
243
+
244
+
245
+ contentHeight() {
246
+ return this.height() - this.cssFloat('padding-top') - this.cssFloat('padding-bottom');
247
+ }
248
+
249
+ dataKey (key) {
250
+ return this.uniqId + '.' + key;
251
+ }
252
+
253
+ data (key, value) {
254
+ if (arguments.length == 2) {
255
+ cached[this.dataKey(key)] = value;
256
+ } else if (arguments.length == 1) {
257
+ return cached[this.dataKey(key)];
258
+ } else {
259
+ var keys = Object.keys(cached);
260
+
261
+ var uniqId = this.uniqId + ".";
262
+ return keys.filter(function (key) {
263
+ if (key.indexOf(uniqId) == 0) {
264
+ return true;
265
+ }
266
+
267
+ return false;
268
+ }).map(function (value) {
269
+ return cached[value];
270
+ })
271
+ }
272
+
273
+ return this;
274
+ }
275
+
276
+ val (value) {
277
+ if (arguments.length == 0) {
278
+ return this.el.value;
279
+ } else if (arguments.length == 1) {
280
+ this.el.value = value;
281
+ }
282
+
283
+ return this;
284
+ }
285
+
286
+ int () {
287
+ return parseInt(this.val(), 10);
288
+ }
289
+
290
+ float () {
291
+ return parseFloat(this.val());
292
+ }
293
+
294
+ show () {
295
+ return this.css('display', 'block');
296
+ }
297
+
298
+ hide () {
299
+ return this.css('display', 'none');
300
+ }
301
+
302
+ toggle () {
303
+ if (this.css('display') == 'none') {
304
+ return this.show();
305
+ } else {
306
+ return this.hide();
307
+ }
308
+ }
309
+
310
+ scrollTop () {
311
+ if (this.el === document.body) {
312
+ return Dom.getScrollTop()
313
+ }
314
+
315
+ return this.el.scrollTop
316
+ }
317
+
318
+ scrollLeft () {
319
+ if (this.el === document.body) {
320
+ return Dom.getScrollLeft()
321
+ }
322
+
323
+ return this.el.scrollLeft
324
+ }
325
+
326
+ on (eventName, callback, opt1, opt2) {
327
+ this.el.addEventListener(eventName, callback, opt1, opt2);
328
+
329
+ return this;
330
+ }
331
+
332
+ off (eventName, callback ) {
333
+ this.el.removeEventListener(eventName, callback);
334
+
335
+ return this;
336
+ }
337
+
338
+ getElement ( ) {
339
+ return this.el;
340
+ }
341
+
342
+ createChild (tag, className = '', attrs = {}, css = {}) {
343
+ let $element = new Dom(tag, className, attrs);
344
+ $element.css(css);
345
+
346
+ this.append($element);
347
+
348
+ return $element;
349
+ }
350
+
351
+ firstChild () {
352
+ return new Dom(this.el.firstElementChild);
353
+ }
354
+
355
+ replace (oldElement, newElement) {
356
+ this.el.replaceChild(newElement, oldElement);
357
+
358
+ return this;
359
+ }
360
+ }
361
+
@@ -0,0 +1,30 @@
1
+ export default {
2
+
3
+ addEvent (dom, eventName, callback, options) {
4
+ if (dom) {
5
+ dom.addEventListener(eventName, callback, options);
6
+ }
7
+ },
8
+
9
+ removeEvent(dom, eventName, callback) {
10
+ if (dom) {
11
+ dom.removeEventListener(eventName, callback);
12
+ }
13
+ },
14
+
15
+ pos(e) {
16
+ if (e.touches && e.touches[0]) {
17
+ return e.touches[0];
18
+ }
19
+
20
+ return e;
21
+ },
22
+
23
+ posXY (e) {
24
+ var pos = this.pos(e);
25
+ return {
26
+ x: pos.pageX,
27
+ y: pos.pageY
28
+ }
29
+ }
30
+ }