sproutcore 1.10.3.1 → 1.11.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG +4 -8
- data/VERSION.yml +2 -2
- data/lib/frameworks/sproutcore/Buildfile +5 -4
- data/lib/frameworks/sproutcore/CHANGELOG.md +274 -40
- data/lib/frameworks/sproutcore/CONTRIBUTORS.md +133 -0
- data/lib/frameworks/sproutcore/README.md +31 -144
- data/lib/frameworks/sproutcore/apps/showcase/controllers/source_tree_controller.js +9 -4
- data/lib/frameworks/sproutcore/apps/showcase/resources/stylesheet.css +5 -0
- data/lib/frameworks/sproutcore/apps/showcase/system/views_item_content.js +1 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/split_views.js +15 -2
- data/lib/frameworks/sproutcore/apps/showcase/views/stacked_views.js +1 -1
- data/lib/frameworks/sproutcore/apps/tests/english.lproj/main_page.js +11 -1
- data/lib/frameworks/sproutcore/frameworks/ajax/mixins/websocket_delegate.js +90 -0
- data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +81 -5
- data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +23 -4
- data/lib/frameworks/sproutcore/frameworks/ajax/system/websocket.js +475 -0
- data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/request.js +149 -26
- data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/websocket.js +197 -0
- data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/xhr_response_test.js +65 -0
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/horizontal_stack_layout.js +232 -52
- data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/vertical_stack_layout.js +235 -49
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +23 -13
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/object.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +81 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/english.lproj/ordinal.js +17 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/string.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/{desktop/tests/views/disclosure/methods.js → core_foundation/french.lproj/ordinal.js} +7 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +2 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +104 -69
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane_statechart.js +6 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/child_view_layout_protocol.js +59 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/view_transition_protocol.js +18 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +192 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/bezier_curves.js +52 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/color.js +384 -64
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/core_query.js +6 -14
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/device.js +21 -35
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +72 -36
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +90 -34
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +55 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +20 -15
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/req_anim_frame.js +9 -10
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +763 -542
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +1 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/touch.js +538 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils/rect.js +56 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +99 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/single_case.js +25 -19
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/core_tests.js +75 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/ext/number_test.js +81 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/action_support.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/responder_context.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/string.js +19 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/color.js +36 -20
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/design_modes_test.js +83 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/makeMainPane.js +7 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/mouse_events.js +338 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/root_responder.js +14 -89
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/touch.js +106 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/touch.js +136 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/utils/rect.js +42 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/design_mode_test.js +457 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/sendEvent.js +36 -10
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/background_color.js +44 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/border_frame_test.js +51 -24
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/childViewLayout_test.js +176 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +46 -16
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertFrames.js +69 -15
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/didAppendToDocument.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layout.js +7 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +30 -10
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +376 -71
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/static_layout.js +0 -10
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/viewDidResize.js +117 -34
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view_states_test.js +52 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +656 -42
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +159 -38
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/cursor.js +0 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/design_mode.js +206 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +0 -28
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +21 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +372 -450
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +28 -13
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +22 -51
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/statechart.js +59 -30
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +0 -29
- data/lib/frameworks/sproutcore/frameworks/datastore/mixins/relationship_support.js +22 -10
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +42 -36
- data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +54 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +178 -59
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +206 -132
- data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +214 -118
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +96 -13
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +14 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +82 -42
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +272 -177
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/store_interaction_test.js +54 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/datetime_recordattribute.js +24 -16
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/data_store.js +267 -35
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +57 -46
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +150 -53
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +57 -17
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +13 -9
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/polymorphism → datastore}/tests/models/polymorphism/many.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/polymorphism → datastore}/tests/models/polymorphism/simple.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/polymorphism → datastore}/tests/models/polymorphism/single.js +12 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +20 -15
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +9 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/many_array/core_methods.js +80 -14
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/autonomous_dataSourceCallbacks.js +280 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/autonomous_pushChanges.js +232 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +31 -5
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/parse.js +16 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +60 -40
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/materializeRecord.js +78 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +13 -1
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/tests/system/datetime.js +20 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/{resources → english.lproj}/strings.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/french.lproj/strings.js +45 -0
- data/lib/frameworks/sproutcore/frameworks/designer/designers/object_designer.js +7 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +125 -44
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +139 -48
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/draggable.js +202 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +59 -56
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +13 -49
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +466 -305
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +49 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +79 -21
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/split.js +12 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu_item_view.css +8 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/overlay-scroller.css +187 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +94 -30
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +163 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +97 -78
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +61 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +7 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +47 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/methods.js +66 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +21 -11
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/ui.js +12 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +17 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +9 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/collection_fast_path.js +54 -21
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/content.js +52 -20
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +94 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/keyboard.js +177 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/layerIdFor.js +13 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/length.js +9 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +104 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/ui.js +48 -49
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/grid/drag_and_drop.js +22 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/grid/methods.js +17 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/link_view_test.js +136 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/contentIndexesInRect.js +77 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/drag_and_drop.js +53 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/layoutForContentIndex.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowDelegate.js +25 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowOffsetForContentIndex.js +102 -27
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/{rowHeightForContentIndex.js → rowSizeForContentIndex.js} +7 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_outline.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +70 -75
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_simple.js +29 -30
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list_item.js +57 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_scroll_view/menu_scroll_view_test.js +206 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +15 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +15 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/integration.js +16 -11
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/methods.js +164 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/scale.js +387 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/touch.js +549 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +214 -45
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroller.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +73 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +88 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/methods.js +8 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/slider/methods.js +16 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/slider/ui.js +54 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/dividers.js +21 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/static_content.js +31 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +109 -29
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +10 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +779 -603
- data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +106 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/link_view.js +406 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +437 -245
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +13 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +124 -62
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +176 -597
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroller_view.js +206 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +5 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +56 -158
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll_view.js +2560 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +458 -242
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +117 -54
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +18 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +162 -34
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +30 -15
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +33 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +22 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +47 -22
- data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +0 -6
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form_row.js +21 -21
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu.js +14 -3
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/mixins/select_view_menu.js +24 -10
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/ext/menu_resizing.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/bindings.js +7 -4
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/check_selected.js +7 -9
- data/lib/frameworks/sproutcore/frameworks/{desktop/tests/panes/select_button/methods.js → experimental/frameworks/select_view/tests/views/select/method.js} +54 -76
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/selected_item.js +35 -0
- data/lib/frameworks/sproutcore/frameworks/{desktop/tests/panes/select_button → experimental/frameworks/select_view/tests/views/select}/ui.js +107 -36
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/select.js +225 -66
- data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +39 -38
- data/lib/frameworks/sproutcore/frameworks/foundation/core.js +5 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +12 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/inflections.js +84 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/french.lproj/inflections.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +3 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +408 -239
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +2 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/spanish.lproj/inflections.js +38 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +104 -76
- data/lib/frameworks/sproutcore/frameworks/foundation/system/string.js +20 -94
- data/lib/frameworks/sproutcore/frameworks/foundation/system/text_selection.js +33 -22
- data/lib/frameworks/sproutcore/frameworks/foundation/system/undo_manager.js +475 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/auto_resize_test.js +163 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/flowed_layout/tests.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +2 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/methods.js +268 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/undo_manager.js +231 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +16 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +27 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +24 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +135 -6
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/fade_transition.js +6 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/pop_transition.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/scale_transition.js +6 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/slide_transition.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_dissolve_transition.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/credit_card.js +21 -21
- data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +65 -15
- data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +4 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +193 -213
- data/lib/frameworks/sproutcore/frameworks/jquery/{jquery-1.8.3-patched.js → jquery-1.11.1.js} +7507 -6684
- data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +28 -11
- data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +26 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +54 -25
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +0 -6
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/number.js +36 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/window.js +25 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +156 -66
- data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +150 -65
- data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +57 -11
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +68 -49
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +14 -6
- data/lib/frameworks/sproutcore/frameworks/runtime/system/string.js +23 -23
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/ext/number_test.js +44 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +0 -10
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable.js +340 -285
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +104 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js +14 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/string.js +15 -2
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +21 -18
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +52 -19
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/responder/pane.js +27 -24
- data/lib/frameworks/sproutcore/frameworks/template_view/controls/button.js +30 -0
- data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars/bind.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars/collection.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars/view.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/template_view/tests/mixins/template_helpers/checkbox_support.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/template_view/tests/views/template/handlebars.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/template_view/views/bindable_span.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/template_view/views/template_collection.js +16 -14
- data/lib/frameworks/sproutcore/frameworks/testing/core.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +13 -0
- data/lib/frameworks/sproutcore/lib/index.rhtml +2 -2
- data/lib/frameworks/sproutcore/phantomjs/test_runner.js +28 -7
- data/lib/frameworks/sproutcore/scripts/run_sc_server_master.sh +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/_variables.css +2 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/disclosure/ace/disclosure.css +1 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/popover.css +3 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/scroller/horizontal/horizontal.css +15 -15
- data/lib/frameworks/sproutcore/themes/ace/resources/scroller/horizontal/horizontal_overlay.css +74 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/scroller/vertical/vertical.css +11 -13
- data/lib/frameworks/sproutcore/themes/ace/resources/scroller/vertical/vertical_overlay.css +74 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/knob-active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/knob-active@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/knob.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/knob@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/{22px → jumbo}/slider.css +9 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/track.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/jumbo/track@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/knob-active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/knob-active@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/knob.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/knob@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/slider.css +32 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/track.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/regular/track@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/slider.css +13 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/knob-active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/knob-active@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/knob.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/knob@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/slider.css +32 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/track.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/small/track@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/split/split.css +2 -3
- data/lib/sproutcore/builders/chance_file.rb +3 -3
- data/lib/sproutcore/helpers/minifier.rb +1 -0
- data/vendor/chance/lib/chance/instance.rb +34 -34
- data/vendor/chance/lib/chance/instance/spriting.rb +21 -16
- metadata +81 -58
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/visibility.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +0 -710
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +0 -267
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/touch-scroller.css +0 -196
- data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +0 -224
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +0 -163
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/ui.js +0 -177
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +0 -2053
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_button.js +0 -1024
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +0 -404
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/render_delegates/menu_scroller.js +0 -28
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/tests/menu/scroll.js +0 -235
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroll.js +0 -363
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroller.js +0 -250
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +0 -47
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +0 -134
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/desktop_scroller.js +0 -92
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/native_scroll.js +0 -25
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/scroll.js +0 -33
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/touch_scroller.js +0 -76
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/integration.js +0 -25
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/methods.js +0 -143
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/ui.js +0 -256
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroll.js +0 -1164
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroller.js +0 -332
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroll.js +0 -236
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroller.js +0 -347
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroll.js +0 -15
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/scroller.js +0 -10
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroll.js +0 -804
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroller.js +0 -133
- data/lib/frameworks/sproutcore/frameworks/foundation/tasks/preload_bundle.js +0 -41
- data/lib/frameworks/sproutcore/themes/ace/resources/scroller/horizontal/horizontal_touch.css +0 -91
- data/lib/frameworks/sproutcore/themes/ace/resources/scroller/vertical/vertical_touch.css +0 -92
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/14px/knob.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/14px/knob_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/14px/slider.css +0 -27
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/16px/knob.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/16px/knob_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/16px/slider.css +0 -27
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/22px/knob.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/22px/knob_active.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/22px/track.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/slider/ace/track.png +0 -0
@@ -17,7 +17,7 @@
|
|
17
17
|
You can either create a subclass of ScrollerView with the new values, or
|
18
18
|
provide your own in your theme:
|
19
19
|
|
20
|
-
SC.
|
20
|
+
SC.ScrollerView = SC.ScrollerView.extend({
|
21
21
|
scrollbarThickness: 14,
|
22
22
|
capLength: 18,
|
23
23
|
capOverlap: 14,
|
@@ -26,7 +26,10 @@
|
|
26
26
|
});
|
27
27
|
|
28
28
|
You can change whether scroll buttons are displayed by setting the
|
29
|
-
hasButtons property.
|
29
|
+
`hasButtons` property.
|
30
|
+
|
31
|
+
By default, `SC.ScrollerView` has a persistent gutter. If you would like a
|
32
|
+
gutterless scroller that supports fading, see `SC.OverlayScrollerView`.
|
30
33
|
|
31
34
|
@extends SC.View
|
32
35
|
@since SproutCore 1.0
|
@@ -34,21 +37,21 @@
|
|
34
37
|
SC.ScrollerView = SC.View.extend(
|
35
38
|
/** @scope SC.ScrollerView.prototype */ {
|
36
39
|
|
37
|
-
/**
|
40
|
+
/** @private
|
38
41
|
@type Array
|
39
42
|
@default ['sc-scroller-view']
|
40
43
|
@see SC.View#classNames
|
41
44
|
*/
|
42
45
|
classNames: ['sc-scroller-view'],
|
43
46
|
|
44
|
-
/**
|
47
|
+
/** @private
|
45
48
|
@type Array
|
46
|
-
@default 'thumbPosition thumbLength controlsHidden'
|
49
|
+
@default ['thumbPosition', 'thumbLength', 'controlsHidden']
|
47
50
|
@see SC.View#displayProperties
|
48
51
|
*/
|
49
52
|
displayProperties: ['thumbPosition', 'thumbLength', 'controlsHidden'],
|
50
53
|
|
51
|
-
/**
|
54
|
+
/** @private
|
52
55
|
The WAI-ARIA role for scroller view.
|
53
56
|
|
54
57
|
@type String
|
@@ -73,12 +76,6 @@ SC.ScrollerView = SC.View.extend(
|
|
73
76
|
*/
|
74
77
|
shouldScrollToClick: NO,
|
75
78
|
|
76
|
-
|
77
|
-
/** @private
|
78
|
-
The in-touch-scroll value.
|
79
|
-
*/
|
80
|
-
_touchScrollValue: NO,
|
81
|
-
|
82
79
|
/**
|
83
80
|
The value of the scroller.
|
84
81
|
|
@@ -86,29 +83,21 @@ SC.ScrollerView = SC.View.extend(
|
|
86
83
|
|
87
84
|
@field
|
88
85
|
@type Number
|
89
|
-
@
|
90
|
-
@observes minimum
|
86
|
+
@default null
|
91
87
|
*/
|
92
|
-
value:
|
93
|
-
var minimum = this.get('minimum');
|
94
|
-
if (val !== undefined) {
|
95
|
-
this._scs_value = val;
|
96
|
-
}
|
97
|
-
|
98
|
-
val = this._scs_value || minimum; // default value is at top/left
|
99
|
-
return Math.max(Math.min(val, this.get('maximum')), minimum) ;
|
100
|
-
}.property('maximum', 'minimum').cacheable(),
|
88
|
+
value: null,
|
101
89
|
|
102
90
|
/**
|
91
|
+
The displayed value of the scroller.
|
92
|
+
|
93
|
+
This is the value of the scroller constrained within the minimum and maximum values.
|
94
|
+
|
103
95
|
@type Number
|
104
96
|
@observes value
|
105
97
|
*/
|
106
|
-
displayValue: function() {
|
107
|
-
|
108
|
-
|
109
|
-
else ret = this.get("value");
|
110
|
-
return ret;
|
111
|
-
}.property("value", "_touchScrollValue").cacheable(),
|
98
|
+
displayValue: function () {
|
99
|
+
return Math.max(Math.min(this.get("value"), this.get('maximum')), this.get('minimum'));
|
100
|
+
}.property("value", 'minimum', 'maximum').cacheable(),
|
112
101
|
|
113
102
|
/**
|
114
103
|
The portion of the track that the thumb should fill. Usually the
|
@@ -131,9 +120,9 @@ SC.ScrollerView = SC.View.extend(
|
|
131
120
|
When set less than the height of the scroller, the scroller is disabled.
|
132
121
|
|
133
122
|
@type Number
|
134
|
-
@default
|
123
|
+
@default 0
|
135
124
|
*/
|
136
|
-
maximum:
|
125
|
+
maximum: 0,
|
137
126
|
|
138
127
|
/**
|
139
128
|
The minimum offset value for the scroller. This will be used to calculate
|
@@ -153,7 +142,7 @@ SC.ScrollerView = SC.View.extend(
|
|
153
142
|
@default YES
|
154
143
|
@observes proportion
|
155
144
|
*/
|
156
|
-
isEnabled: function(key, value) {
|
145
|
+
isEnabled: function (key, value) {
|
157
146
|
if (value !== undefined) {
|
158
147
|
this._scsv_isEnabled = value;
|
159
148
|
}
|
@@ -236,9 +225,9 @@ SC.ScrollerView = SC.View.extend(
|
|
236
225
|
the end cap.
|
237
226
|
|
238
227
|
@type Number
|
239
|
-
@default
|
228
|
+
@default 9
|
240
229
|
*/
|
241
|
-
buttonOverlap:
|
230
|
+
buttonOverlap: 9,
|
242
231
|
|
243
232
|
/**
|
244
233
|
The minimium length that the thumb will be, regardless of how much content
|
@@ -264,25 +253,23 @@ SC.ScrollerView = SC.View.extend(
|
|
264
253
|
@param {Boolean} firstTime YES if this is creating a layer
|
265
254
|
@private
|
266
255
|
*/
|
267
|
-
render: function(context, firstTime) {
|
256
|
+
render: function (context, firstTime) {
|
268
257
|
var ariaOrientation = 'vertical',
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
thumbPosition, thumbLength, thumbCenterLength, thumbElement,
|
274
|
-
value, max, scrollerLength, length, pct;
|
258
|
+
classNames = {},
|
259
|
+
parentView = this.get('parentView'),
|
260
|
+
layoutDirection = this.get('layoutDirection'),
|
261
|
+
thumbPosition, thumbLength, thumbElement;
|
275
262
|
|
276
263
|
// We set a class name depending on the layout direction so that we can
|
277
264
|
// style them differently using CSS.
|
278
265
|
switch (layoutDirection) {
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
266
|
+
case SC.LAYOUT_VERTICAL:
|
267
|
+
classNames['sc-vertical'] = YES;
|
268
|
+
break;
|
269
|
+
case SC.LAYOUT_HORIZONTAL:
|
270
|
+
classNames['sc-horizontal'] = YES;
|
271
|
+
ariaOrientation = 'horizontal';
|
272
|
+
break;
|
286
273
|
}
|
287
274
|
|
288
275
|
// The appearance of the scroller changes if disabled
|
@@ -311,8 +298,7 @@ SC.ScrollerView = SC.View.extend(
|
|
311
298
|
context.setAttr('aria-valuemax', this.get('maximum'));
|
312
299
|
context.setAttr('aria-valuemin', this.get('minimum'));
|
313
300
|
context.setAttr('aria-valuenow', this.get('value'));
|
314
|
-
context.setAttr('aria-controls'
|
315
|
-
|
301
|
+
context.setAttr('aria-controls', parentView.getPath('contentView.layerId'));
|
316
302
|
} else {
|
317
303
|
// The HTML has already been generated, so all we have to do is
|
318
304
|
// reposition and resize the thumb
|
@@ -326,14 +312,15 @@ SC.ScrollerView = SC.View.extend(
|
|
326
312
|
|
327
313
|
//addressing accessibility
|
328
314
|
context.setAttr('aria-valuenow', this.get('value'));
|
329
|
-
|
315
|
+
if (this.didChangeFor('render-min', 'minimum')) context.setAttr('aria-valuemin', this.get('minimum'));
|
316
|
+
if (this.didChangeFor('render-max', 'maximum')) context.setAttr('aria-valuemax', this.get('maximum'));
|
330
317
|
}
|
331
318
|
},
|
332
319
|
|
333
|
-
renderThumb: function(context, layoutDirection, thumbLength, thumbPosition) {
|
320
|
+
renderThumb: function (context, layoutDirection, thumbLength, thumbPosition) {
|
334
321
|
var styleString;
|
335
|
-
if(layoutDirection === SC.LAYOUT_HORIZONTAL) styleString = 'width: '+thumbLength+'px; left: ' + thumbPosition + 'px;';
|
336
|
-
else styleString = 'height: '+thumbLength+'px; top: ' + thumbPosition + 'px;';
|
322
|
+
if (layoutDirection === SC.LAYOUT_HORIZONTAL) styleString = 'width: ' + thumbLength + 'px; left: ' + thumbPosition + 'px;';
|
323
|
+
else styleString = 'height: ' + thumbLength + 'px; top: ' + thumbPosition + 'px;';
|
337
324
|
|
338
325
|
context.push('<div class="thumb" style="%@">'.fmt(styleString),
|
339
326
|
'<div class="thumb-center"></div>',
|
@@ -342,7 +329,7 @@ SC.ScrollerView = SC.View.extend(
|
|
342
329
|
|
343
330
|
},
|
344
331
|
|
345
|
-
renderButtons: function(context, hasButtons) {
|
332
|
+
renderButtons: function (context, hasButtons) {
|
346
333
|
if (hasButtons) {
|
347
334
|
context.push('<div class="button-bottom"></div><div class="button-top"></div>');
|
348
335
|
} else {
|
@@ -350,35 +337,6 @@ SC.ScrollerView = SC.View.extend(
|
|
350
337
|
}
|
351
338
|
},
|
352
339
|
|
353
|
-
/** @private */
|
354
|
-
touchScrollDidStart: function(value) {
|
355
|
-
this.set("_touchScrollValue", value);
|
356
|
-
},
|
357
|
-
|
358
|
-
/** @private */
|
359
|
-
touchScrollDidEnd: function(value) {
|
360
|
-
SC.run(function () {
|
361
|
-
this.set("_touchScrollValue", NO);
|
362
|
-
}, this);
|
363
|
-
},
|
364
|
-
|
365
|
-
/* @private Internal property used to track the rate of touch scroll change events. */
|
366
|
-
_lastTouchScrollTime: null,
|
367
|
-
|
368
|
-
/** @private */
|
369
|
-
touchScrollDidChange: function(value) {
|
370
|
-
// Fast path! Don't try to update too soon.
|
371
|
-
if (Date.now() - this._lastTouchScrollTime < 30) { return; }
|
372
|
-
|
373
|
-
// TODO: perform a raw update that doesn't require the run loop.
|
374
|
-
SC.run(function () {
|
375
|
-
this.set("_touchScrollValue", value);
|
376
|
-
}, this);
|
377
|
-
|
378
|
-
// Track the last time we updated.
|
379
|
-
this._lastTouchScrollTime = Date.now();
|
380
|
-
},
|
381
|
-
|
382
340
|
// ..........................................................
|
383
341
|
// THUMB MANAGEMENT
|
384
342
|
//
|
@@ -386,7 +344,7 @@ SC.ScrollerView = SC.View.extend(
|
|
386
344
|
/** @private
|
387
345
|
Adjusts the thumb (for backwards-compatibility calls adjustThumbPosition+adjustThumbSize by default)
|
388
346
|
*/
|
389
|
-
adjustThumb: function(thumb, position, length) {
|
347
|
+
adjustThumb: function (thumb, position, length) {
|
390
348
|
this.adjustThumbPosition(thumb, position);
|
391
349
|
this.adjustThumbSize(thumb, length);
|
392
350
|
},
|
@@ -396,34 +354,104 @@ SC.ScrollerView = SC.View.extend(
|
|
396
354
|
|
397
355
|
@param {Number} position the position of the thumb in pixels
|
398
356
|
*/
|
399
|
-
adjustThumbPosition: function(thumb,
|
400
|
-
|
401
|
-
|
357
|
+
adjustThumbPosition: function (thumb, thumbPosition) {
|
358
|
+
var transformAttribute = SC.browser.experimentalCSSNameFor('transform'),
|
359
|
+
thumbEl = thumb[0];
|
360
|
+
|
361
|
+
// Don't touch the DOM if the position hasn't changed.
|
362
|
+
if (this._thumbPosition !== thumbPosition) {
|
363
|
+
// Consider that the parent view may be animating its final position, then we need to also animate
|
364
|
+
// our final position.
|
365
|
+
var parentView = this.get('parentView'),
|
366
|
+
parentIsAnimating = parentView._sc_isAnimating;
|
367
|
+
|
368
|
+
if (SC.platform.supportsCSSTransitions) {
|
369
|
+
var transitionStyle = SC.browser.experimentalStyleNameFor('transition');
|
370
|
+
|
371
|
+
if (parentIsAnimating) {
|
372
|
+
var duration = parentView._sc_animationDuration,
|
373
|
+
timing = parentView._sc_animationTiming.toString();
|
374
|
+
|
375
|
+
// Will use translation transform to position thumb.
|
376
|
+
if (SC.platform.supportsCSSTransforms) {
|
377
|
+
thumbEl.style[transitionStyle] = transformAttribute + ' ' + duration + 's ' + timing;
|
378
|
+
|
379
|
+
// Will use top/left style to position thumb.
|
380
|
+
} else {
|
381
|
+
switch (this.get('layoutDirection')) {
|
382
|
+
case SC.LAYOUT_VERTICAL:
|
383
|
+
thumbEl.style[transitionStyle] = 'top ' + duration + 's ' + timing;
|
384
|
+
break;
|
385
|
+
case SC.LAYOUT_HORIZONTAL:
|
386
|
+
thumbEl.style[transitionStyle] = 'left ' + duration + 's ' + timing;
|
387
|
+
break;
|
388
|
+
}
|
389
|
+
}
|
390
|
+
|
391
|
+
// No duration, clear any previous transition.
|
392
|
+
} else {
|
393
|
+
thumbEl.style[transitionStyle] = '';
|
394
|
+
}
|
395
|
+
}
|
402
396
|
|
403
|
-
|
397
|
+
|
398
|
+
// Position the thumb.
|
399
|
+
var transformStyle;
|
400
|
+
switch (this.get('layoutDirection')) {
|
404
401
|
case SC.LAYOUT_VERTICAL:
|
405
|
-
|
402
|
+
|
403
|
+
// Use translation transform to position thumb.
|
404
|
+
if (SC.platform.supportsCSSTransforms) {
|
405
|
+
transformStyle = 'translateX(0px) translateY(' + thumbPosition + 'px)';
|
406
|
+
|
407
|
+
// TODO: Is this a necessary check?
|
408
|
+
if (SC.platform.supportsCSS3DTransforms) { transformStyle += ' translateZ(0px)'; }
|
409
|
+
|
410
|
+
thumbEl.style[transformAttribute] = transformStyle;
|
411
|
+
|
412
|
+
// Use top style to position thumb.
|
413
|
+
} else {
|
414
|
+
thumbEl.style.top = thumbPosition;
|
415
|
+
}
|
416
|
+
|
406
417
|
break;
|
418
|
+
|
407
419
|
case SC.LAYOUT_HORIZONTAL:
|
408
|
-
thumb.
|
420
|
+
// Use translation transform to position thumb.
|
421
|
+
if (SC.platform.supportsCSSTransforms) {
|
422
|
+
|
423
|
+
transformStyle = 'translateX(' + thumbPosition + 'px) translateY(0px)';
|
424
|
+
|
425
|
+
// TODO: Is this a necessary check?
|
426
|
+
if (SC.platform.supportsCSS3DTransforms) { transformStyle += ' translateZ(0px)'; }
|
427
|
+
|
428
|
+
thumbEl.style[transformAttribute] = transformStyle;
|
429
|
+
|
430
|
+
// Use left style to position thumb.
|
431
|
+
} else {
|
432
|
+
thumbEl.style.left = thumbPosition;
|
433
|
+
}
|
434
|
+
|
409
435
|
break;
|
436
|
+
}
|
410
437
|
}
|
411
438
|
|
412
|
-
|
439
|
+
// Cache these values to check for changes.
|
440
|
+
this._thumbPosition = thumbPosition;
|
413
441
|
},
|
414
442
|
|
415
443
|
/** @private */
|
416
|
-
adjustThumbSize: function(thumb, size) {
|
444
|
+
adjustThumbSize: function (thumb, size) {
|
417
445
|
// Don't touch the DOM if the size hasn't changed
|
418
446
|
if (this._thumbSize === size) return;
|
419
447
|
|
420
448
|
switch (this.get('layoutDirection')) {
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
449
|
+
case SC.LAYOUT_VERTICAL:
|
450
|
+
thumb.css('height', Math.max(size, this.get('minimumThumbLength')));
|
451
|
+
break;
|
452
|
+
case SC.LAYOUT_HORIZONTAL:
|
453
|
+
thumb.css('width', Math.max(size, this.get('minimumThumbLength')));
|
454
|
+
break;
|
427
455
|
}
|
428
456
|
|
429
457
|
this._thumbSize = size;
|
@@ -442,11 +470,12 @@ SC.ScrollerView = SC.View.extend(
|
|
442
470
|
|
443
471
|
@property
|
444
472
|
*/
|
445
|
-
trackLength: function() {
|
473
|
+
trackLength: function () {
|
446
474
|
var scrollerLength = this.get('scrollerLength');
|
447
475
|
|
448
476
|
// Subtract the size of the top/left cap
|
449
|
-
scrollerLength -= this.capLength - this.capOverlap;
|
477
|
+
scrollerLength -= this.get('capLength') - this.get('capOverlap');
|
478
|
+
|
450
479
|
// Subtract the size of the scroll buttons, or the end cap if they are
|
451
480
|
// not shown.
|
452
481
|
scrollerLength -= this.buttonLength - this.buttonOverlap;
|
@@ -461,12 +490,12 @@ SC.ScrollerView = SC.View.extend(
|
|
461
490
|
|
462
491
|
@type Number
|
463
492
|
*/
|
464
|
-
scrollerLength: function() {
|
493
|
+
scrollerLength: function () {
|
465
494
|
switch (this.get('layoutDirection')) {
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
495
|
+
case SC.LAYOUT_VERTICAL:
|
496
|
+
return this.get('frame').height;
|
497
|
+
case SC.LAYOUT_HORIZONTAL:
|
498
|
+
return this.get('frame').width;
|
470
499
|
}
|
471
500
|
|
472
501
|
return 0;
|
@@ -478,14 +507,26 @@ SC.ScrollerView = SC.View.extend(
|
|
478
507
|
|
479
508
|
@property
|
480
509
|
*/
|
481
|
-
thumbLength: function() {
|
482
|
-
var
|
510
|
+
thumbLength: function () {
|
511
|
+
var value = this.get('value'),
|
512
|
+
maximum = this.get('maximum'),
|
513
|
+
minimum = this.get('minimum'),
|
514
|
+
proportion = this.get('proportion'),
|
515
|
+
length;
|
516
|
+
|
517
|
+
// If the value is beyond the minimum or maximums, shrink our thumb length to represent the amount
|
518
|
+
// of over scroll. Do this proportionally for the best effect!
|
519
|
+
if (value < minimum) {
|
520
|
+
proportion -= (minimum - value) / maximum;
|
521
|
+
} else if (value > maximum) {
|
522
|
+
proportion -= (value - maximum) / maximum;
|
523
|
+
}
|
483
524
|
|
484
|
-
length = Math.floor(this.get('trackLength') *
|
525
|
+
length = Math.floor(this.get('trackLength') * proportion);
|
485
526
|
length = isNaN(length) ? 0 : length;
|
486
527
|
|
487
528
|
return Math.max(length, this.get('minimumThumbLength'));
|
488
|
-
}.property('trackLength', 'proportion').cacheable(),
|
529
|
+
}.property('value', 'minimum', 'maximum', 'trackLength', 'proportion').cacheable(),
|
489
530
|
|
490
531
|
/** @private
|
491
532
|
The position of the thumb in the track.
|
@@ -493,15 +534,15 @@ SC.ScrollerView = SC.View.extend(
|
|
493
534
|
@type Number
|
494
535
|
@isReadOnly
|
495
536
|
*/
|
496
|
-
thumbPosition: function() {
|
497
|
-
var
|
498
|
-
|
537
|
+
thumbPosition: function () {
|
538
|
+
var displayValue = this.get('displayValue'),
|
539
|
+
maximum = this.get('maximum'),
|
499
540
|
trackLength = this.get('trackLength'),
|
500
541
|
thumbLength = this.get('thumbLength'),
|
501
542
|
capLength = this.get('capLength'),
|
502
543
|
capOverlap = this.get('capOverlap'), position;
|
503
544
|
|
504
|
-
position = (
|
545
|
+
position = (displayValue / maximum) * (trackLength - thumbLength);
|
505
546
|
position += capLength - capOverlap; // account for the top/left cap
|
506
547
|
|
507
548
|
return Math.floor(isNaN(position) ? 0 : position);
|
@@ -514,10 +555,29 @@ SC.ScrollerView = SC.View.extend(
|
|
514
555
|
@type Boolean
|
515
556
|
@isReadOnly
|
516
557
|
*/
|
517
|
-
controlsHidden: function() {
|
558
|
+
controlsHidden: function () {
|
518
559
|
return this.get('proportion') >= 1;
|
519
560
|
}.property('proportion').cacheable(),
|
520
561
|
|
562
|
+
// ..........................................................
|
563
|
+
// FADE SUPPORT
|
564
|
+
// Controls how the scroller fades in and out. Override these methods to implement
|
565
|
+
// different fading.
|
566
|
+
//
|
567
|
+
|
568
|
+
/*
|
569
|
+
Implement to support ScrollView's overlay fade procedure.
|
570
|
+
|
571
|
+
@param {Number} duration
|
572
|
+
*/
|
573
|
+
fadeIn: null,
|
574
|
+
|
575
|
+
/*
|
576
|
+
Implement to support ScrollView's overlay fade procedure.
|
577
|
+
|
578
|
+
@param {Number} duration
|
579
|
+
*/
|
580
|
+
fadeOut: null,
|
521
581
|
|
522
582
|
// ..........................................................
|
523
583
|
// MOUSE EVENTS
|
@@ -526,7 +586,7 @@ SC.ScrollerView = SC.View.extend(
|
|
526
586
|
/** @private
|
527
587
|
Returns the value for a position within the scroller's frame.
|
528
588
|
*/
|
529
|
-
valueForPosition: function(pos) {
|
589
|
+
valueForPosition: function (pos) {
|
530
590
|
var max = this.get('maximum'),
|
531
591
|
trackLength = this.get('trackLength'),
|
532
592
|
thumbLength = this.get('thumbLength'),
|
@@ -559,7 +619,10 @@ SC.ScrollerView = SC.View.extend(
|
|
559
619
|
|
560
620
|
@param evt {SC.Event} the mousedown event
|
561
621
|
*/
|
562
|
-
mouseDown: function(evt) {
|
622
|
+
mouseDown: function (evt) {
|
623
|
+
// Fast path, reject secondary clicks.
|
624
|
+
if (evt.which !== 1) return false;
|
625
|
+
|
563
626
|
if (!this.get('isEnabledInPane')) return NO;
|
564
627
|
|
565
628
|
// keep note of altIsDown for later.
|
@@ -568,7 +631,7 @@ SC.ScrollerView = SC.View.extend(
|
|
568
631
|
|
569
632
|
var target = evt.target,
|
570
633
|
thumbPosition = this.get('thumbPosition'),
|
571
|
-
|
634
|
+
clickLocation,
|
572
635
|
scrollerLength = this.get('scrollerLength');
|
573
636
|
|
574
637
|
// Determine the subcontrol that was clicked
|
@@ -607,36 +670,35 @@ SC.ScrollerView = SC.View.extend(
|
|
607
670
|
var scrollToClick = this.get("shouldScrollToClick");
|
608
671
|
if (evt.altKey) scrollToClick = !scrollToClick;
|
609
672
|
|
610
|
-
var
|
611
|
-
thumbLength = this.get('thumbLength'),
|
673
|
+
var thumbLength = this.get('thumbLength'),
|
612
674
|
frame = this.convertFrameFromView({ x: evt.pageX, y: evt.pageY }),
|
613
675
|
mousePosition;
|
614
676
|
|
615
677
|
switch (this.get('layoutDirection')) {
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
678
|
+
case SC.LAYOUT_VERTICAL:
|
679
|
+
this._mouseDownLocation = mousePosition = frame.y;
|
680
|
+
break;
|
681
|
+
case SC.LAYOUT_HORIZONTAL:
|
682
|
+
this._mouseDownLocation = mousePosition = frame.x;
|
683
|
+
break;
|
622
684
|
}
|
623
685
|
|
624
686
|
if (scrollToClick) {
|
625
|
-
this.set('value', this.valueForPosition(mousePosition - (thumbLength / 2)));
|
687
|
+
this.set('value', Math.min(this.get('maximum'), Math.max(this.get('minimum'), this.valueForPosition(mousePosition - (thumbLength / 2)))));
|
626
688
|
|
627
689
|
// and start a normal mouse down
|
628
690
|
thumbPosition = this.get('thumbPosition');
|
629
691
|
|
630
692
|
this._thumbDragging = YES;
|
631
|
-
this._thumbOffset = {x: frame.x - thumbPosition, y: frame.y - thumbPosition };
|
632
|
-
this._mouseDownLocation = {x:evt.pageX, y:evt.pageY};
|
693
|
+
this._thumbOffset = { x: frame.x - thumbPosition, y: frame.y - thumbPosition };
|
694
|
+
this._mouseDownLocation = { x: evt.pageX, y: evt.pageY };
|
633
695
|
this._thumbPositionAtDragStart = thumbPosition;
|
634
696
|
this._valueAtDragStart = this.get("value");
|
635
697
|
} else {
|
636
698
|
// Move the thumb up or down a page depending on whether the click
|
637
699
|
// was above or below the thumb
|
638
700
|
if (mousePosition < thumbPosition) {
|
639
|
-
this.decrementProperty('value',scrollerLength);
|
701
|
+
this.decrementProperty('value', scrollerLength);
|
640
702
|
this.startMouseDownTimer('page');
|
641
703
|
} else {
|
642
704
|
this.incrementProperty('value', scrollerLength);
|
@@ -656,7 +718,7 @@ SC.ScrollerView = SC.View.extend(
|
|
656
718
|
|
657
719
|
@param evt {SC.Event} the mousedown event
|
658
720
|
*/
|
659
|
-
mouseUp: function(evt) {
|
721
|
+
mouseUp: function (evt) {
|
660
722
|
var active = this._scs_buttonActive, ret = NO, timer;
|
661
723
|
|
662
724
|
// If we have an element that was set as active in mouseDown,
|
@@ -690,33 +752,31 @@ SC.ScrollerView = SC.View.extend(
|
|
690
752
|
|
691
753
|
@param evt {SC.Event} the mousedragged event
|
692
754
|
*/
|
693
|
-
mouseDragged: function(evt) {
|
755
|
+
mouseDragged: function (evt) {
|
694
756
|
if (!this.get('isEnabledInPane')) return NO;
|
695
757
|
|
696
|
-
var
|
697
|
-
target = evt.target,
|
758
|
+
var length, delta, thumbPosition,
|
698
759
|
thumbPositionAtDragStart = this._thumbPositionAtDragStart,
|
699
760
|
isScrollingUp = this._isScrollingUp,
|
700
761
|
isScrollingDown = this._isScrollingDown,
|
701
|
-
active = this._scs_buttonActive
|
702
|
-
timer;
|
762
|
+
active = this._scs_buttonActive;
|
703
763
|
|
704
764
|
// Only move the thumb if the user clicked on the thumb during mouseDown
|
705
765
|
if (this._thumbDragging) {
|
706
766
|
|
707
767
|
switch (this.get('layoutDirection')) {
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
768
|
+
case SC.LAYOUT_VERTICAL:
|
769
|
+
delta = (evt.pageY - this._mouseDownLocation.y);
|
770
|
+
break;
|
771
|
+
case SC.LAYOUT_HORIZONTAL:
|
772
|
+
delta = (evt.pageX - this._mouseDownLocation.x);
|
773
|
+
break;
|
714
774
|
}
|
715
775
|
|
716
776
|
// if we are in alt now, but were not before, update the old thumb position to the new one
|
717
777
|
if (evt.altKey) {
|
718
778
|
if (!this._altIsDown || (this._shiftIsDown !== evt.shiftKey)) {
|
719
|
-
thumbPositionAtDragStart = this._thumbPositionAtDragStart = thumbPositionAtDragStart+delta;
|
779
|
+
thumbPositionAtDragStart = this._thumbPositionAtDragStart = thumbPositionAtDragStart + delta;
|
720
780
|
delta = 0;
|
721
781
|
this._mouseDownLocation = { x: evt.pageX, y: evt.pageY };
|
722
782
|
this._valueAtDragStart = this.get("value");
|
@@ -726,31 +786,30 @@ SC.ScrollerView = SC.View.extend(
|
|
726
786
|
// Too bad.
|
727
787
|
if (evt.shiftKey) delta = -delta;
|
728
788
|
|
729
|
-
this.set('value', Math.round(this._valueAtDragStart + delta * 2));
|
789
|
+
this.set('value', Math.min(this.get('maximum'), Math.max(this.get('minimum'), Math.round(this._valueAtDragStart + delta * 2))));
|
730
790
|
} else {
|
731
791
|
thumbPosition = thumbPositionAtDragStart + delta;
|
732
792
|
length = this.get('trackLength') - this.get('thumbLength');
|
733
|
-
this.set('value', Math.
|
793
|
+
this.set('value', Math.min(this.get('maximum'), Math.max(this.get('minimum'), Math.round((thumbPosition / length) * this.get('maximum')))));
|
734
794
|
}
|
735
795
|
|
736
796
|
} else if (isScrollingUp || isScrollingDown) {
|
737
797
|
var nowScrollingUp = NO, nowScrollingDown = NO;
|
738
798
|
|
739
799
|
var topButtonRect = this.$('.button-top')[0].getBoundingClientRect();
|
740
|
-
var bottomButtonRect = this.$('.button-bottom')[0].getBoundingClientRect();
|
741
800
|
|
742
801
|
switch (this.get('layoutDirection')) {
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
802
|
+
case SC.LAYOUT_VERTICAL:
|
803
|
+
if (evt.clientY < topButtonRect.bottom) nowScrollingUp = YES;
|
804
|
+
else nowScrollingDown = YES;
|
805
|
+
break;
|
806
|
+
case SC.LAYOUT_HORIZONTAL:
|
807
|
+
if (evt.clientX < topButtonRect.right) nowScrollingUp = YES;
|
808
|
+
else nowScrollingDown = YES;
|
809
|
+
break;
|
751
810
|
}
|
752
811
|
|
753
|
-
if ((nowScrollingUp || nowScrollingDown) && nowScrollingUp !== isScrollingUp){
|
812
|
+
if ((nowScrollingUp || nowScrollingDown) && nowScrollingUp !== isScrollingUp) {
|
754
813
|
//
|
755
814
|
// STOP OLD
|
756
815
|
//
|
@@ -758,7 +817,7 @@ SC.ScrollerView = SC.View.extend(
|
|
758
817
|
// If we have an element that was set as active in mouseDown,
|
759
818
|
// remove its active state
|
760
819
|
if (active) {
|
761
|
-
|
820
|
+
active.removeClass('active');
|
762
821
|
}
|
763
822
|
|
764
823
|
// Stop firing repeating events after mouseup
|
@@ -770,8 +829,8 @@ SC.ScrollerView = SC.View.extend(
|
|
770
829
|
this.makeButtonActive('.button-bottom');
|
771
830
|
}
|
772
831
|
|
773
|
-
|
774
|
-
|
832
|
+
this._isScrollingUp = nowScrollingUp;
|
833
|
+
this._isScrollingDown = nowScrollingDown;
|
775
834
|
}
|
776
835
|
}
|
777
836
|
|
@@ -789,12 +848,12 @@ SC.ScrollerView = SC.View.extend(
|
|
789
848
|
|
790
849
|
Specify "immediate" as YES if it should not wait.
|
791
850
|
*/
|
792
|
-
startMouseDownTimer: function(action, immediate) {
|
793
|
-
var timer;
|
794
|
-
|
851
|
+
startMouseDownTimer: function (action, immediate) {
|
795
852
|
this._mouseDownTimerAction = action;
|
796
853
|
this._mouseDownTimer = SC.Timer.schedule({
|
797
|
-
target: this,
|
854
|
+
target: this,
|
855
|
+
action: this.mouseDownTimerDidFire,
|
856
|
+
interval: immediate ? 0 : 300
|
798
857
|
});
|
799
858
|
},
|
800
859
|
|
@@ -802,7 +861,7 @@ SC.ScrollerView = SC.View.extend(
|
|
802
861
|
Called by the mousedown timer. This method determines the initial
|
803
862
|
user action and repeats it until the timer is invalidated in mouseUp.
|
804
863
|
*/
|
805
|
-
mouseDownTimerDidFire: function() {
|
864
|
+
mouseDownTimerDidFire: function () {
|
806
865
|
var scrollerLength = this.get('scrollerLength'),
|
807
866
|
mouseLocation = SC.device.get('mouseLocation'),
|
808
867
|
thumbPosition = this.get('thumbPosition'),
|
@@ -810,32 +869,34 @@ SC.ScrollerView = SC.View.extend(
|
|
810
869
|
timerInterval = 50;
|
811
870
|
|
812
871
|
switch (this.get('layoutDirection')) {
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
872
|
+
case SC.LAYOUT_VERTICAL:
|
873
|
+
mouseLocation = this.convertFrameFromView(mouseLocation).y;
|
874
|
+
break;
|
875
|
+
case SC.LAYOUT_HORIZONTAL:
|
876
|
+
mouseLocation = this.convertFrameFromView(mouseLocation).x;
|
877
|
+
break;
|
819
878
|
}
|
820
879
|
|
821
880
|
switch (this._mouseDownTimerAction) {
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
881
|
+
case 'scrollDown':
|
882
|
+
this.incrementProperty('value', this._altIsDown ? scrollerLength : 30);
|
883
|
+
break;
|
884
|
+
case 'scrollUp':
|
885
|
+
this.decrementProperty('value', this._altIsDown ? scrollerLength : 30);
|
886
|
+
break;
|
887
|
+
case 'page':
|
888
|
+
timerInterval = 150;
|
889
|
+
if (mouseLocation < thumbPosition) {
|
890
|
+
this.decrementProperty('value', scrollerLength);
|
891
|
+
} else if (mouseLocation > thumbPosition + thumbLength) {
|
892
|
+
this.incrementProperty('value', scrollerLength);
|
893
|
+
}
|
835
894
|
}
|
836
895
|
|
837
896
|
this._mouseDownTimer = SC.Timer.schedule({
|
838
|
-
target: this,
|
897
|
+
target: this,
|
898
|
+
action: this.mouseDownTimerDidFire,
|
899
|
+
interval: timerInterval
|
839
900
|
});
|
840
901
|
},
|
841
902
|
|
@@ -846,26 +907,50 @@ SC.ScrollerView = SC.View.extend(
|
|
846
907
|
|
847
908
|
@param {String} the selector to find
|
848
909
|
*/
|
849
|
-
makeButtonActive: function(selector) {
|
910
|
+
makeButtonActive: function (selector) {
|
850
911
|
this._scs_buttonActive = this.$(selector).addClass('active');
|
851
912
|
}
|
852
913
|
});
|
853
914
|
|
854
|
-
// TODO: Use render delegates to handle rendering.
|
855
|
-
|
856
915
|
/**
|
916
|
+
A fading, transparent-backed scroll bar. Suitable for use as an overlaid scroller. (Note
|
917
|
+
that to achieve the overlay effect, you must still set `verticalOverlay` and
|
918
|
+
`horizontalOverlay` on your `ScrollView`.)
|
919
|
+
|
857
920
|
@class
|
858
921
|
@extends SC.ScrollerView
|
859
922
|
*/
|
860
|
-
SC.
|
861
|
-
/** @scope SC.
|
923
|
+
SC.OverlayScrollerView = SC.ScrollerView.extend(
|
924
|
+
/** @scope SC.OverlayScrollerView.prototype */{
|
925
|
+
|
926
|
+
// ..........................................................
|
927
|
+
// FADE SUPPORT
|
928
|
+
// Controls how the scroller fades in and out. Override these methods to implement
|
929
|
+
// different fading.
|
930
|
+
//
|
931
|
+
|
932
|
+
/*
|
933
|
+
Supports ScrollView's overlay fade procedure.
|
934
|
+
*/
|
935
|
+
fadeIn: function () {
|
936
|
+
this.$().toggleClass('fade-in', true);
|
937
|
+
this.$().toggleClass('fade-out', false);
|
938
|
+
},
|
939
|
+
|
940
|
+
/*
|
941
|
+
Supports ScrollView's overlay fade procedure.
|
942
|
+
*/
|
943
|
+
fadeOut: function () {
|
944
|
+
this.$().toggleClass('fade-in', false);
|
945
|
+
this.$().toggleClass('fade-out', true);
|
946
|
+
},
|
862
947
|
|
863
948
|
/**
|
864
949
|
@type Array
|
865
|
-
@default ['sc-touch-scroller-view']
|
950
|
+
@default ['sc-touch-scroller-view', 'sc-overlay-scroller-view]
|
866
951
|
@see SC.View#classNames
|
867
952
|
*/
|
868
|
-
classNames: ['sc-touch-scroller-view'],
|
953
|
+
classNames: ['sc-touch-scroller-view', 'sc-overlay-scroller-view'],
|
869
954
|
|
870
955
|
/**
|
871
956
|
@type Number
|
@@ -875,9 +960,9 @@ SC.TouchScrollerView = SC.ScrollerView.extend(
|
|
875
960
|
|
876
961
|
/**
|
877
962
|
@type Number
|
878
|
-
@default
|
963
|
+
@default 3
|
879
964
|
*/
|
880
|
-
capLength:
|
965
|
+
capLength: 3,
|
881
966
|
|
882
967
|
/**
|
883
968
|
@type Number
|
@@ -886,66 +971,172 @@ SC.TouchScrollerView = SC.ScrollerView.extend(
|
|
886
971
|
capOverlap: 0,
|
887
972
|
|
888
973
|
/**
|
889
|
-
@type
|
890
|
-
@default
|
974
|
+
@type Number
|
975
|
+
@default 3
|
891
976
|
*/
|
892
|
-
|
977
|
+
buttonLength: 3,
|
893
978
|
|
894
979
|
/**
|
895
980
|
@type Number
|
896
|
-
@default
|
981
|
+
@default 0
|
897
982
|
*/
|
898
|
-
buttonOverlap:
|
983
|
+
buttonOverlap: 0,
|
984
|
+
|
985
|
+
/**
|
986
|
+
@type Boolean
|
987
|
+
@default NO
|
988
|
+
*/
|
989
|
+
hasButtons: NO,
|
899
990
|
|
900
991
|
/** @private */
|
901
|
-
adjustThumb: function(thumb,
|
902
|
-
var
|
903
|
-
|
992
|
+
adjustThumb: function (thumb, thumbPosition, thumbLength) {
|
993
|
+
var transformAttribute = SC.browser.experimentalCSSNameFor('transform'),
|
994
|
+
thumbEl = thumb[0],
|
995
|
+
thumbInner = this.$('.thumb-inner'),
|
996
|
+
thumbInnerEl = thumbInner[0];
|
997
|
+
|
998
|
+
// Don't touch the DOM if the position hasn't changed.
|
999
|
+
if (this._thumbPosition !== thumbPosition) {
|
1000
|
+
// Consider that the parent view may be animating its final position, then we need to also animate
|
1001
|
+
// our final position.
|
1002
|
+
var parentView = this.get('parentView'),
|
1003
|
+
parentIsAnimating = parentView._sc_isAnimating;
|
1004
|
+
|
1005
|
+
if (SC.platform.supportsCSSTransitions) {
|
1006
|
+
var transitionStyle = SC.browser.experimentalStyleNameFor('transition');
|
1007
|
+
|
1008
|
+
if (parentIsAnimating) {
|
1009
|
+
var duration = parentView._sc_animationDuration,
|
1010
|
+
timing = parentView._sc_animationTiming.toString();
|
1011
|
+
|
1012
|
+
// Will use translation transform to position thumb.
|
1013
|
+
if (SC.platform.supportsCSSTransforms) {
|
1014
|
+
thumbEl.style[transitionStyle] = transformAttribute + ' ' + duration + 's ' + timing;
|
1015
|
+
|
1016
|
+
if (this._thumbSize !== thumbLength) {
|
1017
|
+
thumbInnerEl.style[transitionStyle] = transformAttribute + ' ' + duration + 's ' + timing;
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
// Will use top/left style to position thumb.
|
1021
|
+
} else {
|
1022
|
+
switch (this.get('layoutDirection')) {
|
1023
|
+
case SC.LAYOUT_VERTICAL:
|
1024
|
+
thumbEl.style[transitionStyle] = 'top ' + duration + 's ' + timing;
|
1025
|
+
|
1026
|
+
if (this._thumbSize !== thumbLength) {
|
1027
|
+
thumbInnerEl.style[transitionStyle] = 'top ' + duration + 's ' + timing;
|
1028
|
+
}
|
1029
|
+
|
1030
|
+
break;
|
1031
|
+
case SC.LAYOUT_HORIZONTAL:
|
1032
|
+
thumbEl.style[transitionStyle] = 'left ' + duration + 's ' + timing;
|
1033
|
+
|
1034
|
+
if (this._thumbSize !== thumbLength) {
|
1035
|
+
thumbInnerEl.style[transitionStyle] = 'left ' + duration + 's ' + timing;
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
break;
|
1039
|
+
}
|
1040
|
+
}
|
1041
|
+
|
1042
|
+
// No duration, clear any previous transition.
|
1043
|
+
} else {
|
1044
|
+
thumbEl.style[transitionStyle] = '';
|
1045
|
+
thumbInnerEl.style[transitionStyle] = '';
|
1046
|
+
}
|
1047
|
+
}
|
904
1048
|
|
905
|
-
if (position + length > max) {
|
906
|
-
position = Math.min(max - 20, position);
|
907
|
-
length = max - position;
|
908
|
-
}
|
909
1049
|
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
}
|
914
|
-
|
915
|
-
switch (this.get('layoutDirection')) {
|
1050
|
+
// Position the thumb.
|
1051
|
+
var transformStyle;
|
1052
|
+
switch (this.get('layoutDirection')) {
|
916
1053
|
case SC.LAYOUT_VERTICAL:
|
917
|
-
|
918
|
-
|
919
|
-
|
1054
|
+
|
1055
|
+
// Use translation transform to position thumb.
|
1056
|
+
if (SC.platform.supportsCSSTransforms) {
|
1057
|
+
transformStyle = 'translateX(0px) translateY(' + thumbPosition + 'px)';
|
1058
|
+
|
1059
|
+
// TODO: Is this a necessary check?
|
1060
|
+
if (SC.platform.supportsCSS3DTransforms) { transformStyle += ' translateZ(0px)'; }
|
1061
|
+
|
1062
|
+
thumbEl.style[transformAttribute] = transformStyle;
|
1063
|
+
// thumb.css(transformCSS, 'translate3d(0px,' + thumbPosition + 'px,0px)');
|
1064
|
+
|
1065
|
+
if (this._thumbSize !== thumbLength) {
|
1066
|
+
transformStyle = 'translateX(0px) translateY(' + Math.round(thumbLength - 1044) + 'px)';
|
1067
|
+
|
1068
|
+
// TODO: Is this a necessary check?
|
1069
|
+
if (SC.platform.supportsCSS3DTransforms) { transformStyle += ' translateZ(0px)'; }
|
1070
|
+
|
1071
|
+
// thumbInner.css(transformCSS, 'translate3d(0px,' + Math.round(thumbLength - 1044) + 'px,0px)');
|
1072
|
+
thumbInnerEl.style[transformAttribute] = transformStyle;
|
1073
|
+
}
|
1074
|
+
|
1075
|
+
// Use top style to position thumb.
|
1076
|
+
} else {
|
1077
|
+
thumbEl.style.top = thumbPosition;
|
1078
|
+
|
1079
|
+
if (this._thumbSize !== thumbLength) {
|
1080
|
+
thumbInnerEl.style.top = Math.round(thumbLength - 1044);
|
1081
|
+
}
|
920
1082
|
}
|
1083
|
+
|
921
1084
|
break;
|
1085
|
+
|
922
1086
|
case SC.LAYOUT_HORIZONTAL:
|
923
|
-
|
924
|
-
if (
|
925
|
-
|
1087
|
+
// Use translation transform to position thumb.
|
1088
|
+
if (SC.platform.supportsCSSTransforms) {
|
1089
|
+
|
1090
|
+
transformStyle = 'translateX(' + thumbPosition + 'px) translateY(0px)';
|
1091
|
+
|
1092
|
+
// TODO: Is this a necessary check?
|
1093
|
+
if (SC.platform.supportsCSS3DTransforms) { transformStyle += ' translateZ(0px)'; }
|
1094
|
+
|
1095
|
+
thumbEl.style[transformAttribute] = transformStyle;
|
1096
|
+
// thumb.css(transformCSS, 'translate3d(0px,' + thumbPosition + 'px,0px)');
|
1097
|
+
|
1098
|
+
if (this._thumbSize !== thumbLength) {
|
1099
|
+
transformStyle = 'translateX(' + Math.round(thumbLength - 1044) + 'px) translateY(0px)';
|
1100
|
+
|
1101
|
+
// TODO: Is this a necessary check?
|
1102
|
+
if (SC.platform.supportsCSS3DTransforms) { transformStyle += ' translateZ(0px)'; }
|
1103
|
+
|
1104
|
+
// thumbInner.css(transformCSS, 'translate3d(0px,' + Math.round(thumbLength - 1044) + 'px,0px)');
|
1105
|
+
thumbInnerEl.style[transformAttribute] = transformStyle;
|
1106
|
+
}
|
1107
|
+
|
1108
|
+
// Use left style to position thumb.
|
1109
|
+
} else {
|
1110
|
+
thumbEl.style.left = thumbPosition;
|
1111
|
+
|
1112
|
+
if (this._thumbSize !== thumbLength) {
|
1113
|
+
thumbInnerEl.style.left = Math.round(thumbLength - 1044);
|
1114
|
+
}
|
926
1115
|
}
|
1116
|
+
|
927
1117
|
break;
|
1118
|
+
}
|
928
1119
|
}
|
929
1120
|
|
930
|
-
|
931
|
-
this.
|
1121
|
+
// Cache these values to check for changes.
|
1122
|
+
this._thumbPosition = thumbPosition;
|
1123
|
+
this._thumbSize = thumbLength;
|
932
1124
|
},
|
933
1125
|
|
934
1126
|
/** @private */
|
935
|
-
render: function(context, firstTime) {
|
1127
|
+
render: function (context, firstTime) {
|
936
1128
|
var classNames = [],
|
937
|
-
|
938
|
-
value, max, scrollerLength, length, pct;
|
1129
|
+
thumbPosition, thumbLength, thumbElement;
|
939
1130
|
|
940
1131
|
// We set a class name depending on the layout direction so that we can
|
941
1132
|
// style them differently using CSS.
|
942
1133
|
switch (this.get('layoutDirection')) {
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
1134
|
+
case SC.LAYOUT_VERTICAL:
|
1135
|
+
classNames.push('sc-vertical');
|
1136
|
+
break;
|
1137
|
+
case SC.LAYOUT_HORIZONTAL:
|
1138
|
+
classNames.push('sc-horizontal');
|
1139
|
+
break;
|
949
1140
|
}
|
950
1141
|
|
951
1142
|
// Whether to hide the thumb and buttons
|
@@ -961,15 +1152,14 @@ SC.TouchScrollerView = SC.ScrollerView.extend(
|
|
961
1152
|
|
962
1153
|
// If this is the first time, generate the actual HTML
|
963
1154
|
if (firstTime) {
|
964
|
-
context.push('<div class="track"></div>'+
|
1155
|
+
context.push('<div class="track"></div>' +
|
965
1156
|
'<div class="cap"></div>');
|
966
1157
|
this.renderButtons(context, this.get('hasButtons'));
|
967
|
-
this.renderThumb(context,
|
968
|
-
}
|
1158
|
+
this.renderThumb(context, thumbPosition, thumbLength);
|
969
1159
|
|
970
|
-
|
971
|
-
|
972
|
-
|
1160
|
+
// The HTML has already been generated, so all we have to do is
|
1161
|
+
// reposition and resize the thumb
|
1162
|
+
} else {
|
973
1163
|
|
974
1164
|
// If we aren't displaying controls don't bother
|
975
1165
|
if (this.get('controlsHidden')) return;
|
@@ -980,17 +1170,43 @@ SC.TouchScrollerView = SC.ScrollerView.extend(
|
|
980
1170
|
}
|
981
1171
|
},
|
982
1172
|
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
1173
|
+
/** @private */
|
1174
|
+
renderThumb: function (context, thumbPosition, thumbLength) {
|
1175
|
+
var transformCSS = SC.browser.experimentalCSSNameFor('transform'),
|
1176
|
+
thumbPositionStyle, thumbSizeStyle;
|
1177
|
+
|
1178
|
+
switch (this.get('layoutDirection')) {
|
1179
|
+
case SC.LAYOUT_VERTICAL:
|
1180
|
+
thumbPositionStyle = transformCSS + ': translate3d(0px,' + thumbPosition + 'px,0px)';
|
1181
|
+
// where is this magic number from?
|
1182
|
+
thumbSizeStyle = transformCSS + ': translateY(' + (thumbLength - 1044) + 'px)'.fmt();
|
1183
|
+
break;
|
1184
|
+
case SC.LAYOUT_HORIZONTAL:
|
1185
|
+
thumbPositionStyle = transformCSS + ': translate3d(' + thumbPosition + 'px,0px,0px)';
|
1186
|
+
thumbSizeStyle = transformCSS + ': translateX(' + (thumbLength - 1044) + 'px)'.fmt();
|
1187
|
+
break;
|
1188
|
+
}
|
987
1189
|
|
988
|
-
context.push('<div class="thumb">'+
|
989
|
-
'<div class="thumb-top"></div>'+
|
990
|
-
'<div class="thumb-clip">'+
|
991
|
-
'<div class="thumb-inner" style="
|
992
|
-
'<div class="thumb-center"></div>'+
|
1190
|
+
context.push('<div class="thumb" style="%@;">'.fmt(thumbPositionStyle) +
|
1191
|
+
'<div class="thumb-top"></div>' +
|
1192
|
+
'<div class="thumb-clip">' +
|
1193
|
+
'<div class="thumb-inner" style="%@;">'.fmt(thumbSizeStyle) +
|
1194
|
+
'<div class="thumb-center"></div>' +
|
993
1195
|
'<div class="thumb-bottom"></div></div></div></div>');
|
994
1196
|
|
1197
|
+
// Cache these values to check for changes.
|
1198
|
+
this._thumbPosition = thumbPosition;
|
1199
|
+
this._thumbSize = thumbLength;
|
1200
|
+
}
|
1201
|
+
});
|
1202
|
+
|
1203
|
+
|
1204
|
+
/* @private Old inaccurate name retained for backward compatibility. */
|
1205
|
+
SC.TouchScrollerView = SC.OverlayScrollerView.extend({
|
1206
|
+
//@if(debug)
|
1207
|
+
init: function () {
|
1208
|
+
SC.warn('Developer Warning: SC.TouchScrollerView has been renamed SC.OverlayScrollerView. SC.TouchScrollerView will be removed entirely in a future version.');
|
1209
|
+
return sc_super();
|
995
1210
|
}
|
1211
|
+
//@endif
|
996
1212
|
});
|