-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
141 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/*globals Hedwig*/ | ||
var MyExampleView = SC.ScrollView.extend({ | ||
horizontalAlign: SC.ALIGN_CENTER, | ||
verticalAlign: SC.ALIGN_MIDDLE, | ||
backgroundColor: "#555", | ||
|
||
canScale: YES, | ||
alwaysBounceVertical: NO, | ||
|
||
contentView: SC.ImageView.design({ | ||
layout: { left: 0, top: 0, width: 1357, height: 2048 }, | ||
value: Hedwig.SAMPLE_IMAGE | ||
}) | ||
}); | ||
|
||
// bootstrap code :) | ||
exports.getDemoView = function() { | ||
return MyExampleView; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"content":"<h1>ScrollView Touch Support</h1>","errors":[],"demos":{},"articleDirectory":"articles/controls/scroll/","outputDirectory":"build/","title":"ScrollView Touch Support"} | ||
{"content":"<h1>ScrollView Touch Support</h1>\n\n<p>SproutCore's ScrollView comes with built-in support for touch-based\nscrolling, including momentum and bouncing. In addition, it has (somewhat experimental)\nsupport for scaling.</p>\n\n<p>For many cases, just putting a view inside a ScrollView will \"just work\". Still, you may want\nto set some settings.</p>\n\n<h2>Bouncing</h2>\n\n<p>By default, ScrollView will <em>always</em> bounce when scrolling vertically, regardless of the\ncontent's height, but only bounce horizontally <em>if</em> the content is wider than the ScrollView.\nThis is controlled by two properties:</p>\n\n<ul>\n<li>alwaysBounceHorizontal, which defaults to NO.</li>\n<li>alwaysBounceVertical, which defaults to YES.</li>\n</ul>\n\n<h2>Scaling</h2>\n\n<p>ScrollView has support for scaling, which you can use through a few properties:</p>\n\n<ul>\n<li>canScale. Specifies whether the content may be scaled. If YES, using two fingers\n(in that classic \"pinch gesture\") will zoom the content.</li>\n<li>minimumScale: The minimum scale value. Default: 0.25.</li>\n<li>maximumScale: The maximum scale value. Default: 2.0.</li>\n</ul>\n\n<p><a href='touch.js' class='demo'>touch.js</a></p>","errors":[],"demos":{"touch.js":{"ex":"/*globals Hedwig*/\nvar MyExampleView = SC.ScrollView.extend({\n horizontalAlign: SC.ALIGN_CENTER,\n verticalAlign: SC.ALIGN_MIDDLE,\n backgroundColor: \"#555\",\n \n canScale: YES,\n alwaysBounceVertical: NO,\n \n contentView: SC.ImageView.design({\n layout: { left: 0, top: 0, width: 1357, height: 2048 },\n value: Hedwig.SAMPLE_IMAGE\n })\n});\n\n// bootstrap code :)\nexports.getDemoView = function() {\n return MyExampleView;\n};\n","highlighted":"<span class=\"multiline comment\">/*globals Hedwig*/</span>\n<span class=\"keyword\">var</span> <span class=\"class\">MyExampleView</span> = <span class=\"class\">SC</span>.<span class=\"class\">ScrollView</span>.<span class=\"variable\">extend</span>({\n <span class=\"variable\">horizontalAlign</span>: <span class=\"class\">SC</span>.<span class=\"class\">ALIGN_CENTER</span>,\n <span class=\"variable\">verticalAlign</span>: <span class=\"class\">SC</span>.<span class=\"class\">ALIGN_MIDDLE</span>,\n <span class=\"variable\">backgroundColor</span>: <span class=\"string\">"#555"</span>,\n \n <span class=\"variable\">canScale</span>: <span class=\"class\">YES</span>,\n <span class=\"variable\">alwaysBounceVertical</span>: <span class=\"class\">NO</span>,\n \n <span class=\"variable\">contentView</span>: <span class=\"class\">SC</span>.<span class=\"class\">ImageView</span>.<span class=\"variable\">design</span>({\n <span class=\"variable\">layout</span>: { <span class=\"variable\">left</span>: <span class=\"number integer\">0</span>, <span class=\"variable\">top</span>: <span class=\"number integer\">0</span>, <span class=\"variable\">width</span>: <span class=\"number integer\">1357</span>, <span class=\"variable\">height</span>: <span class=\"number integer\">2048</span> },\n <span class=\"variable\">value</span>: <span class=\"class\">Hedwig</span>.<span class=\"class\">SAMPLE_IMAGE</span>\n })\n});\n\n<span class=\"comment\">// bootstrap code :)</span>\n<span class=\"variable\">exports</span>.<span class=\"variable\">getDemoView</span> = <span class=\"keyword\">function</span>() {\n <span class=\"keyword\">return</span> <span class=\"class\">MyExampleView</span>;\n};\n","original":"/*globals Hedwig*/\nvar MyExampleView = SC.ScrollView.extend({\n horizontalAlign: SC.ALIGN_CENTER,\n verticalAlign: SC.ALIGN_MIDDLE,\n backgroundColor: \"#555\",\n \n canScale: YES,\n alwaysBounceVertical: NO,\n \n contentView: SC.ImageView.design({\n layout: { left: 0, top: 0, width: 1357, height: 2048 },\n value: Hedwig.SAMPLE_IMAGE\n })\n});\n\n// bootstrap code :)\nexports.getDemoView = function() {\n return MyExampleView;\n};\n"}},"articleDirectory":"articles/controls/scroll/","outputDirectory":"build/","title":"ScrollView Touch Support"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,30 @@ | ||
ScrollView Touch Support | ||
========================= | ||
========================= | ||
SproutCore's ScrollView comes with built-in support for touch-based | ||
scrolling, including momentum and bouncing. In addition, it has (somewhat experimental) | ||
support for scaling. | ||
|
||
For many cases, just putting a view inside a ScrollView will "just work". Still, you may want | ||
to set some settings. | ||
|
||
Bouncing | ||
---------- | ||
By default, ScrollView will _always_ bounce when scrolling vertically, regardless of the | ||
content's height, but only bounce horizontally _if_ the content is wider than the ScrollView. | ||
This is controlled by two properties: | ||
|
||
- alwaysBounceHorizontal, which defaults to NO. | ||
- alwaysBounceVertical, which defaults to YES. | ||
|
||
|
||
Scaling | ||
-------- | ||
ScrollView has support for scaling, which you can use through a few properties: | ||
|
||
- canScale. Specifies whether the content may be scaled. If YES, using two fingers | ||
(in that classic "pinch gesture") will zoom the content. | ||
- minimumScale: The minimum scale value. Default: 0.25. | ||
- maximumScale: The maximum scale value. Default: 2.0. | ||
|
||
|
||
{{demo:sc|touch.js}} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/*globals Hedwig*/ | ||
var MyExampleView = SC.ScrollView.extend({ | ||
horizontalAlign: SC.ALIGN_CENTER, | ||
verticalAlign: SC.ALIGN_MIDDLE, | ||
backgroundColor: "#555", | ||
|
||
canScale: YES, | ||
alwaysBounceVertical: NO, | ||
|
||
contentView: SC.ImageView.design({ | ||
layout: { left: 0, top: 0, width: 1357, height: 2048 }, | ||
value: Hedwig.SAMPLE_IMAGE | ||
}) | ||
}); | ||
|
||
// bootstrap code :) | ||
exports.getDemoView = function() { | ||
return MyExampleView; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,30 @@ | ||
ScrollView Touch Support | ||
========================= | ||
========================= | ||
SproutCore's ScrollView comes with built-in support for touch-based | ||
scrolling, including momentum and bouncing. In addition, it has (somewhat experimental) | ||
support for scaling. | ||
|
||
For many cases, just putting a view inside a ScrollView will "just work". Still, you may want | ||
to set some settings. | ||
|
||
Bouncing | ||
---------- | ||
By default, ScrollView will _always_ bounce when scrolling vertically, regardless of the | ||
content's height, but only bounce horizontally _if_ the content is wider than the ScrollView. | ||
This is controlled by two properties: | ||
|
||
- alwaysBounceHorizontal, which defaults to NO. | ||
- alwaysBounceVertical, which defaults to YES. | ||
|
||
|
||
Scaling | ||
-------- | ||
ScrollView has support for scaling, which you can use through a few properties: | ||
|
||
- canScale. Specifies whether the content may be scaled. If YES, using two fingers | ||
(in that classic "pinch gesture") will zoom the content. | ||
- minimumScale: The minimum scale value. Default: 0.25. | ||
- maximumScale: The maximum scale value. Default: 2.0. | ||
|
||
|
||
{{demo:sc|touch.js}} |