nodeskini 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blocklySkini/archive/blocklyControleur.js +87 -0
- package/blocklySkini/archive/blocklySkini.js +84 -0
- package/blocklySkini/archive/blocklyhop.js +75 -0
- package/blocklySkini/archive/clientControleurBlocly.js +170 -0
- package/blocklySkini/archive/index.html +76 -0
- package/blocklySkini/archive/testHHsuspend.txt +89 -0
- package/blocklySkini/archive/testHHtrap.txt +262 -0
- package/blocklySkini/archive/testOrchestration.txt +177 -0
- package/blocklySkini/archive/testOrchestration.xml +447 -0
- package/blocklySkini/archive/testOrchestration2.xml +456 -0
- package/blocklySkini/blockly/README.md +77 -0
- package/blocklySkini/blockly/blockly.d.ts +21480 -0
- package/blocklySkini/blockly/blockly.js +25 -0
- package/blocklySkini/blockly/blockly.min.js +2188 -0
- package/blocklySkini/blockly/blockly_compressed.js +1455 -0
- package/blocklySkini/blockly/blockly_compressed.js.map +1 -0
- package/blocklySkini/blockly/blocks/colour.js +122 -0
- package/blocklySkini/blockly/blocks/lists.js +862 -0
- package/blocklySkini/blockly/blocks/logic.js +635 -0
- package/blocklySkini/blockly/blocks/loops.js +357 -0
- package/blocklySkini/blockly/blocks/math.js +566 -0
- package/blocklySkini/blockly/blocks/procedures.js +1072 -0
- package/blocklySkini/blockly/blocks/text.js +923 -0
- package/blocklySkini/blockly/blocks/variables.js +163 -0
- package/blocklySkini/blockly/blocks/variables_dynamic.js +180 -0
- package/blocklySkini/blockly/blocks.d.ts +15 -0
- package/blocklySkini/blockly/blocks.js +27 -0
- package/blocklySkini/blockly/blocks_compressed.js +182 -0
- package/blocklySkini/blockly/blocks_compressed.js.map +1 -0
- package/blocklySkini/blockly/browser.js +36 -0
- package/blocklySkini/blockly/core/block.js +2010 -0
- package/blocklySkini/blockly/core/block_animations.js +203 -0
- package/blocklySkini/blockly/core/block_drag_surface.js +212 -0
- package/blocklySkini/blockly/core/block_dragger.js +378 -0
- package/blocklySkini/blockly/core/block_events.js +548 -0
- package/blocklySkini/blockly/core/block_svg.js +1763 -0
- package/blocklySkini/blockly/core/blockly.js +674 -0
- package/blocklySkini/blockly/core/blocks.js +23 -0
- package/blocklySkini/blockly/core/bubble.js +880 -0
- package/blocklySkini/blockly/core/bubble_dragger.js +274 -0
- package/blocklySkini/blockly/core/comment.js +439 -0
- package/blocklySkini/blockly/core/components/component.js +554 -0
- package/blocklySkini/blockly/core/components/tree/basenode.js +895 -0
- package/blocklySkini/blockly/core/components/tree/treecontrol.js +332 -0
- package/blocklySkini/blockly/core/components/tree/treenode.js +172 -0
- package/blocklySkini/blockly/core/connection.js +682 -0
- package/blocklySkini/blockly/core/connection_checker.js +285 -0
- package/blocklySkini/blockly/core/connection_db.js +295 -0
- package/blocklySkini/blockly/core/constants.js +277 -0
- package/blocklySkini/blockly/core/contextmenu.js +307 -0
- package/blocklySkini/blockly/core/contextmenu_items.js +534 -0
- package/blocklySkini/blockly/core/contextmenu_registry.js +165 -0
- package/blocklySkini/blockly/core/css.js +549 -0
- package/blocklySkini/blockly/core/dropdowndiv.js +776 -0
- package/blocklySkini/blockly/core/events.js +387 -0
- package/blocklySkini/blockly/core/events_abstract.js +106 -0
- package/blocklySkini/blockly/core/extensions.js +450 -0
- package/blocklySkini/blockly/core/field.js +1162 -0
- package/blocklySkini/blockly/core/field_angle.js +562 -0
- package/blocklySkini/blockly/core/field_checkbox.js +220 -0
- package/blocklySkini/blockly/core/field_colour.js +664 -0
- package/blocklySkini/blockly/core/field_dropdown.js +760 -0
- package/blocklySkini/blockly/core/field_image.js +286 -0
- package/blocklySkini/blockly/core/field_label.js +130 -0
- package/blocklySkini/blockly/core/field_label_serializable.js +69 -0
- package/blocklySkini/blockly/core/field_multilineinput.js +299 -0
- package/blocklySkini/blockly/core/field_number.js +317 -0
- package/blocklySkini/blockly/core/field_registry.js +66 -0
- package/blocklySkini/blockly/core/field_textinput.js +616 -0
- package/blocklySkini/blockly/core/field_variable.js +463 -0
- package/blocklySkini/blockly/core/flyout_base.js +1071 -0
- package/blocklySkini/blockly/core/flyout_button.js +325 -0
- package/blocklySkini/blockly/core/flyout_dragger.js +76 -0
- package/blocklySkini/blockly/core/flyout_horizontal.js +388 -0
- package/blocklySkini/blockly/core/flyout_vertical.js +397 -0
- package/blocklySkini/blockly/core/generator.js +482 -0
- package/blocklySkini/blockly/core/gesture.js +993 -0
- package/blocklySkini/blockly/core/grid.js +222 -0
- package/blocklySkini/blockly/core/icon.js +206 -0
- package/blocklySkini/blockly/core/inject.js +487 -0
- package/blocklySkini/blockly/core/input.js +296 -0
- package/blocklySkini/blockly/core/insertion_marker_manager.js +700 -0
- package/blocklySkini/blockly/core/interfaces/i_accessibility.js +72 -0
- package/blocklySkini/blockly/core/interfaces/i_bounded_element.js +31 -0
- package/blocklySkini/blockly/core/interfaces/i_bubble.js +83 -0
- package/blocklySkini/blockly/core/interfaces/i_connection_checker.js +94 -0
- package/blocklySkini/blockly/core/interfaces/i_contextmenu.js +26 -0
- package/blocklySkini/blockly/core/interfaces/i_copyable.js +40 -0
- package/blocklySkini/blockly/core/interfaces/i_deletable.js +27 -0
- package/blocklySkini/blockly/core/interfaces/i_deletearea.js +28 -0
- package/blocklySkini/blockly/core/interfaces/i_flyout.js +178 -0
- package/blocklySkini/blockly/core/interfaces/i_movable.js +27 -0
- package/blocklySkini/blockly/core/interfaces/i_registrable.js +22 -0
- package/blocklySkini/blockly/core/interfaces/i_registrable_field.js +31 -0
- package/blocklySkini/blockly/core/interfaces/i_selectable.js +43 -0
- package/blocklySkini/blockly/core/interfaces/i_styleable.js +33 -0
- package/blocklySkini/blockly/core/interfaces/i_toolbox.js +131 -0
- package/blocklySkini/blockly/core/interfaces/i_toolbox_item.js +148 -0
- package/blocklySkini/blockly/core/keyboard_nav/action.js +26 -0
- package/blocklySkini/blockly/core/keyboard_nav/ast_node.js +684 -0
- package/blocklySkini/blockly/core/keyboard_nav/basic_cursor.js +208 -0
- package/blocklySkini/blockly/core/keyboard_nav/cursor.js +170 -0
- package/blocklySkini/blockly/core/keyboard_nav/flyout_cursor.js +106 -0
- package/blocklySkini/blockly/core/keyboard_nav/key_map.js +190 -0
- package/blocklySkini/blockly/core/keyboard_nav/marker.js +120 -0
- package/blocklySkini/blockly/core/keyboard_nav/navigation.js +1084 -0
- package/blocklySkini/blockly/core/keyboard_nav/tab_navigate_cursor.js +48 -0
- package/blocklySkini/blockly/core/marker_manager.js +183 -0
- package/blocklySkini/blockly/core/menu.js +465 -0
- package/blocklySkini/blockly/core/menuitem.js +280 -0
- package/blocklySkini/blockly/core/msg.js +31 -0
- package/blocklySkini/blockly/core/mutator.js +555 -0
- package/blocklySkini/blockly/core/names.js +186 -0
- package/blocklySkini/blockly/core/options.js +365 -0
- package/blocklySkini/blockly/core/procedures.js +404 -0
- package/blocklySkini/blockly/core/registry.js +265 -0
- package/blocklySkini/blockly/core/rendered_connection.js +565 -0
- package/blocklySkini/blockly/core/renderers/common/block_rendering.js +81 -0
- package/blocklySkini/blockly/core/renderers/common/constants.js +1256 -0
- package/blocklySkini/blockly/core/renderers/common/debugger.js +431 -0
- package/blocklySkini/blockly/core/renderers/common/drawer.js +468 -0
- package/blocklySkini/blockly/core/renderers/common/i_path_object.js +151 -0
- package/blocklySkini/blockly/core/renderers/common/info.js +775 -0
- package/blocklySkini/blockly/core/renderers/common/marker_svg.js +687 -0
- package/blocklySkini/blockly/core/renderers/common/path_object.js +279 -0
- package/blocklySkini/blockly/core/renderers/common/renderer.js +301 -0
- package/blocklySkini/blockly/core/renderers/geras/constants.js +64 -0
- package/blocklySkini/blockly/core/renderers/geras/drawer.js +205 -0
- package/blocklySkini/blockly/core/renderers/geras/highlight_constants.js +311 -0
- package/blocklySkini/blockly/core/renderers/geras/highlighter.js +256 -0
- package/blocklySkini/blockly/core/renderers/geras/info.js +483 -0
- package/blocklySkini/blockly/core/renderers/geras/measurables/inputs.js +67 -0
- package/blocklySkini/blockly/core/renderers/geras/path_object.js +177 -0
- package/blocklySkini/blockly/core/renderers/geras/renderer.js +138 -0
- package/blocklySkini/blockly/core/renderers/measurables/base.js +44 -0
- package/blocklySkini/blockly/core/renderers/measurables/connections.js +114 -0
- package/blocklySkini/blockly/core/renderers/measurables/inputs.js +160 -0
- package/blocklySkini/blockly/core/renderers/measurables/row_elements.js +185 -0
- package/blocklySkini/blockly/core/renderers/measurables/rows.js +532 -0
- package/blocklySkini/blockly/core/renderers/measurables/types.js +349 -0
- package/blocklySkini/blockly/core/renderers/minimalist/constants.js +29 -0
- package/blocklySkini/blockly/core/renderers/minimalist/drawer.js +32 -0
- package/blocklySkini/blockly/core/renderers/minimalist/info.js +45 -0
- package/blocklySkini/blockly/core/renderers/minimalist/renderer.js +70 -0
- package/blocklySkini/blockly/core/renderers/thrasos/info.js +338 -0
- package/blocklySkini/blockly/core/renderers/thrasos/renderer.js +45 -0
- package/blocklySkini/blockly/core/renderers/zelos/constants.js +1002 -0
- package/blocklySkini/blockly/core/renderers/zelos/drawer.js +233 -0
- package/blocklySkini/blockly/core/renderers/zelos/info.js +587 -0
- package/blocklySkini/blockly/core/renderers/zelos/marker_svg.js +148 -0
- package/blocklySkini/blockly/core/renderers/zelos/measurables/inputs.js +47 -0
- package/blocklySkini/blockly/core/renderers/zelos/measurables/row_elements.js +37 -0
- package/blocklySkini/blockly/core/renderers/zelos/measurables/rows.js +108 -0
- package/blocklySkini/blockly/core/renderers/zelos/path_object.js +244 -0
- package/blocklySkini/blockly/core/renderers/zelos/renderer.js +130 -0
- package/blocklySkini/blockly/core/requires.js +84 -0
- package/blocklySkini/blockly/core/scrollbar.js +880 -0
- package/blocklySkini/blockly/core/theme/classic.js +87 -0
- package/blocklySkini/blockly/core/theme/dark.js +33 -0
- package/blocklySkini/blockly/core/theme/deuteranopia.js +104 -0
- package/blocklySkini/blockly/core/theme/highcontrast.js +119 -0
- package/blocklySkini/blockly/core/theme/modern.js +108 -0
- package/blocklySkini/blockly/core/theme/tritanopia.js +103 -0
- package/blocklySkini/blockly/core/theme/zelos.js +106 -0
- package/blocklySkini/blockly/core/theme.js +236 -0
- package/blocklySkini/blockly/core/theme_manager.js +197 -0
- package/blocklySkini/blockly/core/toolbox/category.js +690 -0
- package/blocklySkini/blockly/core/toolbox/collapsible_category.js +294 -0
- package/blocklySkini/blockly/core/toolbox/separator.js +123 -0
- package/blocklySkini/blockly/core/toolbox/toolbox.js +984 -0
- package/blocklySkini/blockly/core/toolbox/toolbox_item.js +145 -0
- package/blocklySkini/blockly/core/toolbox.js +943 -0
- package/blocklySkini/blockly/core/tooltip.js +387 -0
- package/blocklySkini/blockly/core/touch.js +255 -0
- package/blocklySkini/blockly/core/touch_gesture.js +325 -0
- package/blocklySkini/blockly/core/trashcan.js +661 -0
- package/blocklySkini/blockly/core/ui_events.js +85 -0
- package/blocklySkini/blockly/core/utils/aria.js +167 -0
- package/blocklySkini/blockly/core/utils/colour.js +208 -0
- package/blocklySkini/blockly/core/utils/coordinate.js +125 -0
- package/blocklySkini/blockly/core/utils/deprecation.js +34 -0
- package/blocklySkini/blockly/core/utils/dom.js +391 -0
- package/blocklySkini/blockly/core/utils/global.js +37 -0
- package/blocklySkini/blockly/core/utils/idgenerator.js +33 -0
- package/blocklySkini/blockly/core/utils/keycodes.js +164 -0
- package/blocklySkini/blockly/core/utils/math.js +56 -0
- package/blocklySkini/blockly/core/utils/metrics.js +124 -0
- package/blocklySkini/blockly/core/utils/object.js +73 -0
- package/blocklySkini/blockly/core/utils/rect.js +54 -0
- package/blocklySkini/blockly/core/utils/size.js +58 -0
- package/blocklySkini/blockly/core/utils/string.js +284 -0
- package/blocklySkini/blockly/core/utils/style.js +281 -0
- package/blocklySkini/blockly/core/utils/svg.js +181 -0
- package/blocklySkini/blockly/core/utils/svg_paths.js +142 -0
- package/blocklySkini/blockly/core/utils/toolbox.js +401 -0
- package/blocklySkini/blockly/core/utils/useragent.js +110 -0
- package/blocklySkini/blockly/core/utils/xml.js +79 -0
- package/blocklySkini/blockly/core/utils.js +652 -0
- package/blocklySkini/blockly/core/variable_events.js +248 -0
- package/blocklySkini/blockly/core/variable_map.js +414 -0
- package/blocklySkini/blockly/core/variable_model.js +95 -0
- package/blocklySkini/blockly/core/variables.js +571 -0
- package/blocklySkini/blockly/core/variables_dynamic.js +100 -0
- package/blocklySkini/blockly/core/warning.js +200 -0
- package/blocklySkini/blockly/core/widgetdiv.js +241 -0
- package/blocklySkini/blockly/core/workspace.js +786 -0
- package/blocklySkini/blockly/core/workspace_audio.js +153 -0
- package/blocklySkini/blockly/core/workspace_comment.js +373 -0
- package/blocklySkini/blockly/core/workspace_comment_render_svg.js +461 -0
- package/blocklySkini/blockly/core/workspace_comment_svg.js +701 -0
- package/blocklySkini/blockly/core/workspace_drag_surface_svg.js +176 -0
- package/blocklySkini/blockly/core/workspace_dragger.js +85 -0
- package/blocklySkini/blockly/core/workspace_events.js +93 -0
- package/blocklySkini/blockly/core/workspace_svg.js +2661 -0
- package/blocklySkini/blockly/core/ws_comment_events.js +417 -0
- package/blocklySkini/blockly/core/xml.js +827 -0
- package/blocklySkini/blockly/core/zoom_controls.js +449 -0
- package/blocklySkini/blockly/core-browser.js +34 -0
- package/blocklySkini/blockly/core.d.ts +15 -0
- package/blocklySkini/blockly/core.js +38 -0
- package/blocklySkini/blockly/dart.d.ts +15 -0
- package/blocklySkini/blockly/dart.js +27 -0
- package/blocklySkini/blockly/dart_compressed.js +114 -0
- package/blocklySkini/blockly/dart_compressed.js.map +1 -0
- package/blocklySkini/blockly/generators/dart/colour.js +114 -0
- package/blocklySkini/blockly/generators/dart/lists.js +447 -0
- package/blocklySkini/blockly/generators/dart/logic.js +127 -0
- package/blocklySkini/blockly/generators/dart/loops.js +169 -0
- package/blocklySkini/blockly/generators/dart/math.js +485 -0
- package/blocklySkini/blockly/generators/dart/procedures.js +111 -0
- package/blocklySkini/blockly/generators/dart/text.js +339 -0
- package/blocklySkini/blockly/generators/dart/variables.js +32 -0
- package/blocklySkini/blockly/generators/dart/variables_dynamic.js +21 -0
- package/blocklySkini/blockly/generators/dart.js +290 -0
- package/blocklySkini/blockly/generators/javascript/colour.js +89 -0
- package/blocklySkini/blockly/generators/javascript/lists.js +388 -0
- package/blocklySkini/blockly/generators/javascript/logic.js +129 -0
- package/blocklySkini/blockly/generators/javascript/loops.js +184 -0
- package/blocklySkini/blockly/generators/javascript/math.js +409 -0
- package/blocklySkini/blockly/generators/javascript/procedures.js +113 -0
- package/blocklySkini/blockly/generators/javascript/text.js +367 -0
- package/blocklySkini/blockly/generators/javascript/variables.js +32 -0
- package/blocklySkini/blockly/generators/javascript/variables_dynamic.js +23 -0
- package/blocklySkini/blockly/generators/javascript.js +317 -0
- package/blocklySkini/blockly/generators/lua/colour.js +76 -0
- package/blocklySkini/blockly/generators/lua/lists.js +368 -0
- package/blocklySkini/blockly/generators/lua/logic.js +127 -0
- package/blocklySkini/blockly/generators/lua/loops.js +173 -0
- package/blocklySkini/blockly/generators/lua/math.js +423 -0
- package/blocklySkini/blockly/generators/lua/procedures.js +113 -0
- package/blocklySkini/blockly/generators/lua/text.js +353 -0
- package/blocklySkini/blockly/generators/lua/variables.js +32 -0
- package/blocklySkini/blockly/generators/lua/variables_dynamic.js +21 -0
- package/blocklySkini/blockly/generators/lua.js +198 -0
- package/blocklySkini/blockly/generators/php/colour.js +91 -0
- package/blocklySkini/blockly/generators/php/lists.js +498 -0
- package/blocklySkini/blockly/generators/php/logic.js +128 -0
- package/blocklySkini/blockly/generators/php/loops.js +170 -0
- package/blocklySkini/blockly/generators/php/math.js +370 -0
- package/blocklySkini/blockly/generators/php/procedures.js +132 -0
- package/blocklySkini/blockly/generators/php/text.js +271 -0
- package/blocklySkini/blockly/generators/php/variables.js +32 -0
- package/blocklySkini/blockly/generators/php/variables_dynamic.js +21 -0
- package/blocklySkini/blockly/generators/php.js +318 -0
- package/blocklySkini/blockly/generators/python/colour.js +72 -0
- package/blocklySkini/blockly/generators/python/lists.js +349 -0
- package/blocklySkini/blockly/generators/python/logic.js +127 -0
- package/blocklySkini/blockly/generators/python/loops.js +214 -0
- package/blocklySkini/blockly/generators/python/math.js +385 -0
- package/blocklySkini/blockly/generators/python/procedures.js +134 -0
- package/blocklySkini/blockly/generators/python/text.js +293 -0
- package/blocklySkini/blockly/generators/python/variables.js +32 -0
- package/blocklySkini/blockly/generators/python/variables_dynamic.js +21 -0
- package/blocklySkini/blockly/generators/python.js +322 -0
- package/blocklySkini/blockly/index.d.ts +22 -0
- package/blocklySkini/blockly/index.js +24 -0
- package/blocklySkini/blockly/javascript.d.ts +15 -0
- package/blocklySkini/blockly/javascript.js +27 -0
- package/blocklySkini/blockly/javascript_compressed.js +115 -0
- package/blocklySkini/blockly/javascript_compressed.js.map +1 -0
- package/blocklySkini/blockly/lua.d.ts +15 -0
- package/blocklySkini/blockly/lua.js +27 -0
- package/blocklySkini/blockly/lua_compressed.js +94 -0
- package/blocklySkini/blockly/lua_compressed.js.map +1 -0
- package/blocklySkini/blockly/media/1x1.gif +0 -0
- package/blocklySkini/blockly/media/click.mp3 +0 -0
- package/blocklySkini/blockly/media/click.ogg +0 -0
- package/blocklySkini/blockly/media/click.wav +0 -0
- package/blocklySkini/blockly/media/delete.mp3 +0 -0
- package/blocklySkini/blockly/media/delete.ogg +0 -0
- package/blocklySkini/blockly/media/delete.wav +0 -0
- package/blocklySkini/blockly/media/disconnect.mp3 +0 -0
- package/blocklySkini/blockly/media/disconnect.ogg +0 -0
- package/blocklySkini/blockly/media/disconnect.wav +0 -0
- package/blocklySkini/blockly/media/dropdown-arrow.svg +1 -0
- package/blocklySkini/blockly/media/handclosed.cur +0 -0
- package/blocklySkini/blockly/media/handdelete.cur +0 -0
- package/blocklySkini/blockly/media/handopen.cur +0 -0
- package/blocklySkini/blockly/media/pilcrow.png +0 -0
- package/blocklySkini/blockly/media/quote0.png +0 -0
- package/blocklySkini/blockly/media/quote1.png +0 -0
- package/blocklySkini/blockly/media/sprites.png +0 -0
- package/blocklySkini/blockly/media/sprites.svg +74 -0
- package/blocklySkini/blockly/msg/ab.d.ts +16 -0
- package/blocklySkini/blockly/msg/ab.js +447 -0
- package/blocklySkini/blockly/msg/ar.d.ts +16 -0
- package/blocklySkini/blockly/msg/ar.js +447 -0
- package/blocklySkini/blockly/msg/az.d.ts +16 -0
- package/blocklySkini/blockly/msg/az.js +447 -0
- package/blocklySkini/blockly/msg/ba.d.ts +16 -0
- package/blocklySkini/blockly/msg/ba.js +447 -0
- package/blocklySkini/blockly/msg/bcc.d.ts +16 -0
- package/blocklySkini/blockly/msg/bcc.js +447 -0
- package/blocklySkini/blockly/msg/be-tarask.d.ts +16 -0
- package/blocklySkini/blockly/msg/be-tarask.js +447 -0
- package/blocklySkini/blockly/msg/be.d.ts +16 -0
- package/blocklySkini/blockly/msg/be.js +447 -0
- package/blocklySkini/blockly/msg/bg.d.ts +16 -0
- package/blocklySkini/blockly/msg/bg.js +447 -0
- package/blocklySkini/blockly/msg/bn.d.ts +16 -0
- package/blocklySkini/blockly/msg/bn.js +447 -0
- package/blocklySkini/blockly/msg/br.d.ts +16 -0
- package/blocklySkini/blockly/msg/br.js +447 -0
- package/blocklySkini/blockly/msg/ca.d.ts +16 -0
- package/blocklySkini/blockly/msg/ca.js +447 -0
- package/blocklySkini/blockly/msg/constants.d.ts +16 -0
- package/blocklySkini/blockly/msg/cs.d.ts +16 -0
- package/blocklySkini/blockly/msg/cs.js +447 -0
- package/blocklySkini/blockly/msg/da.d.ts +16 -0
- package/blocklySkini/blockly/msg/da.js +447 -0
- package/blocklySkini/blockly/msg/de.d.ts +16 -0
- package/blocklySkini/blockly/msg/de.js +447 -0
- package/blocklySkini/blockly/msg/diq.d.ts +16 -0
- package/blocklySkini/blockly/msg/diq.js +447 -0
- package/blocklySkini/blockly/msg/dty.d.ts +16 -0
- package/blocklySkini/blockly/msg/dty.js +447 -0
- package/blocklySkini/blockly/msg/ee.d.ts +16 -0
- package/blocklySkini/blockly/msg/ee.js +447 -0
- package/blocklySkini/blockly/msg/el.d.ts +16 -0
- package/blocklySkini/blockly/msg/el.js +447 -0
- package/blocklySkini/blockly/msg/en-gb.d.ts +16 -0
- package/blocklySkini/blockly/msg/en-gb.js +447 -0
- package/blocklySkini/blockly/msg/en.d.ts +16 -0
- package/blocklySkini/blockly/msg/en.js +447 -0
- package/blocklySkini/blockly/msg/eo.d.ts +16 -0
- package/blocklySkini/blockly/msg/eo.js +447 -0
- package/blocklySkini/blockly/msg/es.d.ts +16 -0
- package/blocklySkini/blockly/msg/es.js +447 -0
- package/blocklySkini/blockly/msg/et.d.ts +16 -0
- package/blocklySkini/blockly/msg/et.js +447 -0
- package/blocklySkini/blockly/msg/eu.d.ts +16 -0
- package/blocklySkini/blockly/msg/eu.js +447 -0
- package/blocklySkini/blockly/msg/fa.d.ts +16 -0
- package/blocklySkini/blockly/msg/fa.js +447 -0
- package/blocklySkini/blockly/msg/fi.d.ts +16 -0
- package/blocklySkini/blockly/msg/fi.js +447 -0
- package/blocklySkini/blockly/msg/fr.d.ts +16 -0
- package/blocklySkini/blockly/msg/fr.js +447 -0
- package/blocklySkini/blockly/msg/gl.d.ts +16 -0
- package/blocklySkini/blockly/msg/gl.js +447 -0
- package/blocklySkini/blockly/msg/gor.d.ts +16 -0
- package/blocklySkini/blockly/msg/gor.js +447 -0
- package/blocklySkini/blockly/msg/ha.d.ts +16 -0
- package/blocklySkini/blockly/msg/ha.js +447 -0
- package/blocklySkini/blockly/msg/he.d.ts +16 -0
- package/blocklySkini/blockly/msg/he.js +447 -0
- package/blocklySkini/blockly/msg/hi.d.ts +16 -0
- package/blocklySkini/blockly/msg/hi.js +447 -0
- package/blocklySkini/blockly/msg/hrx.d.ts +16 -0
- package/blocklySkini/blockly/msg/hrx.js +447 -0
- package/blocklySkini/blockly/msg/hu.d.ts +16 -0
- package/blocklySkini/blockly/msg/hu.js +447 -0
- package/blocklySkini/blockly/msg/hy.d.ts +16 -0
- package/blocklySkini/blockly/msg/hy.js +447 -0
- package/blocklySkini/blockly/msg/ia.d.ts +16 -0
- package/blocklySkini/blockly/msg/ia.js +447 -0
- package/blocklySkini/blockly/msg/id.d.ts +16 -0
- package/blocklySkini/blockly/msg/id.js +447 -0
- package/blocklySkini/blockly/msg/ig.d.ts +16 -0
- package/blocklySkini/blockly/msg/ig.js +447 -0
- package/blocklySkini/blockly/msg/is.d.ts +16 -0
- package/blocklySkini/blockly/msg/is.js +447 -0
- package/blocklySkini/blockly/msg/it.d.ts +16 -0
- package/blocklySkini/blockly/msg/it.js +447 -0
- package/blocklySkini/blockly/msg/ja.d.ts +16 -0
- package/blocklySkini/blockly/msg/ja.js +447 -0
- package/blocklySkini/blockly/msg/kab.d.ts +16 -0
- package/blocklySkini/blockly/msg/kab.js +447 -0
- package/blocklySkini/blockly/msg/kn.d.ts +16 -0
- package/blocklySkini/blockly/msg/kn.js +447 -0
- package/blocklySkini/blockly/msg/ko.d.ts +16 -0
- package/blocklySkini/blockly/msg/ko.js +447 -0
- package/blocklySkini/blockly/msg/lb.d.ts +16 -0
- package/blocklySkini/blockly/msg/lb.js +447 -0
- package/blocklySkini/blockly/msg/lki.d.ts +16 -0
- package/blocklySkini/blockly/msg/lki.js +447 -0
- package/blocklySkini/blockly/msg/lo.d.ts +16 -0
- package/blocklySkini/blockly/msg/lo.js +447 -0
- package/blocklySkini/blockly/msg/lrc.d.ts +16 -0
- package/blocklySkini/blockly/msg/lrc.js +447 -0
- package/blocklySkini/blockly/msg/lt.d.ts +16 -0
- package/blocklySkini/blockly/msg/lt.js +447 -0
- package/blocklySkini/blockly/msg/lv.d.ts +16 -0
- package/blocklySkini/blockly/msg/lv.js +447 -0
- package/blocklySkini/blockly/msg/mk.d.ts +16 -0
- package/blocklySkini/blockly/msg/mk.js +447 -0
- package/blocklySkini/blockly/msg/mnw.d.ts +16 -0
- package/blocklySkini/blockly/msg/mnw.js +447 -0
- package/blocklySkini/blockly/msg/ms.d.ts +16 -0
- package/blocklySkini/blockly/msg/ms.js +447 -0
- package/blocklySkini/blockly/msg/msg.d.ts +444 -0
- package/blocklySkini/blockly/msg/nb.d.ts +16 -0
- package/blocklySkini/blockly/msg/nb.js +447 -0
- package/blocklySkini/blockly/msg/nl.d.ts +16 -0
- package/blocklySkini/blockly/msg/nl.js +447 -0
- package/blocklySkini/blockly/msg/oc.d.ts +16 -0
- package/blocklySkini/blockly/msg/oc.js +447 -0
- package/blocklySkini/blockly/msg/pl.d.ts +16 -0
- package/blocklySkini/blockly/msg/pl.js +447 -0
- package/blocklySkini/blockly/msg/pms.d.ts +16 -0
- package/blocklySkini/blockly/msg/pms.js +447 -0
- package/blocklySkini/blockly/msg/pt-br.d.ts +16 -0
- package/blocklySkini/blockly/msg/pt-br.js +447 -0
- package/blocklySkini/blockly/msg/pt.d.ts +16 -0
- package/blocklySkini/blockly/msg/pt.js +447 -0
- package/blocklySkini/blockly/msg/qqq.d.ts +16 -0
- package/blocklySkini/blockly/msg/ro.d.ts +16 -0
- package/blocklySkini/blockly/msg/ro.js +447 -0
- package/blocklySkini/blockly/msg/ru.d.ts +16 -0
- package/blocklySkini/blockly/msg/ru.js +447 -0
- package/blocklySkini/blockly/msg/sc.d.ts +16 -0
- package/blocklySkini/blockly/msg/sc.js +447 -0
- package/blocklySkini/blockly/msg/sd.d.ts +16 -0
- package/blocklySkini/blockly/msg/sd.js +447 -0
- package/blocklySkini/blockly/msg/shn.d.ts +16 -0
- package/blocklySkini/blockly/msg/shn.js +447 -0
- package/blocklySkini/blockly/msg/sk.d.ts +16 -0
- package/blocklySkini/blockly/msg/sk.js +447 -0
- package/blocklySkini/blockly/msg/skr-arab.d.ts +16 -0
- package/blocklySkini/blockly/msg/skr-arab.js +447 -0
- package/blocklySkini/blockly/msg/sl.d.ts +16 -0
- package/blocklySkini/blockly/msg/sl.js +447 -0
- package/blocklySkini/blockly/msg/sq.d.ts +16 -0
- package/blocklySkini/blockly/msg/sq.js +447 -0
- package/blocklySkini/blockly/msg/sr-latn.d.ts +16 -0
- package/blocklySkini/blockly/msg/sr-latn.js +447 -0
- package/blocklySkini/blockly/msg/sr.d.ts +16 -0
- package/blocklySkini/blockly/msg/sr.js +447 -0
- package/blocklySkini/blockly/msg/sv.d.ts +16 -0
- package/blocklySkini/blockly/msg/sv.js +447 -0
- package/blocklySkini/blockly/msg/synonyms.d.ts +16 -0
- package/blocklySkini/blockly/msg/ta.d.ts +16 -0
- package/blocklySkini/blockly/msg/ta.js +447 -0
- package/blocklySkini/blockly/msg/tcy.d.ts +16 -0
- package/blocklySkini/blockly/msg/tcy.js +447 -0
- package/blocklySkini/blockly/msg/te.d.ts +16 -0
- package/blocklySkini/blockly/msg/te.js +447 -0
- package/blocklySkini/blockly/msg/th.d.ts +16 -0
- package/blocklySkini/blockly/msg/th.js +447 -0
- package/blocklySkini/blockly/msg/tl.d.ts +16 -0
- package/blocklySkini/blockly/msg/tl.js +447 -0
- package/blocklySkini/blockly/msg/tlh.d.ts +16 -0
- package/blocklySkini/blockly/msg/tlh.js +447 -0
- package/blocklySkini/blockly/msg/tr.d.ts +16 -0
- package/blocklySkini/blockly/msg/tr.js +447 -0
- package/blocklySkini/blockly/msg/ug-arab.d.ts +16 -0
- package/blocklySkini/blockly/msg/ug-arab.js +447 -0
- package/blocklySkini/blockly/msg/uk.d.ts +16 -0
- package/blocklySkini/blockly/msg/uk.js +447 -0
- package/blocklySkini/blockly/msg/ur.d.ts +16 -0
- package/blocklySkini/blockly/msg/ur.js +447 -0
- package/blocklySkini/blockly/msg/vi.d.ts +16 -0
- package/blocklySkini/blockly/msg/vi.js +447 -0
- package/blocklySkini/blockly/msg/xmf.d.ts +16 -0
- package/blocklySkini/blockly/msg/xmf.js +447 -0
- package/blocklySkini/blockly/msg/yo.d.ts +16 -0
- package/blocklySkini/blockly/msg/yo.js +447 -0
- package/blocklySkini/blockly/msg/zh-hans.d.ts +16 -0
- package/blocklySkini/blockly/msg/zh-hans.js +447 -0
- package/blocklySkini/blockly/msg/zh-hant.d.ts +16 -0
- package/blocklySkini/blockly/msg/zh-hant.js +447 -0
- package/blocklySkini/blockly/node.js +35 -0
- package/blocklySkini/blockly/package.json +84 -0
- package/blocklySkini/blockly/php.d.ts +15 -0
- package/blocklySkini/blockly/php.js +27 -0
- package/blocklySkini/blockly/php_compressed.js +103 -0
- package/blocklySkini/blockly/php_compressed.js.map +1 -0
- package/blocklySkini/blockly/python.d.ts +15 -0
- package/blocklySkini/blockly/python.js +27 -0
- package/blocklySkini/blockly/python_compressed.js +98 -0
- package/blocklySkini/blockly/python_compressed.js.map +1 -0
- package/blocklySkini/blocklySkini.html +81 -0
- package/blocklySkini/orchestrations/.xml +1 -0
- package/blocklySkini/orchestrations/BluesSkini-1.xml +231 -0
- package/blocklySkini/orchestrations/BluesSkini-2.xml +741 -0
- package/blocklySkini/orchestrations/BluesSkini-3.xml +731 -0
- package/blocklySkini/orchestrations/BluesSkini-4.xml +695 -0
- package/blocklySkini/orchestrations/BluesSkini-5.xml +731 -0
- package/blocklySkini/orchestrations/BluesSkini.xml +704 -0
- package/blocklySkini/orchestrations/FunkBitwig-1.xml +778 -0
- package/blocklySkini/orchestrations/FunkBitwig-2.xml +471 -0
- package/blocklySkini/orchestrations/JouerLeBonInstrument1-1.xml +784 -0
- package/blocklySkini/orchestrations/MajeurMineur-1.xml +638 -0
- package/blocklySkini/orchestrations/Opus5-3 - Copie.xml +1041 -0
- package/blocklySkini/orchestrations/Opus5-3.xml +1128 -0
- package/blocklySkini/orchestrations/Quatuor1-1.xml +357 -0
- package/blocklySkini/orchestrations/TechnoBitwig-1.xml +221 -0
- package/blocklySkini/orchestrations/TestBlockly.xml +497 -0
- package/blocklySkini/orchestrations/TestBlockly1.xml +500 -0
- package/blocklySkini/orchestrations/TestBlockly2.xml +792 -0
- package/blocklySkini/orchestrations/TestBlockly3-1.xml +1182 -0
- package/blocklySkini/orchestrations/TestBlockly3.xml +1251 -0
- package/blocklySkini/orchestrations/TestFunction.xml +143 -0
- package/blocklySkini/orchestrations/TestIf.xml +80 -0
- package/blocklySkini/orchestrations/TestLoop.xml +127 -0
- package/blocklySkini/orchestrations/TestOrchestration2.xml +460 -0
- package/blocklySkini/orchestrations/TestPrint.xml +70 -0
- package/blocklySkini/orchestrations/TestSubMod.xml +81 -0
- package/blocklySkini/orchestrations/Testlogic.xml +113 -0
- package/blocklySkini/orchestrations/TrouveLaPercu-1.xml +813 -0
- package/blocklySkini/orchestrations/TrouveLaPercu-2.xml +813 -0
- package/blocklySkini/orchestrations/bar.xml +496 -0
- package/blocklySkini/orchestrations/bar2.xml +496 -0
- package/blocklySkini/orchestrations/foo.xml +500 -0
- package/blocklySkini/orchestrations/opus5Blockly - Copie.xml +496 -0
- package/blocklySkini/orchestrations/opus5Blockly-3.xml +868 -0
- package/blocklySkini/orchestrations/opus5Blockly.xml +496 -0
- package/blocklySkini/orchestrations/testOrchestration3.xml +483 -0
- package/blocklySkini/orchestrations/testOrchestration4.xml +487 -0
- package/blocklySkini/scripts/hiphop_blocks.js +6104 -0
- package/blocklySkini/scripts/main2.js +801 -0
- package/blocklySkini/styles/index.css +320 -0
- package/blocklySkini/styles/material.css +11552 -0
- package/package.json +4 -3
|
@@ -0,0 +1,880 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2011 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Library for creating scrollbars.
|
|
9
|
+
* @author fraser@google.com (Neil Fraser)
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
goog.provide('Blockly.Scrollbar');
|
|
14
|
+
goog.provide('Blockly.ScrollbarPair');
|
|
15
|
+
|
|
16
|
+
goog.require('Blockly.Touch');
|
|
17
|
+
goog.require('Blockly.utils');
|
|
18
|
+
goog.require('Blockly.utils.Coordinate');
|
|
19
|
+
goog.require('Blockly.utils.dom');
|
|
20
|
+
goog.require('Blockly.utils.Metrics');
|
|
21
|
+
goog.require('Blockly.utils.Svg');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A note on units: most of the numbers that are in CSS pixels are scaled if the
|
|
26
|
+
* scrollbar is in a mutator.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Class for a pair of scrollbars. Horizontal and vertical.
|
|
31
|
+
* @param {!Blockly.WorkspaceSvg} workspace Workspace to bind the scrollbars to.
|
|
32
|
+
* @constructor
|
|
33
|
+
*/
|
|
34
|
+
Blockly.ScrollbarPair = function(workspace) {
|
|
35
|
+
this.workspace_ = workspace;
|
|
36
|
+
this.hScroll = new Blockly.Scrollbar(
|
|
37
|
+
workspace, true, true, 'blocklyMainWorkspaceScrollbar');
|
|
38
|
+
this.vScroll = new Blockly.Scrollbar(
|
|
39
|
+
workspace, false, true, 'blocklyMainWorkspaceScrollbar');
|
|
40
|
+
this.corner_ = Blockly.utils.dom.createSvgElement(
|
|
41
|
+
Blockly.utils.Svg.RECT,
|
|
42
|
+
{
|
|
43
|
+
'height': Blockly.Scrollbar.scrollbarThickness,
|
|
44
|
+
'width': Blockly.Scrollbar.scrollbarThickness,
|
|
45
|
+
'class': 'blocklyScrollbarBackground'
|
|
46
|
+
},
|
|
47
|
+
null);
|
|
48
|
+
Blockly.utils.dom.insertAfter(this.corner_, workspace.getBubbleCanvas());
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Previously recorded metrics from the workspace.
|
|
52
|
+
* @type {?Blockly.utils.Metrics}
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
this.oldHostMetrics_ = null;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Dispose of this pair of scrollbars.
|
|
60
|
+
* Unlink from all DOM elements to prevent memory leaks.
|
|
61
|
+
*/
|
|
62
|
+
Blockly.ScrollbarPair.prototype.dispose = function() {
|
|
63
|
+
Blockly.utils.dom.removeNode(this.corner_);
|
|
64
|
+
this.corner_ = null;
|
|
65
|
+
this.workspace_ = null;
|
|
66
|
+
this.oldHostMetrics_ = null;
|
|
67
|
+
this.hScroll.dispose();
|
|
68
|
+
this.hScroll = null;
|
|
69
|
+
this.vScroll.dispose();
|
|
70
|
+
this.vScroll = null;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Recalculate both of the scrollbars' locations and lengths.
|
|
75
|
+
* Also reposition the corner rectangle.
|
|
76
|
+
*/
|
|
77
|
+
Blockly.ScrollbarPair.prototype.resize = function() {
|
|
78
|
+
// Look up the host metrics once, and use for both scrollbars.
|
|
79
|
+
var hostMetrics = this.workspace_.getMetrics();
|
|
80
|
+
if (!hostMetrics) {
|
|
81
|
+
// Host element is likely not visible.
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Only change the scrollbars if there has been a change in metrics.
|
|
86
|
+
var resizeH = false;
|
|
87
|
+
var resizeV = false;
|
|
88
|
+
if (!this.oldHostMetrics_ ||
|
|
89
|
+
this.oldHostMetrics_.viewWidth != hostMetrics.viewWidth ||
|
|
90
|
+
this.oldHostMetrics_.viewHeight != hostMetrics.viewHeight ||
|
|
91
|
+
this.oldHostMetrics_.absoluteTop != hostMetrics.absoluteTop ||
|
|
92
|
+
this.oldHostMetrics_.absoluteLeft != hostMetrics.absoluteLeft) {
|
|
93
|
+
// The window has been resized or repositioned.
|
|
94
|
+
resizeH = true;
|
|
95
|
+
resizeV = true;
|
|
96
|
+
} else {
|
|
97
|
+
// Has the content been resized or moved?
|
|
98
|
+
if (!this.oldHostMetrics_ ||
|
|
99
|
+
this.oldHostMetrics_.contentWidth != hostMetrics.contentWidth ||
|
|
100
|
+
this.oldHostMetrics_.viewLeft != hostMetrics.viewLeft ||
|
|
101
|
+
this.oldHostMetrics_.contentLeft != hostMetrics.contentLeft) {
|
|
102
|
+
resizeH = true;
|
|
103
|
+
}
|
|
104
|
+
if (!this.oldHostMetrics_ ||
|
|
105
|
+
this.oldHostMetrics_.contentHeight != hostMetrics.contentHeight ||
|
|
106
|
+
this.oldHostMetrics_.viewTop != hostMetrics.viewTop ||
|
|
107
|
+
this.oldHostMetrics_.contentTop != hostMetrics.contentTop) {
|
|
108
|
+
resizeV = true;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (resizeH || resizeV) {
|
|
112
|
+
try {
|
|
113
|
+
Blockly.Events.disable();
|
|
114
|
+
if (resizeH) {
|
|
115
|
+
this.hScroll.resize(hostMetrics);
|
|
116
|
+
}
|
|
117
|
+
if (resizeV) {
|
|
118
|
+
this.vScroll.resize(hostMetrics);
|
|
119
|
+
}
|
|
120
|
+
} finally {
|
|
121
|
+
Blockly.Events.enable();
|
|
122
|
+
}
|
|
123
|
+
this.workspace_.maybeFireViewportChangeEvent();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Reposition the corner square.
|
|
127
|
+
if (!this.oldHostMetrics_ ||
|
|
128
|
+
this.oldHostMetrics_.viewWidth != hostMetrics.viewWidth ||
|
|
129
|
+
this.oldHostMetrics_.absoluteLeft != hostMetrics.absoluteLeft) {
|
|
130
|
+
this.corner_.setAttribute('x', this.vScroll.position.x);
|
|
131
|
+
}
|
|
132
|
+
if (!this.oldHostMetrics_ ||
|
|
133
|
+
this.oldHostMetrics_.viewHeight != hostMetrics.viewHeight ||
|
|
134
|
+
this.oldHostMetrics_.absoluteTop != hostMetrics.absoluteTop) {
|
|
135
|
+
this.corner_.setAttribute('y', this.hScroll.position.y);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Cache the current metrics to potentially short-cut the next resize event.
|
|
139
|
+
this.oldHostMetrics_ = hostMetrics;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Set the handles of both scrollbars to be at a certain position in CSS pixels
|
|
144
|
+
* relative to their parents.
|
|
145
|
+
* @param {number} x Horizontal scroll value.
|
|
146
|
+
* @param {number} y Vertical scroll value.
|
|
147
|
+
*/
|
|
148
|
+
Blockly.ScrollbarPair.prototype.set = function(x, y) {
|
|
149
|
+
// This function is equivalent to:
|
|
150
|
+
// this.hScroll.set(x);
|
|
151
|
+
// this.vScroll.set(y);
|
|
152
|
+
// However, that calls setMetrics twice which causes a chain of
|
|
153
|
+
// getAttribute->setAttribute->getAttribute resulting in an extra layout pass.
|
|
154
|
+
// Combining them speeds up rendering.
|
|
155
|
+
var xyRatio = {};
|
|
156
|
+
|
|
157
|
+
var hHandlePosition = x * this.hScroll.ratio;
|
|
158
|
+
var vHandlePosition = y * this.vScroll.ratio;
|
|
159
|
+
|
|
160
|
+
var hBarLength = this.hScroll.scrollViewSize_;
|
|
161
|
+
var vBarLength = this.vScroll.scrollViewSize_;
|
|
162
|
+
|
|
163
|
+
xyRatio.x = this.getRatio_(hHandlePosition, hBarLength);
|
|
164
|
+
xyRatio.y = this.getRatio_(vHandlePosition, vBarLength);
|
|
165
|
+
this.workspace_.setMetrics(xyRatio);
|
|
166
|
+
|
|
167
|
+
this.hScroll.setHandlePosition(hHandlePosition);
|
|
168
|
+
this.vScroll.setHandlePosition(vHandlePosition);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Helper to calculate the ratio of handle position to scrollbar view size.
|
|
173
|
+
* @param {number} handlePosition The value of the handle.
|
|
174
|
+
* @param {number} viewSize The total size of the scrollbar's view.
|
|
175
|
+
* @return {number} Ratio.
|
|
176
|
+
* @private
|
|
177
|
+
*/
|
|
178
|
+
Blockly.ScrollbarPair.prototype.getRatio_ = function(handlePosition, viewSize) {
|
|
179
|
+
var ratio = handlePosition / viewSize;
|
|
180
|
+
if (isNaN(ratio)) {
|
|
181
|
+
return 0;
|
|
182
|
+
}
|
|
183
|
+
return ratio;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// --------------------------------------------------------------------
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Class for a pure SVG scrollbar.
|
|
190
|
+
* This technique offers a scrollbar that is guaranteed to work, but may not
|
|
191
|
+
* look or behave like the system's scrollbars.
|
|
192
|
+
* @param {!Blockly.WorkspaceSvg} workspace Workspace to bind the scrollbar to.
|
|
193
|
+
* @param {boolean} horizontal True if horizontal, false if vertical.
|
|
194
|
+
* @param {boolean=} opt_pair True if scrollbar is part of a horiz/vert pair.
|
|
195
|
+
* @param {string=} opt_class A class to be applied to this scrollbar.
|
|
196
|
+
* @constructor
|
|
197
|
+
*/
|
|
198
|
+
Blockly.Scrollbar = function(workspace, horizontal, opt_pair, opt_class) {
|
|
199
|
+
this.workspace_ = workspace;
|
|
200
|
+
this.pair_ = opt_pair || false;
|
|
201
|
+
this.horizontal_ = horizontal;
|
|
202
|
+
this.oldHostMetrics_ = null;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @type {?number}
|
|
206
|
+
* @package
|
|
207
|
+
*/
|
|
208
|
+
this.ratio = null;
|
|
209
|
+
|
|
210
|
+
this.createDom_(opt_class);
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* The upper left corner of the scrollbar's SVG group in CSS pixels relative
|
|
214
|
+
* to the scrollbar's origin. This is usually relative to the injection div
|
|
215
|
+
* origin.
|
|
216
|
+
* @type {Blockly.utils.Coordinate}
|
|
217
|
+
* @package
|
|
218
|
+
*/
|
|
219
|
+
this.position = new Blockly.utils.Coordinate(0, 0);
|
|
220
|
+
|
|
221
|
+
// Store the thickness in a temp variable for readability.
|
|
222
|
+
var scrollbarThickness = Blockly.Scrollbar.scrollbarThickness;
|
|
223
|
+
if (horizontal) {
|
|
224
|
+
this.svgBackground_.setAttribute('height', scrollbarThickness);
|
|
225
|
+
this.outerSvg_.setAttribute('height', scrollbarThickness);
|
|
226
|
+
this.svgHandle_.setAttribute('height', scrollbarThickness - 5);
|
|
227
|
+
this.svgHandle_.setAttribute('y', 2.5);
|
|
228
|
+
|
|
229
|
+
this.lengthAttribute_ = 'width';
|
|
230
|
+
this.positionAttribute_ = 'x';
|
|
231
|
+
} else {
|
|
232
|
+
this.svgBackground_.setAttribute('width', scrollbarThickness);
|
|
233
|
+
this.outerSvg_.setAttribute('width', scrollbarThickness);
|
|
234
|
+
this.svgHandle_.setAttribute('width', scrollbarThickness - 5);
|
|
235
|
+
this.svgHandle_.setAttribute('x', 2.5);
|
|
236
|
+
|
|
237
|
+
this.lengthAttribute_ = 'height';
|
|
238
|
+
this.positionAttribute_ = 'y';
|
|
239
|
+
}
|
|
240
|
+
var scrollbar = this;
|
|
241
|
+
this.onMouseDownBarWrapper_ = Blockly.bindEventWithChecks_(
|
|
242
|
+
this.svgBackground_, 'mousedown', scrollbar, scrollbar.onMouseDownBar_);
|
|
243
|
+
this.onMouseDownHandleWrapper_ = Blockly.bindEventWithChecks_(this.svgHandle_,
|
|
244
|
+
'mousedown', scrollbar, scrollbar.onMouseDownHandle_);
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* The location of the origin of the workspace that the scrollbar is in,
|
|
249
|
+
* measured in CSS pixels relative to the injection div origin. This is usually
|
|
250
|
+
* (0, 0). When the scrollbar is in a flyout it may have a different origin.
|
|
251
|
+
* @type {Blockly.utils.Coordinate}
|
|
252
|
+
* @private
|
|
253
|
+
*/
|
|
254
|
+
Blockly.Scrollbar.prototype.origin_ = new Blockly.utils.Coordinate(0, 0);
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* The position of the mouse along this scrollbar's major axis at the start of
|
|
258
|
+
* the most recent drag.
|
|
259
|
+
* Units are CSS pixels, with (0, 0) at the top left of the browser window.
|
|
260
|
+
* For a horizontal scrollbar this is the x coordinate of the mouse down event;
|
|
261
|
+
* for a vertical scrollbar it's the y coordinate of the mouse down event.
|
|
262
|
+
* @type {number}
|
|
263
|
+
* @private
|
|
264
|
+
*/
|
|
265
|
+
Blockly.Scrollbar.prototype.startDragMouse_ = 0;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* The size of the area within which the scrollbar handle can move, in CSS
|
|
269
|
+
* pixels.
|
|
270
|
+
* @type {number}
|
|
271
|
+
* @private
|
|
272
|
+
*/
|
|
273
|
+
Blockly.Scrollbar.prototype.scrollViewSize_ = 0;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* The length of the scrollbar handle in CSS pixels.
|
|
277
|
+
* @type {number}
|
|
278
|
+
* @private
|
|
279
|
+
*/
|
|
280
|
+
Blockly.Scrollbar.prototype.handleLength_ = 0;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* The offset of the start of the handle from the scrollbar position, in CSS
|
|
284
|
+
* pixels.
|
|
285
|
+
* @type {number}
|
|
286
|
+
* @private
|
|
287
|
+
*/
|
|
288
|
+
Blockly.Scrollbar.prototype.handlePosition_ = 0;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Whether the scrollbar handle is visible.
|
|
292
|
+
* @type {boolean}
|
|
293
|
+
* @private
|
|
294
|
+
*/
|
|
295
|
+
Blockly.Scrollbar.prototype.isVisible_ = true;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Whether the workspace containing this scrollbar is visible.
|
|
299
|
+
* @type {boolean}
|
|
300
|
+
* @private
|
|
301
|
+
*/
|
|
302
|
+
Blockly.Scrollbar.prototype.containerVisible_ = true;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Width of vertical scrollbar or height of horizontal scrollbar in CSS pixels.
|
|
306
|
+
* Scrollbars should be larger on touch devices.
|
|
307
|
+
*/
|
|
308
|
+
Blockly.Scrollbar.scrollbarThickness = 15;
|
|
309
|
+
if (Blockly.Touch.TOUCH_ENABLED) {
|
|
310
|
+
Blockly.Scrollbar.scrollbarThickness = 25;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* @param {Blockly.utils.Metrics} first An object containing computed
|
|
315
|
+
* measurements of a workspace.
|
|
316
|
+
* @param {Blockly.utils.Metrics} second Another object containing computed
|
|
317
|
+
* measurements of a workspace.
|
|
318
|
+
* @return {boolean} Whether the two sets of metrics are equivalent.
|
|
319
|
+
* @private
|
|
320
|
+
*/
|
|
321
|
+
Blockly.Scrollbar.metricsAreEquivalent_ = function(first, second) {
|
|
322
|
+
if (!(first && second)) {
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (first.viewWidth != second.viewWidth ||
|
|
327
|
+
first.viewHeight != second.viewHeight ||
|
|
328
|
+
first.viewLeft != second.viewLeft ||
|
|
329
|
+
first.viewTop != second.viewTop ||
|
|
330
|
+
first.absoluteTop != second.absoluteTop ||
|
|
331
|
+
first.absoluteLeft != second.absoluteLeft ||
|
|
332
|
+
first.contentWidth != second.contentWidth ||
|
|
333
|
+
first.contentHeight != second.contentHeight ||
|
|
334
|
+
first.contentLeft != second.contentLeft ||
|
|
335
|
+
first.contentTop != second.contentTop) {
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return true;
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Dispose of this scrollbar.
|
|
344
|
+
* Unlink from all DOM elements to prevent memory leaks.
|
|
345
|
+
*/
|
|
346
|
+
Blockly.Scrollbar.prototype.dispose = function() {
|
|
347
|
+
this.cleanUp_();
|
|
348
|
+
Blockly.unbindEvent_(this.onMouseDownBarWrapper_);
|
|
349
|
+
this.onMouseDownBarWrapper_ = null;
|
|
350
|
+
Blockly.unbindEvent_(this.onMouseDownHandleWrapper_);
|
|
351
|
+
this.onMouseDownHandleWrapper_ = null;
|
|
352
|
+
|
|
353
|
+
Blockly.utils.dom.removeNode(this.outerSvg_);
|
|
354
|
+
this.outerSvg_ = null;
|
|
355
|
+
this.svgGroup_ = null;
|
|
356
|
+
this.svgBackground_ = null;
|
|
357
|
+
if (this.svgHandle_) {
|
|
358
|
+
this.workspace_.getThemeManager().unsubscribe(this.svgHandle_);
|
|
359
|
+
this.svgHandle_ = null;
|
|
360
|
+
}
|
|
361
|
+
this.workspace_ = null;
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Set the length of the scrollbar's handle and change the SVG attribute
|
|
366
|
+
* accordingly.
|
|
367
|
+
* @param {number} newLength The new scrollbar handle length in CSS pixels.
|
|
368
|
+
* @private
|
|
369
|
+
*/
|
|
370
|
+
Blockly.Scrollbar.prototype.setHandleLength_ = function(newLength) {
|
|
371
|
+
this.handleLength_ = newLength;
|
|
372
|
+
this.svgHandle_.setAttribute(this.lengthAttribute_, this.handleLength_);
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Set the offset of the scrollbar's handle from the scrollbar's position, and
|
|
377
|
+
* change the SVG attribute accordingly.
|
|
378
|
+
* @param {number} newPosition The new scrollbar handle offset in CSS pixels.
|
|
379
|
+
*/
|
|
380
|
+
Blockly.Scrollbar.prototype.setHandlePosition = function(newPosition) {
|
|
381
|
+
this.handlePosition_ = newPosition;
|
|
382
|
+
this.svgHandle_.setAttribute(this.positionAttribute_, this.handlePosition_);
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Set the size of the scrollbar's background and change the SVG attribute
|
|
387
|
+
* accordingly.
|
|
388
|
+
* @param {number} newSize The new scrollbar background length in CSS pixels.
|
|
389
|
+
* @private
|
|
390
|
+
*/
|
|
391
|
+
Blockly.Scrollbar.prototype.setScrollViewSize_ = function(newSize) {
|
|
392
|
+
this.scrollViewSize_ = newSize;
|
|
393
|
+
this.outerSvg_.setAttribute(this.lengthAttribute_, this.scrollViewSize_);
|
|
394
|
+
this.svgBackground_.setAttribute(this.lengthAttribute_, this.scrollViewSize_);
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Set whether this scrollbar's container is visible.
|
|
399
|
+
* @param {boolean} visible Whether the container is visible.
|
|
400
|
+
*/
|
|
401
|
+
Blockly.ScrollbarPair.prototype.setContainerVisible = function(visible) {
|
|
402
|
+
this.hScroll.setContainerVisible(visible);
|
|
403
|
+
this.vScroll.setContainerVisible(visible);
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Set the position of the scrollbar's SVG group in CSS pixels relative to the
|
|
408
|
+
* scrollbar's origin. This sets the scrollbar's location within the workspace.
|
|
409
|
+
* @param {number} x The new x coordinate.
|
|
410
|
+
* @param {number} y The new y coordinate.
|
|
411
|
+
* @package
|
|
412
|
+
*/
|
|
413
|
+
Blockly.Scrollbar.prototype.setPosition = function(x, y) {
|
|
414
|
+
this.position.x = x;
|
|
415
|
+
this.position.y = y;
|
|
416
|
+
|
|
417
|
+
var tempX = this.position.x + this.origin_.x;
|
|
418
|
+
var tempY = this.position.y + this.origin_.y;
|
|
419
|
+
var transform = 'translate(' + tempX + 'px,' + tempY + 'px)';
|
|
420
|
+
Blockly.utils.dom.setCssTransform(this.outerSvg_, transform);
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Recalculate the scrollbar's location and its length.
|
|
425
|
+
* @param {Blockly.utils.Metrics=} opt_metrics A data structure of from the
|
|
426
|
+
* describing all the required dimensions. If not provided, it will be
|
|
427
|
+
* fetched from the host object.
|
|
428
|
+
*/
|
|
429
|
+
Blockly.Scrollbar.prototype.resize = function(opt_metrics) {
|
|
430
|
+
// Determine the location, height and width of the host element.
|
|
431
|
+
var hostMetrics = opt_metrics;
|
|
432
|
+
if (!hostMetrics) {
|
|
433
|
+
hostMetrics = this.workspace_.getMetrics();
|
|
434
|
+
if (!hostMetrics) {
|
|
435
|
+
// Host element is likely not visible.
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
if (Blockly.Scrollbar.metricsAreEquivalent_(hostMetrics,
|
|
441
|
+
this.oldHostMetrics_)) {
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
this.oldHostMetrics_ = hostMetrics;
|
|
445
|
+
|
|
446
|
+
/* hostMetrics is an object with the following properties.
|
|
447
|
+
* .viewHeight: Height of the visible rectangle,
|
|
448
|
+
* .viewWidth: Width of the visible rectangle,
|
|
449
|
+
* .contentHeight: Height of the contents,
|
|
450
|
+
* .contentWidth: Width of the content,
|
|
451
|
+
* .viewTop: Offset of top edge of visible rectangle from parent,
|
|
452
|
+
* .viewLeft: Offset of left edge of visible rectangle from parent,
|
|
453
|
+
* .contentTop: Offset of the top-most content from the y=0 coordinate,
|
|
454
|
+
* .contentLeft: Offset of the left-most content from the x=0 coordinate,
|
|
455
|
+
* .absoluteTop: Top-edge of view.
|
|
456
|
+
* .absoluteLeft: Left-edge of view.
|
|
457
|
+
*/
|
|
458
|
+
if (this.horizontal_) {
|
|
459
|
+
this.resizeHorizontal_(hostMetrics);
|
|
460
|
+
} else {
|
|
461
|
+
this.resizeVertical_(hostMetrics);
|
|
462
|
+
}
|
|
463
|
+
// Resizing may have caused some scrolling.
|
|
464
|
+
this.onScroll_();
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Recalculate a horizontal scrollbar's location and length.
|
|
469
|
+
* @param {!Blockly.utils.Metrics} hostMetrics A data structure describing all
|
|
470
|
+
* the required dimensions, possibly fetched from the host object.
|
|
471
|
+
* @private
|
|
472
|
+
*/
|
|
473
|
+
Blockly.Scrollbar.prototype.resizeHorizontal_ = function(hostMetrics) {
|
|
474
|
+
// TODO: Inspect metrics to determine if we can get away with just a content
|
|
475
|
+
// resize.
|
|
476
|
+
this.resizeViewHorizontal(hostMetrics);
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Recalculate a horizontal scrollbar's location on the screen and path length.
|
|
481
|
+
* This should be called when the layout or size of the window has changed.
|
|
482
|
+
* @param {!Blockly.utils.Metrics} hostMetrics A data structure describing all
|
|
483
|
+
* the required dimensions, possibly fetched from the host object.
|
|
484
|
+
*/
|
|
485
|
+
Blockly.Scrollbar.prototype.resizeViewHorizontal = function(hostMetrics) {
|
|
486
|
+
var viewSize = hostMetrics.viewWidth - 1;
|
|
487
|
+
if (this.pair_) {
|
|
488
|
+
// Shorten the scrollbar to make room for the corner square.
|
|
489
|
+
viewSize -= Blockly.Scrollbar.scrollbarThickness;
|
|
490
|
+
}
|
|
491
|
+
this.setScrollViewSize_(Math.max(0, viewSize));
|
|
492
|
+
|
|
493
|
+
var xCoordinate = hostMetrics.absoluteLeft + 0.5;
|
|
494
|
+
if (this.pair_ && this.workspace_.RTL) {
|
|
495
|
+
xCoordinate += Blockly.Scrollbar.scrollbarThickness;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// Horizontal toolbar should always be just above the bottom of the workspace.
|
|
499
|
+
var yCoordinate = hostMetrics.absoluteTop + hostMetrics.viewHeight -
|
|
500
|
+
Blockly.Scrollbar.scrollbarThickness - 0.5;
|
|
501
|
+
this.setPosition(xCoordinate, yCoordinate);
|
|
502
|
+
|
|
503
|
+
// If the view has been resized, a content resize will also be necessary. The
|
|
504
|
+
// reverse is not true.
|
|
505
|
+
this.resizeContentHorizontal(hostMetrics);
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Recalculate a horizontal scrollbar's location within its path and length.
|
|
510
|
+
* This should be called when the contents of the workspace have changed.
|
|
511
|
+
* @param {!Blockly.utils.Metrics} hostMetrics A data structure describing all
|
|
512
|
+
* the required dimensions, possibly fetched from the host object.
|
|
513
|
+
*/
|
|
514
|
+
Blockly.Scrollbar.prototype.resizeContentHorizontal = function(hostMetrics) {
|
|
515
|
+
if (!this.pair_) {
|
|
516
|
+
// Only show the scrollbar if needed.
|
|
517
|
+
// Ideally this would also apply to scrollbar pairs, but that's a bigger
|
|
518
|
+
// headache (due to interactions with the corner square).
|
|
519
|
+
this.setVisible(this.scrollViewSize_ < hostMetrics.contentWidth);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
this.ratio = this.scrollViewSize_ / hostMetrics.contentWidth;
|
|
523
|
+
if (this.ratio == -Infinity || this.ratio == Infinity ||
|
|
524
|
+
isNaN(this.ratio)) {
|
|
525
|
+
this.ratio = 0;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
var handleLength = hostMetrics.viewWidth * this.ratio;
|
|
529
|
+
this.setHandleLength_(Math.max(0, handleLength));
|
|
530
|
+
|
|
531
|
+
var handlePosition = (hostMetrics.viewLeft - hostMetrics.contentLeft) *
|
|
532
|
+
this.ratio;
|
|
533
|
+
this.setHandlePosition(this.constrainHandle_(handlePosition));
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Recalculate a vertical scrollbar's location and length.
|
|
538
|
+
* @param {!Blockly.utils.Metrics} hostMetrics A data structure describing all
|
|
539
|
+
* the required dimensions, possibly fetched from the host object.
|
|
540
|
+
* @private
|
|
541
|
+
*/
|
|
542
|
+
Blockly.Scrollbar.prototype.resizeVertical_ = function(hostMetrics) {
|
|
543
|
+
// TODO: Inspect metrics to determine if we can get away with just a content
|
|
544
|
+
// resize.
|
|
545
|
+
this.resizeViewVertical(hostMetrics);
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Recalculate a vertical scrollbar's location on the screen and path length.
|
|
550
|
+
* This should be called when the layout or size of the window has changed.
|
|
551
|
+
* @param {!Blockly.utils.Metrics} hostMetrics A data structure describing all
|
|
552
|
+
* the required dimensions, possibly fetched from the host object.
|
|
553
|
+
*/
|
|
554
|
+
Blockly.Scrollbar.prototype.resizeViewVertical = function(hostMetrics) {
|
|
555
|
+
var viewSize = hostMetrics.viewHeight - 1;
|
|
556
|
+
if (this.pair_) {
|
|
557
|
+
// Shorten the scrollbar to make room for the corner square.
|
|
558
|
+
viewSize -= Blockly.Scrollbar.scrollbarThickness;
|
|
559
|
+
}
|
|
560
|
+
this.setScrollViewSize_(Math.max(0, viewSize));
|
|
561
|
+
|
|
562
|
+
var xCoordinate = hostMetrics.absoluteLeft + 0.5;
|
|
563
|
+
if (!this.workspace_.RTL) {
|
|
564
|
+
xCoordinate += hostMetrics.viewWidth -
|
|
565
|
+
Blockly.Scrollbar.scrollbarThickness - 1;
|
|
566
|
+
}
|
|
567
|
+
var yCoordinate = hostMetrics.absoluteTop + 0.5;
|
|
568
|
+
this.setPosition(xCoordinate, yCoordinate);
|
|
569
|
+
|
|
570
|
+
// If the view has been resized, a content resize will also be necessary. The
|
|
571
|
+
// reverse is not true.
|
|
572
|
+
this.resizeContentVertical(hostMetrics);
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Recalculate a vertical scrollbar's location within its path and length.
|
|
577
|
+
* This should be called when the contents of the workspace have changed.
|
|
578
|
+
* @param {!Blockly.utils.Metrics} hostMetrics A data structure describing all
|
|
579
|
+
* the required dimensions, possibly fetched from the host object.
|
|
580
|
+
*/
|
|
581
|
+
Blockly.Scrollbar.prototype.resizeContentVertical = function(hostMetrics) {
|
|
582
|
+
if (!this.pair_) {
|
|
583
|
+
// Only show the scrollbar if needed.
|
|
584
|
+
this.setVisible(this.scrollViewSize_ < hostMetrics.contentHeight);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
this.ratio = this.scrollViewSize_ / hostMetrics.contentHeight;
|
|
588
|
+
if (this.ratio == -Infinity || this.ratio == Infinity ||
|
|
589
|
+
isNaN(this.ratio)) {
|
|
590
|
+
this.ratio = 0;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
var handleLength = hostMetrics.viewHeight * this.ratio;
|
|
594
|
+
this.setHandleLength_(Math.max(0, handleLength));
|
|
595
|
+
|
|
596
|
+
var handlePosition = (hostMetrics.viewTop - hostMetrics.contentTop) *
|
|
597
|
+
this.ratio;
|
|
598
|
+
this.setHandlePosition(this.constrainHandle_(handlePosition));
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Create all the DOM elements required for a scrollbar.
|
|
603
|
+
* The resulting widget is not sized.
|
|
604
|
+
* @param {string=} opt_class A class to be applied to this scrollbar.
|
|
605
|
+
* @private
|
|
606
|
+
*/
|
|
607
|
+
Blockly.Scrollbar.prototype.createDom_ = function(opt_class) {
|
|
608
|
+
/* Create the following DOM:
|
|
609
|
+
<svg class="blocklyScrollbarHorizontal optionalClass">
|
|
610
|
+
<g>
|
|
611
|
+
<rect class="blocklyScrollbarBackground" />
|
|
612
|
+
<rect class="blocklyScrollbarHandle" rx="8" ry="8" />
|
|
613
|
+
</g>
|
|
614
|
+
</svg>
|
|
615
|
+
*/
|
|
616
|
+
var className = 'blocklyScrollbar' +
|
|
617
|
+
(this.horizontal_ ? 'Horizontal' : 'Vertical');
|
|
618
|
+
if (opt_class) {
|
|
619
|
+
className += ' ' + opt_class;
|
|
620
|
+
}
|
|
621
|
+
this.outerSvg_ = Blockly.utils.dom.createSvgElement(
|
|
622
|
+
Blockly.utils.Svg.SVG, {'class': className}, null);
|
|
623
|
+
this.svgGroup_ = Blockly.utils.dom.createSvgElement(
|
|
624
|
+
Blockly.utils.Svg.G, {}, this.outerSvg_);
|
|
625
|
+
this.svgBackground_ = Blockly.utils.dom.createSvgElement(
|
|
626
|
+
Blockly.utils.Svg.RECT, {
|
|
627
|
+
'class': 'blocklyScrollbarBackground'
|
|
628
|
+
}, this.svgGroup_);
|
|
629
|
+
var radius = Math.floor((Blockly.Scrollbar.scrollbarThickness - 5) / 2);
|
|
630
|
+
this.svgHandle_ = Blockly.utils.dom.createSvgElement(
|
|
631
|
+
Blockly.utils.Svg.RECT,
|
|
632
|
+
{
|
|
633
|
+
'class': 'blocklyScrollbarHandle',
|
|
634
|
+
'rx': radius,
|
|
635
|
+
'ry': radius
|
|
636
|
+
},
|
|
637
|
+
this.svgGroup_);
|
|
638
|
+
this.workspace_.getThemeManager().subscribe(
|
|
639
|
+
this.svgHandle_, 'scrollbarColour', 'fill');
|
|
640
|
+
this.workspace_.getThemeManager().subscribe(
|
|
641
|
+
this.svgHandle_, 'scrollbarOpacity', 'fill-opacity');
|
|
642
|
+
Blockly.utils.dom.insertAfter(this.outerSvg_,
|
|
643
|
+
this.workspace_.getParentSvg());
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* Is the scrollbar visible. Non-paired scrollbars disappear when they aren't
|
|
648
|
+
* needed.
|
|
649
|
+
* @return {boolean} True if visible.
|
|
650
|
+
*/
|
|
651
|
+
Blockly.Scrollbar.prototype.isVisible = function() {
|
|
652
|
+
return this.isVisible_;
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Set whether the scrollbar's container is visible and update
|
|
657
|
+
* display accordingly if visibility has changed.
|
|
658
|
+
* @param {boolean} visible Whether the container is visible
|
|
659
|
+
*/
|
|
660
|
+
Blockly.Scrollbar.prototype.setContainerVisible = function(visible) {
|
|
661
|
+
var visibilityChanged = (visible != this.containerVisible_);
|
|
662
|
+
|
|
663
|
+
this.containerVisible_ = visible;
|
|
664
|
+
if (visibilityChanged) {
|
|
665
|
+
this.updateDisplay_();
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Set whether the scrollbar is visible.
|
|
671
|
+
* Only applies to non-paired scrollbars.
|
|
672
|
+
* @param {boolean} visible True if visible.
|
|
673
|
+
*/
|
|
674
|
+
Blockly.Scrollbar.prototype.setVisible = function(visible) {
|
|
675
|
+
var visibilityChanged = (visible != this.isVisible());
|
|
676
|
+
|
|
677
|
+
// Ideally this would also apply to scrollbar pairs, but that's a bigger
|
|
678
|
+
// headache (due to interactions with the corner square).
|
|
679
|
+
if (this.pair_) {
|
|
680
|
+
throw Error('Unable to toggle visibility of paired scrollbars.');
|
|
681
|
+
}
|
|
682
|
+
this.isVisible_ = visible;
|
|
683
|
+
if (visibilityChanged) {
|
|
684
|
+
this.updateDisplay_();
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Update visibility of scrollbar based on whether it thinks it should
|
|
690
|
+
* be visible and whether its containing workspace is visible.
|
|
691
|
+
* We cannot rely on the containing workspace being hidden to hide us
|
|
692
|
+
* because it is not necessarily our parent in the DOM.
|
|
693
|
+
*/
|
|
694
|
+
Blockly.Scrollbar.prototype.updateDisplay_ = function() {
|
|
695
|
+
var show = true;
|
|
696
|
+
// Check whether our parent/container is visible.
|
|
697
|
+
if (!this.containerVisible_) {
|
|
698
|
+
show = false;
|
|
699
|
+
} else {
|
|
700
|
+
show = this.isVisible();
|
|
701
|
+
}
|
|
702
|
+
if (show) {
|
|
703
|
+
this.outerSvg_.setAttribute('display', 'block');
|
|
704
|
+
} else {
|
|
705
|
+
this.outerSvg_.setAttribute('display', 'none');
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Scroll by one pageful.
|
|
711
|
+
* Called when scrollbar background is clicked.
|
|
712
|
+
* @param {!Event} e Mouse down event.
|
|
713
|
+
* @private
|
|
714
|
+
*/
|
|
715
|
+
Blockly.Scrollbar.prototype.onMouseDownBar_ = function(e) {
|
|
716
|
+
this.workspace_.markFocused();
|
|
717
|
+
Blockly.Touch.clearTouchIdentifier(); // This is really a click.
|
|
718
|
+
this.cleanUp_();
|
|
719
|
+
if (Blockly.utils.isRightButton(e)) {
|
|
720
|
+
// Right-click.
|
|
721
|
+
// Scrollbars have no context menu.
|
|
722
|
+
e.stopPropagation();
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
var mouseXY = Blockly.utils.mouseToSvg(e,
|
|
726
|
+
this.workspace_.getParentSvg(),
|
|
727
|
+
this.workspace_.getInverseScreenCTM());
|
|
728
|
+
var mouseLocation = this.horizontal_ ? mouseXY.x : mouseXY.y;
|
|
729
|
+
|
|
730
|
+
var handleXY = Blockly.utils.getInjectionDivXY_(this.svgHandle_);
|
|
731
|
+
var handleStart = this.horizontal_ ? handleXY.x : handleXY.y;
|
|
732
|
+
var handlePosition = this.handlePosition_;
|
|
733
|
+
|
|
734
|
+
var pageLength = this.handleLength_ * 0.95;
|
|
735
|
+
if (mouseLocation <= handleStart) {
|
|
736
|
+
// Decrease the scrollbar's value by a page.
|
|
737
|
+
handlePosition -= pageLength;
|
|
738
|
+
} else if (mouseLocation >= handleStart + this.handleLength_) {
|
|
739
|
+
// Increase the scrollbar's value by a page.
|
|
740
|
+
handlePosition += pageLength;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
this.setHandlePosition(this.constrainHandle_(handlePosition));
|
|
744
|
+
|
|
745
|
+
this.onScroll_();
|
|
746
|
+
e.stopPropagation();
|
|
747
|
+
e.preventDefault();
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Start a dragging operation.
|
|
752
|
+
* Called when scrollbar handle is clicked.
|
|
753
|
+
* @param {!Event} e Mouse down event.
|
|
754
|
+
* @private
|
|
755
|
+
*/
|
|
756
|
+
Blockly.Scrollbar.prototype.onMouseDownHandle_ = function(e) {
|
|
757
|
+
this.workspace_.markFocused();
|
|
758
|
+
this.cleanUp_();
|
|
759
|
+
if (Blockly.utils.isRightButton(e)) {
|
|
760
|
+
// Right-click.
|
|
761
|
+
// Scrollbars have no context menu.
|
|
762
|
+
e.stopPropagation();
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
// Look up the current translation and record it.
|
|
766
|
+
this.startDragHandle = this.handlePosition_;
|
|
767
|
+
|
|
768
|
+
// Tell the workspace to setup its drag surface since it is about to move.
|
|
769
|
+
// onMouseMoveHandle will call onScroll which actually tells the workspace
|
|
770
|
+
// to move.
|
|
771
|
+
this.workspace_.setupDragSurface();
|
|
772
|
+
|
|
773
|
+
// Record the current mouse position.
|
|
774
|
+
this.startDragMouse_ = this.horizontal_ ? e.clientX : e.clientY;
|
|
775
|
+
Blockly.Scrollbar.onMouseUpWrapper_ = Blockly.bindEventWithChecks_(document,
|
|
776
|
+
'mouseup', this, this.onMouseUpHandle_);
|
|
777
|
+
Blockly.Scrollbar.onMouseMoveWrapper_ = Blockly.bindEventWithChecks_(document,
|
|
778
|
+
'mousemove', this, this.onMouseMoveHandle_);
|
|
779
|
+
e.stopPropagation();
|
|
780
|
+
e.preventDefault();
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Drag the scrollbar's handle.
|
|
785
|
+
* @param {!Event} e Mouse up event.
|
|
786
|
+
* @private
|
|
787
|
+
*/
|
|
788
|
+
Blockly.Scrollbar.prototype.onMouseMoveHandle_ = function(e) {
|
|
789
|
+
var currentMouse = this.horizontal_ ? e.clientX : e.clientY;
|
|
790
|
+
var mouseDelta = currentMouse - this.startDragMouse_;
|
|
791
|
+
var handlePosition = this.startDragHandle + mouseDelta;
|
|
792
|
+
// Position the bar.
|
|
793
|
+
this.setHandlePosition(this.constrainHandle_(handlePosition));
|
|
794
|
+
this.onScroll_();
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Release the scrollbar handle and reset state accordingly.
|
|
799
|
+
* @private
|
|
800
|
+
*/
|
|
801
|
+
Blockly.Scrollbar.prototype.onMouseUpHandle_ = function() {
|
|
802
|
+
// Tell the workspace to clean up now that the workspace is done moving.
|
|
803
|
+
this.workspace_.resetDragSurface();
|
|
804
|
+
Blockly.Touch.clearTouchIdentifier();
|
|
805
|
+
this.cleanUp_();
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Hide chaff and stop binding to mouseup and mousemove events. Call this to
|
|
810
|
+
* wrap up loose ends associated with the scrollbar.
|
|
811
|
+
* @private
|
|
812
|
+
*/
|
|
813
|
+
Blockly.Scrollbar.prototype.cleanUp_ = function() {
|
|
814
|
+
Blockly.hideChaff(true);
|
|
815
|
+
if (Blockly.Scrollbar.onMouseUpWrapper_) {
|
|
816
|
+
Blockly.unbindEvent_(Blockly.Scrollbar.onMouseUpWrapper_);
|
|
817
|
+
Blockly.Scrollbar.onMouseUpWrapper_ = null;
|
|
818
|
+
}
|
|
819
|
+
if (Blockly.Scrollbar.onMouseMoveWrapper_) {
|
|
820
|
+
Blockly.unbindEvent_(Blockly.Scrollbar.onMouseMoveWrapper_);
|
|
821
|
+
Blockly.Scrollbar.onMouseMoveWrapper_ = null;
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* Constrain the handle's position within the minimum (0) and maximum
|
|
827
|
+
* (length of scrollbar) values allowed for the scrollbar.
|
|
828
|
+
* @param {number} value Value that is potentially out of bounds, in CSS pixels.
|
|
829
|
+
* @return {number} Constrained value, in CSS pixels.
|
|
830
|
+
* @private
|
|
831
|
+
*/
|
|
832
|
+
Blockly.Scrollbar.prototype.constrainHandle_ = function(value) {
|
|
833
|
+
if (value <= 0 || isNaN(value) || this.scrollViewSize_ < this.handleLength_) {
|
|
834
|
+
value = 0;
|
|
835
|
+
} else {
|
|
836
|
+
value = Math.min(value, this.scrollViewSize_ - this.handleLength_);
|
|
837
|
+
}
|
|
838
|
+
return value;
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Called when scrollbar is moved.
|
|
843
|
+
* @private
|
|
844
|
+
*/
|
|
845
|
+
Blockly.Scrollbar.prototype.onScroll_ = function() {
|
|
846
|
+
var ratio = this.handlePosition_ / this.scrollViewSize_;
|
|
847
|
+
if (isNaN(ratio)) {
|
|
848
|
+
ratio = 0;
|
|
849
|
+
}
|
|
850
|
+
var xyRatio = {};
|
|
851
|
+
if (this.horizontal_) {
|
|
852
|
+
xyRatio.x = ratio;
|
|
853
|
+
} else {
|
|
854
|
+
xyRatio.y = ratio;
|
|
855
|
+
}
|
|
856
|
+
this.workspace_.setMetrics(xyRatio);
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* Set the scrollbar handle's position.
|
|
861
|
+
* @param {number} value The distance from the top/left end of the bar, in CSS
|
|
862
|
+
* pixels. It may be larger than the maximum allowable position of the
|
|
863
|
+
* scrollbar handle.
|
|
864
|
+
*/
|
|
865
|
+
Blockly.Scrollbar.prototype.set = function(value) {
|
|
866
|
+
this.setHandlePosition(this.constrainHandle_(value * this.ratio));
|
|
867
|
+
this.onScroll_();
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Record the origin of the workspace that the scrollbar is in, in pixels
|
|
872
|
+
* relative to the injection div origin. This is for times when the scrollbar is
|
|
873
|
+
* used in an object whose origin isn't the same as the main workspace
|
|
874
|
+
* (e.g. in a flyout.)
|
|
875
|
+
* @param {number} x The x coordinate of the scrollbar's origin, in CSS pixels.
|
|
876
|
+
* @param {number} y The y coordinate of the scrollbar's origin, in CSS pixels.
|
|
877
|
+
*/
|
|
878
|
+
Blockly.Scrollbar.prototype.setOrigin = function(x, y) {
|
|
879
|
+
this.origin_ = new Blockly.utils.Coordinate(x, y);
|
|
880
|
+
};
|