diff options
author | Valerio Virgillito | 2012-02-16 22:08:04 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-16 22:08:04 -0800 |
commit | 0175cb67e426a27a3ecfb7b81317caa383c8a5a5 (patch) | |
tree | b4fbfcaabaadff508ad5463e8f71fd643995aacb /node_modules/montage/ui/range-input.reel/range-input.js | |
parent | fe71cb9aa1700199c0089166ad54fc56eb760644 (diff) | |
parent | 9f0c4efe2ed9a00f2c5d85c9d88a8040fedb5d8f (diff) | |
download | ninja-0175cb67e426a27a3ecfb7b81317caa383c8a5a5.tar.gz |
Merge branch 'refs/heads/master' into components
Diffstat (limited to 'node_modules/montage/ui/range-input.reel/range-input.js')
-rw-r--r-- | node_modules/montage/ui/range-input.reel/range-input.js | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/node_modules/montage/ui/range-input.reel/range-input.js b/node_modules/montage/ui/range-input.reel/range-input.js index 0c247603..e97c2de9 100644 --- a/node_modules/montage/ui/range-input.reel/range-input.js +++ b/node_modules/montage/ui/range-input.reel/range-input.js | |||
@@ -3,22 +3,54 @@ | |||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | 3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> |
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. |
5 | </copyright> */ | 5 | </copyright> */ |
6 | /*global require,exports */ | ||
6 | var Montage = require("montage").Montage, | 7 | var Montage = require("montage").Montage, |
7 | Component = require("ui/component").Component, | 8 | Component = require("ui/component").Component, |
8 | TextInput = require("ui/text-input").TextInput; | 9 | TextInput = require("ui/text-input").TextInput, |
10 | PressComposer = require("ui/composer/press-composer").PressComposer; | ||
11 | |||
9 | /** | 12 | /** |
10 | * The input type="range" field | 13 | * The input type="range" field |
11 | */ | 14 | */ |
12 | var RangeInput = exports.RangeInput = Montage.create(TextInput, { | 15 | var RangeInput = exports.RangeInput = Montage.create(TextInput, { |
16 | prepareForActivationEvents: { | ||
17 | value: function() { | ||
18 | var pressComposer = PressComposer.create(); | ||
19 | pressComposer.delegate = this; | ||
20 | this.addComposer(pressComposer); | ||
21 | pressComposer.addEventListener("pressstart", this, false); | ||
22 | pressComposer.addEventListener("press", this, false); | ||
23 | pressComposer.addEventListener("presscancel", this, false); | ||
24 | } | ||
25 | }, | ||
26 | |||
27 | handlePressstart: { | ||
28 | value: function(e) { | ||
29 | var interactionStartEvent = document.createEvent("CustomEvent"); | ||
30 | interactionStartEvent.initCustomEvent("montage_range_interaction_start", true, true, null); | ||
31 | this.dispatchEvent(interactionStartEvent); | ||
32 | } | ||
33 | }, | ||
34 | |||
35 | handlePress: { | ||
36 | value: function(e) { | ||
37 | var interactionEndEvent = document.createEvent("CustomEvent"); | ||
38 | interactionEndEvent.initCustomEvent("montage_range_interaction_end", true, true, null); | ||
39 | this.dispatchEvent(interactionEndEvent); | ||
40 | } | ||
41 | }, | ||
13 | 42 | ||
43 | surrenderPointer: { | ||
44 | value: function(pointer, composer) { | ||
45 | // If the user is sliding us then we do not want anyone using | ||
46 | // the pointer | ||
47 | return false; | ||
48 | } | ||
49 | } | ||
14 | }); | 50 | }); |
15 | 51 | ||
16 | RangeInput.addAttributes({ | 52 | RangeInput.addAttributes({ |
17 | disabled: {dataType: 'boolean'}, | 53 | max: {dataType: 'number'}, |
18 | max: null, | 54 | min: {dataType: 'number'}, |
19 | min: null, | 55 | step: null // number or 'any' |
20 | name: null, | ||
21 | readonly: {dataType: 'boolean'}, | ||
22 | required: {dataType: 'boolean'}, | ||
23 | step: null | ||
24 | }); | 56 | }); |