diff options
Diffstat (limited to 'node_modules/montage/ui/scroller.reel')
-rw-r--r-- | node_modules/montage/ui/scroller.reel/scroller.html | 56 | ||||
-rw-r--r-- | node_modules/montage/ui/scroller.reel/scroller.js | 49 |
2 files changed, 22 insertions, 83 deletions
diff --git a/node_modules/montage/ui/scroller.reel/scroller.html b/node_modules/montage/ui/scroller.reel/scroller.html index 656db110..fc59297f 100644 --- a/node_modules/montage/ui/scroller.reel/scroller.html +++ b/node_modules/montage/ui/scroller.reel/scroller.html | |||
@@ -7,8 +7,8 @@ | |||
7 | <html> | 7 | <html> |
8 | <head> | 8 | <head> |
9 | <title></title> | 9 | <title></title> |
10 | <script type="text/montage-serialization"> | 10 | <script type="text/montage-serialization">{ |
11 | { | 11 | |
12 | "scrollbars": { | 12 | "scrollbars": { |
13 | "module": "montage/ui/scroll-bars.reel", | 13 | "module": "montage/ui/scroll-bars.reel", |
14 | "name": "ScrollBars", | 14 | "name": "ScrollBars", |
@@ -22,47 +22,17 @@ | |||
22 | "module": "montage/ui/composer/translate-composer", | 22 | "module": "montage/ui/composer/translate-composer", |
23 | "name": "TranslateComposer", | 23 | "name": "TranslateComposer", |
24 | "properties": { | 24 | "properties": { |
25 | "component": {"@": "owner"} | 25 | "component": {"@": "owner"}, |
26 | "invertAxis": true | ||
26 | }, | 27 | }, |
27 | "bindings": { | 28 | "bindings": { |
28 | "translateX": { | 29 | "translateX": {"<<->": "@owner.scrollX"}, |
29 | "boundObject": {"@": "owner"}, | 30 | "translateY": {"<<->": "@owner.scrollY"}, |
30 | "boundObjectPropertyPath": "scrollX", | 31 | "maxTranslateY": {"<<->": "@owner._maxTranslateY"}, |
31 | "oneway": false | 32 | "maxTranslateX": {"<<->": "@owner._maxTranslateX"}, |
32 | }, | 33 | "axis": {"<<->": "@owner.axis"}, |
33 | "translateY": { | 34 | "hasBouncing": {"<<->": "@owner.hasBouncing"}, |
34 | "boundObject": {"@": "owner"}, | 35 | "hasMomentum": {"<<->": "@owner.hasMomentum"} |
35 | "boundObjectPropertyPath": "scrollY", | ||
36 | "oneway": false | ||
37 | }, | ||
38 | "maxTranslateY": { | ||
39 | "boundObject": {"@": "owner"}, | ||
40 | "boundObjectPropertyPath": "_maxTranslateY" | ||
41 | }, | ||
42 | "maxTranslateX": { | ||
43 | "boundObject": {"@": "owner"}, | ||
44 | "boundObjectPropertyPath": "_maxTranslateX" | ||
45 | }, | ||
46 | "axis": { | ||
47 | "boundObject": {"@": "owner"}, | ||
48 | "boundObjectPropertyPath": "axis" | ||
49 | }, | ||
50 | "hasBouncing": { | ||
51 | "boundObject": {"@": "owner"}, | ||
52 | "boundObjectPropertyPath": "hasBouncing" | ||
53 | }, | ||
54 | "hasMomentum": { | ||
55 | "boundObject": {"@": "owner"}, | ||
56 | "boundObjectPropertyPath": "hasMomentum" | ||
57 | }, | ||
58 | "bouncingDuration": { | ||
59 | "boundObject": {"@": "owner"}, | ||
60 | "boundObjectPropertyPath": "bouncingDuration" | ||
61 | }, | ||
62 | "momentumDuration": { | ||
63 | "boundObject": {"@": "owner"}, | ||
64 | "boundObjectPropertyPath": "momentumDuration" | ||
65 | } | ||
66 | }, | 36 | }, |
67 | "listeners": [ | 37 | "listeners": [ |
68 | { | 38 | { |
@@ -90,8 +60,8 @@ | |||
90 | } | 60 | } |
91 | } | 61 | } |
92 | } | 62 | } |
93 | } | 63 | |
94 | </script> | 64 | }</script> |
95 | <style> | 65 | <style> |
96 | .montage-scroller { | 66 | .montage-scroller { |
97 | position: relative; | 67 | position: relative; |
diff --git a/node_modules/montage/ui/scroller.reel/scroller.js b/node_modules/montage/ui/scroller.reel/scroller.js index b578807e..8c367cd1 100644 --- a/node_modules/montage/ui/scroller.reel/scroller.js +++ b/node_modules/montage/ui/scroller.reel/scroller.js | |||
@@ -5,8 +5,7 @@ | |||
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | var Montage = require("montage").Montage, | 7 | var Montage = require("montage").Montage, |
8 | Component = require("ui/component").Component | 8 | Component = require("ui/component").Component; |
9 | TranslateComposer = require("ui/composer/translate-composer").TranslateComposer; | ||
10 | 9 | ||
11 | exports.Scroller = Montage.create(Component, { | 10 | exports.Scroller = Montage.create(Component, { |
12 | 11 | ||
@@ -116,40 +115,6 @@ exports.Scroller = Montage.create(Component, { | |||
116 | } | 115 | } |
117 | }, | 116 | }, |
118 | 117 | ||
119 | _momentumDuration: { | ||
120 | enumerable: false, | ||
121 | value: 650 | ||
122 | }, | ||
123 | |||
124 | momentumDuration: { | ||
125 | get: function () { | ||
126 | return this._momentumDuration; | ||
127 | }, | ||
128 | set: function (value) { | ||
129 | this._momentumDuration = isNaN(parseInt(value, 10)) ? 1 : parseInt(value, 10); | ||
130 | if (this._momentumDuration < 1) { | ||
131 | this._momentumDuration = 1; | ||
132 | } | ||
133 | } | ||
134 | }, | ||
135 | |||
136 | _bouncingDuration: { | ||
137 | enumerable: false, | ||
138 | value: 750 | ||
139 | }, | ||
140 | |||
141 | bouncingDuration: { | ||
142 | get: function () { | ||
143 | return this._bouncingDuration; | ||
144 | }, | ||
145 | set: function (value) { | ||
146 | this._bouncingDuration = isNaN(parseInt(value, 10)) ? 1 : parseInt(value, 10); | ||
147 | if (this._bouncingDuration < 1) { | ||
148 | this._bouncingDuration = 1; | ||
149 | } | ||
150 | } | ||
151 | }, | ||
152 | |||
153 | _content: { | 118 | _content: { |
154 | enumerable: false, | 119 | enumerable: false, |
155 | value: null | 120 | value: null |
@@ -157,11 +122,15 @@ exports.Scroller = Montage.create(Component, { | |||
157 | 122 | ||
158 | templateDidLoad: { | 123 | templateDidLoad: { |
159 | value: function () { | 124 | value: function () { |
160 | var orphanedFragment, | 125 | var orphanedFragment = document.createDocumentFragment(), |
161 | currentContentRange = this.element.ownerDocument.createRange(); | 126 | children = this.element.childNodes; |
162 | 127 | ||
163 | currentContentRange.selectNodeContents(this.element); | 128 | |
164 | orphanedFragment = currentContentRange.extractContents(); | 129 | while (children.length > 0) { |
130 | // As the nodes are appended to item.fragment they are removed | ||
131 | // from item.element, so always use index 0. | ||
132 | orphanedFragment.appendChild(children[0]); | ||
133 | } | ||
165 | this._content.appendChild(orphanedFragment); | 134 | this._content.appendChild(orphanedFragment); |
166 | } | 135 | } |
167 | }, | 136 | }, |