@datagrok/helm 2.3.2 → 2.3.4
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/CHANGELOG.md +20 -0
- package/dist/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +4 -4
- package/src/cell-renderer.ts +5 -4
- package/src/helm-helper.ts +6 -6
- package/src/helm-monomer-placer.ts +1 -1
- package/src/helm-web-editor.ts +5 -5
- package/src/package-test.ts +0 -1
- package/src/package-utils.ts +211 -69
- package/src/package.ts +10 -71
- package/src/tests/findMonomers-tests.ts +2 -1
- package/src/tests/get-monomer-tests.ts +1 -49
- package/src/tests/helm-input-tests.ts +31 -20
- package/src/utils/get-monomer.ts +49 -1
- package/src/utils/helm-grid-cell-renderer.ts +8 -9
- package/src/utils/index.ts +2 -3
- package/src/widgets/helm-input.ts +4 -4
- package/vendor/dojo-1.10.10/dijit/BackgroundIframe.js +63 -0
- package/vendor/dojo-1.10.10/dijit/BackgroundIframe.js.uncompressed.js +116 -0
- package/vendor/dojo-1.10.10/dijit/Destroyable.js +35 -0
- package/vendor/dojo-1.10.10/dijit/Destroyable.js.uncompressed.js +83 -0
- package/vendor/dojo-1.10.10/dijit/Tooltip.js +240 -0
- package/vendor/dojo-1.10.10/dijit/Tooltip.js.uncompressed.js +612 -0
- package/vendor/dojo-1.10.10/dijit/Viewport.js +44 -0
- package/vendor/dojo-1.10.10/dijit/Viewport.js.uncompressed.js +87 -0
- package/vendor/dojo-1.10.10/dijit/WidgetSet.js +76 -0
- package/vendor/dojo-1.10.10/dijit/WidgetSet.js.uncompressed.js +247 -0
- package/vendor/dojo-1.10.10/dijit/_AttachMixin.js +94 -0
- package/vendor/dojo-1.10.10/dijit/_AttachMixin.js.uncompressed.js +238 -0
- package/vendor/dojo-1.10.10/dijit/_Contained.js +17 -0
- package/vendor/dojo-1.10.10/dijit/_Contained.js.uncompressed.js +56 -0
- package/vendor/dojo-1.10.10/dijit/_Container.js +47 -0
- package/vendor/dojo-1.10.10/dijit/_Container.js.uncompressed.js +108 -0
- package/vendor/dojo-1.10.10/dijit/_CssStateMixin.js +198 -0
- package/vendor/dojo-1.10.10/dijit/_CssStateMixin.js.uncompressed.js +372 -0
- package/vendor/dojo-1.10.10/dijit/_FocusMixin.js +11 -0
- package/vendor/dojo-1.10.10/dijit/_FocusMixin.js.uncompressed.js +66 -0
- package/vendor/dojo-1.10.10/dijit/_HasDropDown.js +188 -0
- package/vendor/dojo-1.10.10/dijit/_HasDropDown.js.uncompressed.js +472 -0
- package/vendor/dojo-1.10.10/dijit/_OnDijitClickMixin.js +8 -0
- package/vendor/dojo-1.10.10/dijit/_OnDijitClickMixin.js.uncompressed.js +31 -0
- package/vendor/dojo-1.10.10/dijit/_TemplatedMixin.js +90 -0
- package/vendor/dojo-1.10.10/dijit/_TemplatedMixin.js.uncompressed.js +205 -0
- package/vendor/dojo-1.10.10/dijit/_Widget.js +66 -0
- package/vendor/dojo-1.10.10/dijit/_Widget.js.uncompressed.js +352 -0
- package/vendor/dojo-1.10.10/dijit/_WidgetBase.js +353 -0
- package/vendor/dojo-1.10.10/dijit/_WidgetBase.js.uncompressed.js +1200 -0
- package/vendor/dojo-1.10.10/dijit/_base/focus.js +68 -0
- package/vendor/dojo-1.10.10/dijit/_base/focus.js.uncompressed.js +207 -0
- package/vendor/dojo-1.10.10/dijit/_base/manager.js +10 -0
- package/vendor/dojo-1.10.10/dijit/_base/manager.js.uncompressed.js +35 -0
- package/vendor/dojo-1.10.10/dijit/_base/place.js +52 -0
- package/vendor/dojo-1.10.10/dijit/_base/place.js.uncompressed.js +131 -0
- package/vendor/dojo-1.10.10/dijit/_base/popup.js +23 -0
- package/vendor/dojo-1.10.10/dijit/_base/popup.js.uncompressed.js +58 -0
- package/vendor/dojo-1.10.10/dijit/_base/scroll.js +6 -0
- package/vendor/dojo-1.10.10/dijit/_base/scroll.js.uncompressed.js +22 -0
- package/vendor/dojo-1.10.10/dijit/_base/sniff.js +3 -0
- package/vendor/dojo-1.10.10/dijit/_base/sniff.js.uncompressed.js +12 -0
- package/vendor/dojo-1.10.10/dijit/_base/typematic.js +3 -0
- package/vendor/dojo-1.10.10/dijit/_base/typematic.js.uncompressed.js +10 -0
- package/vendor/dojo-1.10.10/dijit/_base/wai.js +32 -0
- package/vendor/dojo-1.10.10/dijit/_base/wai.js.uncompressed.js +109 -0
- package/vendor/dojo-1.10.10/dijit/_base/window.js +6 -0
- package/vendor/dojo-1.10.10/dijit/_base/window.js.uncompressed.js +18 -0
- package/vendor/dojo-1.10.10/dijit/_base.js +4 -0
- package/vendor/dojo-1.10.10/dijit/a11y.js +109 -0
- package/vendor/dojo-1.10.10/dijit/a11y.js.uncompressed.js +191 -0
- package/vendor/dojo-1.10.10/dijit/a11yclick.js +66 -0
- package/vendor/dojo-1.10.10/dijit/a11yclick.js.uncompressed.js +139 -0
- package/vendor/dojo-1.10.10/dijit/focus.js +188 -0
- package/vendor/dojo-1.10.10/dijit/focus.js.uncompressed.js +371 -0
- package/vendor/dojo-1.10.10/dijit/form/Button.js +49 -0
- package/vendor/dojo-1.10.10/dijit/form/Button.js.uncompressed.js +130 -0
- package/vendor/dojo-1.10.10/dijit/form/ComboBox.js +4 -0
- package/vendor/dojo-1.10.10/dijit/form/ComboBox.js.uncompressed.js +27 -0
- package/vendor/dojo-1.10.10/dijit/form/ComboButton.js +21 -0
- package/vendor/dojo-1.10.10/dijit/form/ComboButton.js.uncompressed.js +86 -0
- package/vendor/dojo-1.10.10/dijit/form/DropDownButton.js +38 -0
- package/vendor/dojo-1.10.10/dijit/form/DropDownButton.js.uncompressed.js +102 -0
- package/vendor/dojo-1.10.10/dijit/form/ToggleButton.js +7 -0
- package/vendor/dojo-1.10.10/dijit/form/ToggleButton.js.uncompressed.js +26 -0
- package/vendor/dojo-1.10.10/dijit/form/_ButtonMixin.js +50 -0
- package/vendor/dojo-1.10.10/dijit/form/_ButtonMixin.js.uncompressed.js +116 -0
- package/vendor/dojo-1.10.10/dijit/form/_FormValueMixin.js +26 -0
- package/vendor/dojo-1.10.10/dijit/form/_FormValueMixin.js.uncompressed.js +81 -0
- package/vendor/dojo-1.10.10/dijit/form/_FormValueWidget.js +24 -0
- package/vendor/dojo-1.10.10/dijit/form/_FormValueWidget.js.uncompressed.js +51 -0
- package/vendor/dojo-1.10.10/dijit/form/_FormWidget.js +22 -0
- package/vendor/dojo-1.10.10/dijit/form/_FormWidget.js.uncompressed.js +67 -0
- package/vendor/dojo-1.10.10/dijit/form/_FormWidgetMixin.js +111 -0
- package/vendor/dojo-1.10.10/dijit/form/_FormWidgetMixin.js.uncompressed.js +254 -0
- package/vendor/dojo-1.10.10/dijit/form/_ToggleButtonMixin.js +32 -0
- package/vendor/dojo-1.10.10/dijit/form/_ToggleButtonMixin.js.uncompressed.js +69 -0
- package/vendor/dojo-1.10.10/dijit/hccss.js +9 -0
- package/vendor/dojo-1.10.10/dijit/hccss.js.uncompressed.js +21 -0
- package/vendor/dojo-1.10.10/dijit/layout/AccordionContainer.js +215 -0
- package/vendor/dojo-1.10.10/dijit/layout/AccordionContainer.js.uncompressed.js +550 -0
- package/vendor/dojo-1.10.10/dijit/layout/AccordionPane.js +7 -0
- package/vendor/dojo-1.10.10/dijit/layout/AccordionPane.js.uncompressed.js +25 -0
- package/vendor/dojo-1.10.10/dijit/layout/ContentPane.js +235 -0
- package/vendor/dojo-1.10.10/dijit/layout/ContentPane.js.uncompressed.js +653 -0
- package/vendor/dojo-1.10.10/dijit/layout/StackContainer.js +171 -0
- package/vendor/dojo-1.10.10/dijit/layout/StackContainer.js.uncompressed.js +411 -0
- package/vendor/dojo-1.10.10/dijit/layout/StackController.js +194 -0
- package/vendor/dojo-1.10.10/dijit/layout/StackController.js.uncompressed.js +410 -0
- package/vendor/dojo-1.10.10/dijit/layout/_ContentPaneResizeMixin.js +99 -0
- package/vendor/dojo-1.10.10/dijit/layout/_ContentPaneResizeMixin.js.uncompressed.js +236 -0
- package/vendor/dojo-1.10.10/dijit/layout/_LayoutWidget.js +47 -0
- package/vendor/dojo-1.10.10/dijit/layout/_LayoutWidget.js.uncompressed.js +190 -0
- package/vendor/dojo-1.10.10/dijit/layout/utils.js +77 -0
- package/vendor/dojo-1.10.10/dijit/layout/utils.js.uncompressed.js +151 -0
- package/vendor/dojo-1.10.10/dijit/main.js +4 -0
- package/vendor/dojo-1.10.10/dijit/main.js.uncompressed.js +16 -0
- package/vendor/dojo-1.10.10/dijit/nls/dijit-all_en-us.js +2 -0
- package/vendor/dojo-1.10.10/dijit/nls/dijit-all_en-us.js.uncompressed.js +21 -0
- package/vendor/dojo-1.10.10/dijit/nls/loading.js +2 -0
- package/vendor/dojo-1.10.10/dijit/nls/loading.js.uncompressed.js +47 -0
- package/vendor/dojo-1.10.10/dijit/place.js +142 -0
- package/vendor/dojo-1.10.10/dijit/place.js.uncompressed.js +407 -0
- package/vendor/dojo-1.10.10/dijit/popup.js +162 -0
- package/vendor/dojo-1.10.10/dijit/popup.js.uncompressed.js +441 -0
- package/vendor/dojo-1.10.10/dijit/registry.js +79 -0
- package/vendor/dojo-1.10.10/dijit/registry.js.uncompressed.js +159 -0
- package/vendor/dojo-1.10.10/dijit/selection.js +364 -0
- package/vendor/dojo-1.10.10/dijit/selection.js.uncompressed.js +525 -0
- package/vendor/dojo-1.10.10/dijit/typematic.js +96 -0
- package/vendor/dojo-1.10.10/dijit/typematic.js.uncompressed.js +211 -0
- package/vendor/dojo-1.10.10/dojo/NodeList-manipulate.js +195 -0
- package/vendor/dojo-1.10.10/dojo/NodeList-manipulate.js.uncompressed.js +761 -0
- package/vendor/dojo-1.10.10/dojo/Stateful.js +90 -0
- package/vendor/dojo-1.10.10/dojo/Stateful.js.uncompressed.js +218 -0
- package/vendor/dojo-1.10.10/dojo/_base/url.js +87 -0
- package/vendor/dojo-1.10.10/dojo/_base/url.js.uncompressed.js +109 -0
- package/vendor/dojo-1.10.10/dojo/cache.js +9 -0
- package/vendor/dojo-1.10.10/dojo/cache.js.uncompressed.js +7 -0
- package/vendor/dojo-1.10.10/dojo/colors.js +74 -0
- package/vendor/dojo-1.10.10/dojo/colors.js.uncompressed.js +232 -0
- package/vendor/dojo-1.10.10/dojo/cookie.js +48 -0
- package/vendor/dojo-1.10.10/dojo/cookie.js.uncompressed.js +98 -0
- package/vendor/dojo-1.10.10/dojo/date/stamp.js +82 -0
- package/vendor/dojo-1.10.10/dojo/date/stamp.js.uncompressed.js +144 -0
- package/vendor/dojo-1.10.10/dojo/dojo.js +7 -0
- package/vendor/dojo-1.10.10/dojo/dojo.js.uncompressed.js +18680 -0
- package/vendor/dojo-1.10.10/dojo/fx/Toggler.js +27 -0
- package/vendor/dojo-1.10.10/dojo/fx/Toggler.js.uncompressed.js +101 -0
- package/vendor/dojo-1.10.10/dojo/fx/easing.js +165 -0
- package/vendor/dojo-1.10.10/dojo/fx/easing.js.uncompressed.js +276 -0
- package/vendor/dojo-1.10.10/dojo/fx.js +271 -0
- package/vendor/dojo-1.10.10/dojo/fx.js.uncompressed.js +443 -0
- package/vendor/dojo-1.10.10/dojo/hccss.js +26 -0
- package/vendor/dojo-1.10.10/dojo/hccss.js.uncompressed.js +52 -0
- package/vendor/dojo-1.10.10/dojo/html.js +161 -0
- package/vendor/dojo-1.10.10/dojo/html.js.uncompressed.js +370 -0
- package/vendor/dojo-1.10.10/dojo/io/iframe.js +71 -0
- package/vendor/dojo-1.10.10/dojo/io/iframe.js.uncompressed.js +190 -0
- package/vendor/dojo-1.10.10/dojo/io/script.js +112 -0
- package/vendor/dojo-1.10.10/dojo/io/script.js.uncompressed.js +280 -0
- package/vendor/dojo-1.10.10/dojo/parser.js +437 -0
- package/vendor/dojo-1.10.10/dojo/parser.js.uncompressed.js +915 -0
- package/vendor/dojo-1.10.10/dojo/promise/all.js +59 -0
- package/vendor/dojo-1.10.10/dojo/promise/all.js.uncompressed.js +77 -0
- package/vendor/dojo-1.10.10/dojo/regexp.js +32 -0
- package/vendor/dojo-1.10.10/dojo/regexp.js.uncompressed.js +70 -0
- package/vendor/dojo-1.10.10/dojo/request/iframe.js +291 -0
- package/vendor/dojo-1.10.10/dojo/request/iframe.js.uncompressed.js +438 -0
- package/vendor/dojo-1.10.10/dojo/request/script.js +129 -0
- package/vendor/dojo-1.10.10/dojo/request/script.js.uncompressed.js +237 -0
- package/vendor/dojo-1.10.10/dojo/require.js +11 -0
- package/vendor/dojo-1.10.10/dojo/require.js.uncompressed.js +7 -0
- package/vendor/dojo-1.10.10/dojo/resources/blank.gif +0 -0
- package/vendor/dojo-1.10.10/dojo/string.js +67 -0
- package/vendor/dojo-1.10.10/dojo/string.js.uncompressed.js +181 -0
- package/vendor/dojo-1.10.10/dojo/touch.js +191 -0
- package/vendor/dojo-1.10.10/dojo/touch.js.uncompressed.js +468 -0
- package/vendor/dojo-1.10.10/dojo/uacss.js +36 -0
- package/vendor/dojo-1.10.10/dojo/uacss.js.uncompressed.js +85 -0
- package/vendor/dojo-1.10.10/dojo/window.js +141 -0
- package/vendor/dojo-1.10.10/dojo/window.js.uncompressed.js +241 -0
- package/vendor/dojo-1.10.10/dojox/charting/Chart.js +626 -0
- package/vendor/dojo-1.10.10/dojox/charting/Chart.js.uncompressed.js +1220 -0
- package/vendor/dojo-1.10.10/dojox/charting/Chart2D.js +5 -0
- package/vendor/dojo-1.10.10/dojox/charting/Chart2D.js.uncompressed.js +16 -0
- package/vendor/dojo-1.10.10/dojox/charting/Element.js +247 -0
- package/vendor/dojo-1.10.10/dojox/charting/Element.js.uncompressed.js +402 -0
- package/vendor/dojo-1.10.10/dojox/charting/Series.js +24 -0
- package/vendor/dojo-1.10.10/dojox/charting/Series.js.uncompressed.js +58 -0
- package/vendor/dojo-1.10.10/dojox/charting/SimpleTheme.js +191 -0
- package/vendor/dojo-1.10.10/dojox/charting/SimpleTheme.js.uncompressed.js +577 -0
- package/vendor/dojo-1.10.10/dojox/charting/Theme.js +42 -0
- package/vendor/dojo-1.10.10/dojox/charting/Theme.js.uncompressed.js +120 -0
- package/vendor/dojo-1.10.10/dojox/charting/action2d/Base.js +11 -0
- package/vendor/dojo-1.10.10/dojox/charting/action2d/Base.js.uncompressed.js +36 -0
- package/vendor/dojo-1.10.10/dojox/charting/action2d/Highlight.js +77 -0
- package/vendor/dojo-1.10.10/dojox/charting/action2d/Highlight.js.uncompressed.js +144 -0
- package/vendor/dojo-1.10.10/dojox/charting/action2d/Magnify.js +58 -0
- package/vendor/dojo-1.10.10/dojox/charting/action2d/Magnify.js.uncompressed.js +123 -0
- package/vendor/dojo-1.10.10/dojox/charting/action2d/MoveSlice.js +54 -0
- package/vendor/dojo-1.10.10/dojox/charting/action2d/MoveSlice.js.uncompressed.js +124 -0
- package/vendor/dojo-1.10.10/dojox/charting/action2d/PlotAction.js +28 -0
- package/vendor/dojo-1.10.10/dojox/charting/action2d/PlotAction.js.uncompressed.js +74 -0
- package/vendor/dojo-1.10.10/dojox/charting/action2d/Tooltip.js +116 -0
- package/vendor/dojo-1.10.10/dojox/charting/action2d/Tooltip.js.uncompressed.js +178 -0
- package/vendor/dojo-1.10.10/dojox/charting/axis2d/Base.js +24 -0
- package/vendor/dojo-1.10.10/dojox/charting/axis2d/Base.js.uncompressed.js +83 -0
- package/vendor/dojo-1.10.10/dojox/charting/axis2d/Default.js +557 -0
- package/vendor/dojo-1.10.10/dojox/charting/axis2d/Default.js.uncompressed.js +980 -0
- package/vendor/dojo-1.10.10/dojox/charting/axis2d/Invisible.js +65 -0
- package/vendor/dojo-1.10.10/dojox/charting/axis2d/Invisible.js.uncompressed.js +224 -0
- package/vendor/dojo-1.10.10/dojox/charting/axis2d/common.js +91 -0
- package/vendor/dojo-1.10.10/dojox/charting/axis2d/common.js.uncompressed.js +164 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Areas.js +7 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Areas.js.uncompressed.js +14 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Bars.js +168 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Bars.js.uncompressed.js +311 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Base.js +61 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Base.js.uncompressed.js +161 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Bubble.js +141 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Bubble.js.uncompressed.js +242 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Candlesticks.js +126 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Candlesticks.js.uncompressed.js +243 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/CartesianBase.js +108 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/CartesianBase.js.uncompressed.js +290 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/ClusteredBars.js +13 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/ClusteredBars.js.uncompressed.js +14 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/ClusteredColumns.js +13 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/ClusteredColumns.js.uncompressed.js +14 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Columns.js +153 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Columns.js.uncompressed.js +249 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Default.js +253 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Default.js.uncompressed.js +472 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Grid.js +182 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Grid.js.uncompressed.js +356 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Lines.js +6 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Lines.js.uncompressed.js +12 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Markers.js +6 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Markers.js.uncompressed.js +12 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/MarkersOnly.js +7 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/MarkersOnly.js.uncompressed.js +13 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/OHLC.js +110 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/OHLC.js.uncompressed.js +208 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Pie.js +303 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Pie.js.uncompressed.js +547 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Scatter.js +134 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Scatter.js.uncompressed.js +207 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Spider.js +299 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Spider.js.uncompressed.js +537 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Stacked.js +24 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/Stacked.js.uncompressed.js +44 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/StackedAreas.js +7 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/StackedAreas.js.uncompressed.js +14 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/StackedBars.js +22 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/StackedBars.js.uncompressed.js +33 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/StackedColumns.js +20 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/StackedColumns.js.uncompressed.js +31 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/StackedLines.js +6 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/StackedLines.js.uncompressed.js +12 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/_PlotEvents.js +68 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/_PlotEvents.js.uncompressed.js +120 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/common.js +209 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/common.js.uncompressed.js +214 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/commonStacked.js +76 -0
- package/vendor/dojo-1.10.10/dojox/charting/plot2d/commonStacked.js.uncompressed.js +77 -0
- package/vendor/dojo-1.10.10/dojox/charting/scaler/common.js +59 -0
- package/vendor/dojo-1.10.10/dojox/charting/scaler/common.js.uncompressed.js +70 -0
- package/vendor/dojo-1.10.10/dojox/charting/scaler/linear.js +220 -0
- package/vendor/dojo-1.10.10/dojox/charting/scaler/linear.js.uncompressed.js +262 -0
- package/vendor/dojo-1.10.10/dojox/charting/scaler/primitive.js +23 -0
- package/vendor/dojo-1.10.10/dojox/charting/scaler/primitive.js.uncompressed.js +36 -0
- package/vendor/dojo-1.10.10/dojox/charting/themes/Claro.js +39 -0
- package/vendor/dojo-1.10.10/dojox/charting/themes/Claro.js.uncompressed.js +106 -0
- package/vendor/dojo-1.10.10/dojox/charting/themes/Wetland.js +5 -0
- package/vendor/dojo-1.10.10/dojox/charting/themes/Wetland.js.uncompressed.js +12 -0
- package/vendor/dojo-1.10.10/dojox/charting/themes/common.js +4 -0
- package/vendor/dojo-1.10.10/dojox/charting/themes/common.js.uncompressed.js +3 -0
- package/vendor/dojo-1.10.10/dojox/charting/widget/Legend.js +102 -0
- package/vendor/dojo-1.10.10/dojox/charting/widget/Legend.js.uncompressed.js +165 -0
- package/vendor/dojo-1.10.10/dojox/color/Palette.js +163 -0
- package/vendor/dojo-1.10.10/dojox/color/Palette.js.uncompressed.js +460 -0
- package/vendor/dojo-1.10.10/dojox/color/_base.js +174 -0
- package/vendor/dojo-1.10.10/dojox/color/_base.js.uncompressed.js +196 -0
- package/vendor/dojo-1.10.10/dojox/gfx/fx.js +297 -0
- package/vendor/dojo-1.10.10/dojox/gfx/fx.js.uncompressed.js +350 -0
- package/vendor/dojo-1.10.10/dojox/gfx/gradutils.js +63 -0
- package/vendor/dojo-1.10.10/dojox/gfx/gradutils.js.uncompressed.js +91 -0
- package/vendor/dojo-1.10.10/dojox/gfx/matrix.js +170 -0
- package/vendor/dojo-1.10.10/dojox/gfx/matrix.js.uncompressed.js +501 -0
- package/vendor/dojo-1.10.10/dojox/gfx/path.js +319 -0
- package/vendor/dojo-1.10.10/dojox/gfx/path.js.uncompressed.js +478 -0
- package/vendor/dojo-1.10.10/dojox/gfx/shape.js +459 -0
- package/vendor/dojo-1.10.10/dojox/gfx/shape.js.uncompressed.js +1091 -0
- package/vendor/dojo-1.10.10/dojox/gfx/svg.js +662 -0
- package/vendor/dojo-1.10.10/dojox/gfx/svg.js.uncompressed.js +1023 -0
- package/vendor/dojo-1.10.10/dojox/gfx/utils.js +199 -0
- package/vendor/dojo-1.10.10/dojox/gfx/utils.js.uncompressed.js +322 -0
- package/vendor/dojo-1.10.10/dojox/gfx.js +2 -0
- package/vendor/dojo-1.10.10/dojox/gfx.js.uncompressed.js +1136 -0
- package/vendor/dojo-1.10.10/dojox/lang/functional/array.js +151 -0
- package/vendor/dojo-1.10.10/dojox/lang/functional/array.js.uncompressed.js +169 -0
- package/vendor/dojo-1.10.10/dojox/lang/functional/fold.js +93 -0
- package/vendor/dojo-1.10.10/dojox/lang/functional/fold.js.uncompressed.js +125 -0
- package/vendor/dojo-1.10.10/dojox/lang/functional/lambda.js +81 -0
- package/vendor/dojo-1.10.10/dojox/lang/functional/lambda.js.uncompressed.js +132 -0
- package/vendor/dojo-1.10.10/dojox/lang/functional/object.js +54 -0
- package/vendor/dojo-1.10.10/dojox/lang/functional/object.js.uncompressed.js +78 -0
- package/vendor/dojo-1.10.10/dojox/lang/functional/reversed.js +61 -0
- package/vendor/dojo-1.10.10/dojox/lang/functional/reversed.js.uncompressed.js +77 -0
- package/vendor/dojo-1.10.10/dojox/lang/functional/scan.js +87 -0
- package/vendor/dojo-1.10.10/dojox/lang/functional/scan.js.uncompressed.js +107 -0
- package/vendor/dojo-1.10.10/dojox/lang/functional.js +4 -0
- package/vendor/dojo-1.10.10/dojox/lang/functional.js.uncompressed.js +3 -0
- package/vendor/dojo-1.10.10/dojox/lang/utils.js +86 -0
- package/vendor/dojo-1.10.10/dojox/lang/utils.js.uncompressed.js +121 -0
- package/vendor/dojo-1.10.10/dojox/main.js +4 -0
- package/vendor/dojo-1.10.10/dojox/main.js.uncompressed.js +14 -0
- package/vendor/dojo-1.10.10/dojox/storage/LocalStorageProvider.js +112 -0
- package/vendor/dojo-1.10.10/dojox/storage/LocalStorageProvider.js.uncompressed.js +208 -0
- package/vendor/dojo-1.10.10/dojox/storage/Provider.js +62 -0
- package/vendor/dojo-1.10.10/dojox/storage/Provider.js.uncompressed.js +344 -0
- package/vendor/dojo-1.10.10/dojox/storage/manager.js +110 -0
- package/vendor/dojo-1.10.10/dojox/storage/manager.js.uncompressed.js +263 -0
|
@@ -0,0 +1,1023 @@
|
|
|
1
|
+
define("dojox/gfx/svg", ["dojo/_base/lang", "dojo/_base/sniff", "dojo/_base/window", "dojo/dom", "dojo/_base/declare", "dojo/_base/array",
|
|
2
|
+
"dojo/dom-geometry", "dojo/dom-attr", "dojo/_base/Color", "./_base", "./shape", "./path"],
|
|
3
|
+
function(lang, has, win, dom, declare, arr, domGeom, domAttr, Color, g, gs, pathLib){
|
|
4
|
+
|
|
5
|
+
var svg = g.svg = {
|
|
6
|
+
// summary:
|
|
7
|
+
// This the graphics rendering bridge for browsers compliant with W3C SVG1.0.
|
|
8
|
+
// This is the preferred renderer to use for interactive and accessible graphics.
|
|
9
|
+
};
|
|
10
|
+
svg.useSvgWeb = (typeof window.svgweb != "undefined");
|
|
11
|
+
|
|
12
|
+
// Need to detect iOS in order to workaround bug when
|
|
13
|
+
// touching nodes with text
|
|
14
|
+
var uagent = navigator.userAgent,
|
|
15
|
+
safMobile = has("ios"),
|
|
16
|
+
android = has("android"),
|
|
17
|
+
textRenderingFix = has("chrome") || (android && android>=4) ? "auto" : "optimizeLegibility";// #16099, #16461
|
|
18
|
+
|
|
19
|
+
function _createElementNS(ns, nodeType){
|
|
20
|
+
// summary:
|
|
21
|
+
// Internal helper to deal with creating elements that
|
|
22
|
+
// are namespaced. Mainly to get SVG markup output
|
|
23
|
+
// working on IE.
|
|
24
|
+
if(win.doc.createElementNS){
|
|
25
|
+
return win.doc.createElementNS(ns,nodeType);
|
|
26
|
+
}else{
|
|
27
|
+
return win.doc.createElement(nodeType);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function _setAttributeNS(node, ns, attr, value){
|
|
32
|
+
if(node.setAttributeNS){
|
|
33
|
+
return node.setAttributeNS(ns, attr, value);
|
|
34
|
+
}else{
|
|
35
|
+
return node.setAttribute(attr, value);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function _createTextNode(text){
|
|
40
|
+
if(svg.useSvgWeb){
|
|
41
|
+
return win.doc.createTextNode(text, true);
|
|
42
|
+
}else{
|
|
43
|
+
return win.doc.createTextNode(text);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function _createFragment(){
|
|
48
|
+
if(svg.useSvgWeb){
|
|
49
|
+
return win.doc.createDocumentFragment(true);
|
|
50
|
+
}else{
|
|
51
|
+
return win.doc.createDocumentFragment();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
svg.xmlns = {
|
|
56
|
+
xlink: "http://www.w3.org/1999/xlink",
|
|
57
|
+
svg: "http://www.w3.org/2000/svg"
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
svg.getRef = function(name){
|
|
61
|
+
// summary:
|
|
62
|
+
// looks up a node by its external name
|
|
63
|
+
// name: String
|
|
64
|
+
// an SVG external reference
|
|
65
|
+
// returns:
|
|
66
|
+
// returns a DOM Node specified by the name argument or null
|
|
67
|
+
if(!name || name == "none") return null;
|
|
68
|
+
if(name.match(/^url\(#.+\)$/)){
|
|
69
|
+
return dom.byId(name.slice(5, -1)); // Node
|
|
70
|
+
}
|
|
71
|
+
// alternative representation of a reference
|
|
72
|
+
if(name.match(/^#dojoUnique\d+$/)){
|
|
73
|
+
// we assume here that a reference was generated by dojox/gfx
|
|
74
|
+
return dom.byId(name.slice(1)); // Node
|
|
75
|
+
}
|
|
76
|
+
return null; // Node
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
svg.dasharray = {
|
|
80
|
+
solid: "none",
|
|
81
|
+
shortdash: [4, 1],
|
|
82
|
+
shortdot: [1, 1],
|
|
83
|
+
shortdashdot: [4, 1, 1, 1],
|
|
84
|
+
shortdashdotdot: [4, 1, 1, 1, 1, 1],
|
|
85
|
+
dot: [1, 3],
|
|
86
|
+
dash: [4, 3],
|
|
87
|
+
longdash: [8, 3],
|
|
88
|
+
dashdot: [4, 3, 1, 3],
|
|
89
|
+
longdashdot: [8, 3, 1, 3],
|
|
90
|
+
longdashdotdot: [8, 3, 1, 3, 1, 3]
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
var clipCount = 0;
|
|
94
|
+
|
|
95
|
+
svg.Shape = declare("dojox.gfx.svg.Shape", gs.Shape, {
|
|
96
|
+
// summary:
|
|
97
|
+
// SVG-specific implementation of dojox/gfx/shape.Shape methods
|
|
98
|
+
|
|
99
|
+
destroy: function(){
|
|
100
|
+
if(this.fillStyle && "type" in this.fillStyle){
|
|
101
|
+
var fill = this.rawNode.getAttribute("fill"),
|
|
102
|
+
ref = svg.getRef(fill);
|
|
103
|
+
if(ref){
|
|
104
|
+
ref.parentNode.removeChild(ref);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if(this.clip){
|
|
108
|
+
var clipPathProp = this.rawNode.getAttribute("clip-path");
|
|
109
|
+
if(clipPathProp){
|
|
110
|
+
var clipNode = dom.byId(clipPathProp.match(/gfx_clip[\d]+/)[0]);
|
|
111
|
+
if(clipNode){ clipNode.parentNode.removeChild(clipNode); }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
gs.Shape.prototype.destroy.apply(this, arguments);
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
setFill: function(fill){
|
|
118
|
+
// summary:
|
|
119
|
+
// sets a fill object (SVG)
|
|
120
|
+
// fill: Object
|
|
121
|
+
// a fill object
|
|
122
|
+
// (see dojox/gfx.defaultLinearGradient,
|
|
123
|
+
// dojox/gfx.defaultRadialGradient,
|
|
124
|
+
// dojox/gfx.defaultPattern,
|
|
125
|
+
// or dojo/_base/Color)
|
|
126
|
+
|
|
127
|
+
if(!fill){
|
|
128
|
+
// don't fill
|
|
129
|
+
this.fillStyle = null;
|
|
130
|
+
this.rawNode.setAttribute("fill", "none");
|
|
131
|
+
this.rawNode.setAttribute("fill-opacity", 0);
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
134
|
+
var f;
|
|
135
|
+
// FIXME: slightly magical. We're using the outer scope's "f", but setting it later
|
|
136
|
+
var setter = function(x){
|
|
137
|
+
// we assume that we're executing in the scope of the node to mutate
|
|
138
|
+
this.setAttribute(x, f[x].toFixed(8));
|
|
139
|
+
};
|
|
140
|
+
if(typeof(fill) == "object" && "type" in fill){
|
|
141
|
+
// gradient
|
|
142
|
+
switch(fill.type){
|
|
143
|
+
case "linear":
|
|
144
|
+
f = g.makeParameters(g.defaultLinearGradient, fill);
|
|
145
|
+
var gradient = this._setFillObject(f, "linearGradient");
|
|
146
|
+
arr.forEach(["x1", "y1", "x2", "y2"], setter, gradient);
|
|
147
|
+
break;
|
|
148
|
+
case "radial":
|
|
149
|
+
f = g.makeParameters(g.defaultRadialGradient, fill);
|
|
150
|
+
var grad = this._setFillObject(f, "radialGradient");
|
|
151
|
+
arr.forEach(["cx", "cy", "r"], setter, grad);
|
|
152
|
+
break;
|
|
153
|
+
case "pattern":
|
|
154
|
+
f = g.makeParameters(g.defaultPattern, fill);
|
|
155
|
+
var pattern = this._setFillObject(f, "pattern");
|
|
156
|
+
arr.forEach(["x", "y", "width", "height"], setter, pattern);
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
this.fillStyle = f;
|
|
160
|
+
return this;
|
|
161
|
+
}
|
|
162
|
+
// color object
|
|
163
|
+
f = g.normalizeColor(fill);
|
|
164
|
+
this.fillStyle = f;
|
|
165
|
+
this.rawNode.setAttribute("fill", f.toCss());
|
|
166
|
+
this.rawNode.setAttribute("fill-opacity", f.a);
|
|
167
|
+
this.rawNode.setAttribute("fill-rule", "evenodd");
|
|
168
|
+
return this; // self
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
setStroke: function(stroke){
|
|
172
|
+
// summary:
|
|
173
|
+
// sets a stroke object (SVG)
|
|
174
|
+
// stroke: Object
|
|
175
|
+
// a stroke object (see dojox/gfx.defaultStroke)
|
|
176
|
+
|
|
177
|
+
var rn = this.rawNode;
|
|
178
|
+
if(!stroke){
|
|
179
|
+
// don't stroke
|
|
180
|
+
this.strokeStyle = null;
|
|
181
|
+
rn.setAttribute("stroke", "none");
|
|
182
|
+
rn.setAttribute("stroke-opacity", 0);
|
|
183
|
+
return this;
|
|
184
|
+
}
|
|
185
|
+
// normalize the stroke
|
|
186
|
+
if(typeof stroke == "string" || lang.isArray(stroke) || stroke instanceof Color){
|
|
187
|
+
stroke = { color: stroke };
|
|
188
|
+
}
|
|
189
|
+
var s = this.strokeStyle = g.makeParameters(g.defaultStroke, stroke);
|
|
190
|
+
s.color = g.normalizeColor(s.color);
|
|
191
|
+
// generate attributes
|
|
192
|
+
if(s){
|
|
193
|
+
rn.setAttribute("stroke", s.color.toCss());
|
|
194
|
+
rn.setAttribute("stroke-opacity", s.color.a);
|
|
195
|
+
rn.setAttribute("stroke-width", s.width);
|
|
196
|
+
rn.setAttribute("stroke-linecap", s.cap);
|
|
197
|
+
if(typeof s.join == "number"){
|
|
198
|
+
rn.setAttribute("stroke-linejoin", "miter");
|
|
199
|
+
rn.setAttribute("stroke-miterlimit", s.join);
|
|
200
|
+
}else{
|
|
201
|
+
rn.setAttribute("stroke-linejoin", s.join);
|
|
202
|
+
}
|
|
203
|
+
var da = s.style.toLowerCase();
|
|
204
|
+
if(da in svg.dasharray){
|
|
205
|
+
da = svg.dasharray[da];
|
|
206
|
+
}
|
|
207
|
+
if(da instanceof Array){
|
|
208
|
+
da = lang._toArray(da);
|
|
209
|
+
var i;
|
|
210
|
+
for(i = 0; i < da.length; ++i){
|
|
211
|
+
da[i] *= s.width;
|
|
212
|
+
}
|
|
213
|
+
if(s.cap != "butt"){
|
|
214
|
+
for(i = 0; i < da.length; i += 2){
|
|
215
|
+
da[i] -= s.width;
|
|
216
|
+
if(da[i] < 1){ da[i] = 1; }
|
|
217
|
+
}
|
|
218
|
+
for(i = 1; i < da.length; i += 2){
|
|
219
|
+
da[i] += s.width;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
da = da.join(",");
|
|
223
|
+
}
|
|
224
|
+
rn.setAttribute("stroke-dasharray", da);
|
|
225
|
+
rn.setAttribute("dojoGfxStrokeStyle", s.style);
|
|
226
|
+
}
|
|
227
|
+
return this; // self
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
_getParentSurface: function(){
|
|
231
|
+
var surface = this.parent;
|
|
232
|
+
for(; surface && !(surface instanceof g.Surface); surface = surface.parent);
|
|
233
|
+
return surface;
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
_setFillObject: function(f, nodeType){
|
|
237
|
+
var svgns = svg.xmlns.svg;
|
|
238
|
+
this.fillStyle = f;
|
|
239
|
+
var surface = this._getParentSurface(),
|
|
240
|
+
defs = surface.defNode,
|
|
241
|
+
fill = this.rawNode.getAttribute("fill"),
|
|
242
|
+
ref = svg.getRef(fill);
|
|
243
|
+
if(ref){
|
|
244
|
+
fill = ref;
|
|
245
|
+
if(fill.tagName.toLowerCase() != nodeType.toLowerCase()){
|
|
246
|
+
var id = fill.id;
|
|
247
|
+
fill.parentNode.removeChild(fill);
|
|
248
|
+
fill = _createElementNS(svgns, nodeType);
|
|
249
|
+
fill.setAttribute("id", id);
|
|
250
|
+
defs.appendChild(fill);
|
|
251
|
+
}else{
|
|
252
|
+
while(fill.childNodes.length){
|
|
253
|
+
fill.removeChild(fill.lastChild);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}else{
|
|
257
|
+
fill = _createElementNS(svgns, nodeType);
|
|
258
|
+
fill.setAttribute("id", g._base._getUniqueId());
|
|
259
|
+
defs.appendChild(fill);
|
|
260
|
+
}
|
|
261
|
+
if(nodeType == "pattern"){
|
|
262
|
+
fill.setAttribute("patternUnits", "userSpaceOnUse");
|
|
263
|
+
var img = _createElementNS(svgns, "image");
|
|
264
|
+
img.setAttribute("x", 0);
|
|
265
|
+
img.setAttribute("y", 0);
|
|
266
|
+
img.setAttribute("width", f.width .toFixed(8));
|
|
267
|
+
img.setAttribute("height", f.height.toFixed(8));
|
|
268
|
+
_setAttributeNS(img, svg.xmlns.xlink, "xlink:href", f.src);
|
|
269
|
+
fill.appendChild(img);
|
|
270
|
+
}else{
|
|
271
|
+
fill.setAttribute("gradientUnits", "userSpaceOnUse");
|
|
272
|
+
for(var i = 0; i < f.colors.length; ++i){
|
|
273
|
+
var c = f.colors[i], t = _createElementNS(svgns, "stop"),
|
|
274
|
+
cc = c.color = g.normalizeColor(c.color);
|
|
275
|
+
t.setAttribute("offset", c.offset.toFixed(8));
|
|
276
|
+
t.setAttribute("stop-color", cc.toCss());
|
|
277
|
+
t.setAttribute("stop-opacity", cc.a);
|
|
278
|
+
fill.appendChild(t);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
this.rawNode.setAttribute("fill", "url(#" + fill.getAttribute("id") +")");
|
|
282
|
+
this.rawNode.removeAttribute("fill-opacity");
|
|
283
|
+
this.rawNode.setAttribute("fill-rule", "evenodd");
|
|
284
|
+
return fill;
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
_applyTransform: function() {
|
|
288
|
+
var matrix = this.matrix;
|
|
289
|
+
if(matrix){
|
|
290
|
+
var tm = this.matrix;
|
|
291
|
+
this.rawNode.setAttribute("transform", "matrix(" +
|
|
292
|
+
tm.xx.toFixed(8) + "," + tm.yx.toFixed(8) + "," +
|
|
293
|
+
tm.xy.toFixed(8) + "," + tm.yy.toFixed(8) + "," +
|
|
294
|
+
tm.dx.toFixed(8) + "," + tm.dy.toFixed(8) + ")");
|
|
295
|
+
}else{
|
|
296
|
+
this.rawNode.removeAttribute("transform");
|
|
297
|
+
}
|
|
298
|
+
return this;
|
|
299
|
+
},
|
|
300
|
+
|
|
301
|
+
setRawNode: function(rawNode){
|
|
302
|
+
// summary:
|
|
303
|
+
// assigns and clears the underlying node that will represent this
|
|
304
|
+
// shape. Once set, transforms, gradients, etc, can be applied.
|
|
305
|
+
// (no fill & stroke by default)
|
|
306
|
+
var r = this.rawNode = rawNode;
|
|
307
|
+
if(this.shape.type!="image"){
|
|
308
|
+
r.setAttribute("fill", "none");
|
|
309
|
+
}
|
|
310
|
+
r.setAttribute("fill-opacity", 0);
|
|
311
|
+
r.setAttribute("stroke", "none");
|
|
312
|
+
r.setAttribute("stroke-opacity", 0);
|
|
313
|
+
r.setAttribute("stroke-width", 1);
|
|
314
|
+
r.setAttribute("stroke-linecap", "butt");
|
|
315
|
+
r.setAttribute("stroke-linejoin", "miter");
|
|
316
|
+
r.setAttribute("stroke-miterlimit", 4);
|
|
317
|
+
// Bind GFX object with SVG node for ease of retrieval - that is to
|
|
318
|
+
// save code/performance to keep this association elsewhere
|
|
319
|
+
r.__gfxObject__ = this;
|
|
320
|
+
},
|
|
321
|
+
|
|
322
|
+
setShape: function(newShape){
|
|
323
|
+
// summary:
|
|
324
|
+
// sets a shape object (SVG)
|
|
325
|
+
// newShape: Object
|
|
326
|
+
// a shape object
|
|
327
|
+
// (see dojox/gfx.defaultPath,
|
|
328
|
+
// dojox/gfx.defaultPolyline,
|
|
329
|
+
// dojox/gfx.defaultRect,
|
|
330
|
+
// dojox/gfx.defaultEllipse,
|
|
331
|
+
// dojox/gfx.defaultCircle,
|
|
332
|
+
// dojox/gfx.defaultLine,
|
|
333
|
+
// or dojox/gfx.defaultImage)
|
|
334
|
+
this.shape = g.makeParameters(this.shape, newShape);
|
|
335
|
+
for(var i in this.shape){
|
|
336
|
+
if(i != "type"){
|
|
337
|
+
this.rawNode.setAttribute(i, this.shape[i]);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
this.bbox = null;
|
|
341
|
+
return this; // self
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
// move family
|
|
345
|
+
|
|
346
|
+
_moveToFront: function(){
|
|
347
|
+
// summary:
|
|
348
|
+
// moves a shape to front of its parent's list of shapes (SVG)
|
|
349
|
+
this.rawNode.parentNode.appendChild(this.rawNode);
|
|
350
|
+
return this; // self
|
|
351
|
+
},
|
|
352
|
+
_moveToBack: function(){
|
|
353
|
+
// summary:
|
|
354
|
+
// moves a shape to back of its parent's list of shapes (SVG)
|
|
355
|
+
this.rawNode.parentNode.insertBefore(this.rawNode, this.rawNode.parentNode.firstChild);
|
|
356
|
+
return this; // self
|
|
357
|
+
},
|
|
358
|
+
setClip: function(clip){
|
|
359
|
+
// summary:
|
|
360
|
+
// sets the clipping area of this shape.
|
|
361
|
+
// description:
|
|
362
|
+
// This method overrides the dojox/gfx/shape.Shape.setClip() method.
|
|
363
|
+
// clip: Object
|
|
364
|
+
// an object that defines the clipping geometry, or null to remove clip.
|
|
365
|
+
this.inherited(arguments);
|
|
366
|
+
var clipType = clip ? "width" in clip ? "rect" :
|
|
367
|
+
"cx" in clip ? "ellipse" :
|
|
368
|
+
"points" in clip ? "polyline" : "d" in clip ? "path" : null : null;
|
|
369
|
+
if(clip && !clipType){
|
|
370
|
+
return this;
|
|
371
|
+
}
|
|
372
|
+
if(clipType === "polyline"){
|
|
373
|
+
clip = lang.clone(clip);
|
|
374
|
+
clip.points = clip.points.join(",");
|
|
375
|
+
}
|
|
376
|
+
var clipNode, clipShape,
|
|
377
|
+
clipPathProp = domAttr.get(this.rawNode, "clip-path");
|
|
378
|
+
if(clipPathProp){
|
|
379
|
+
clipNode = dom.byId(clipPathProp.match(/gfx_clip[\d]+/)[0]);
|
|
380
|
+
if(clipNode){ // may be null if not in the DOM anymore
|
|
381
|
+
clipNode.removeChild(clipNode.childNodes[0]);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if(clip){
|
|
385
|
+
if(clipNode){
|
|
386
|
+
clipShape = _createElementNS(svg.xmlns.svg, clipType);
|
|
387
|
+
clipNode.appendChild(clipShape);
|
|
388
|
+
}else{
|
|
389
|
+
var idIndex = ++clipCount;
|
|
390
|
+
var clipId = "gfx_clip" + idIndex;
|
|
391
|
+
var clipUrl = "url(#" + clipId + ")";
|
|
392
|
+
this.rawNode.setAttribute("clip-path", clipUrl);
|
|
393
|
+
clipNode = _createElementNS(svg.xmlns.svg, "clipPath");
|
|
394
|
+
clipShape = _createElementNS(svg.xmlns.svg, clipType);
|
|
395
|
+
clipNode.appendChild(clipShape);
|
|
396
|
+
this.rawNode.parentNode.insertBefore(clipNode, this.rawNode);
|
|
397
|
+
domAttr.set(clipNode, "id", clipId);
|
|
398
|
+
}
|
|
399
|
+
domAttr.set(clipShape, clip);
|
|
400
|
+
}else{
|
|
401
|
+
//remove clip-path
|
|
402
|
+
this.rawNode.removeAttribute("clip-path");
|
|
403
|
+
if(clipNode){
|
|
404
|
+
clipNode.parentNode.removeChild(clipNode);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return this;
|
|
408
|
+
},
|
|
409
|
+
_removeClipNode: function(){
|
|
410
|
+
var clipNode, clipPathProp = domAttr.get(this.rawNode, "clip-path");
|
|
411
|
+
if(clipPathProp){
|
|
412
|
+
clipNode = dom.byId(clipPathProp.match(/gfx_clip[\d]+/)[0]);
|
|
413
|
+
if(clipNode){
|
|
414
|
+
clipNode.parentNode.removeChild(clipNode);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return clipNode;
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
svg.Group = declare("dojox.gfx.svg.Group", svg.Shape, {
|
|
423
|
+
// summary:
|
|
424
|
+
// a group shape (SVG), which can be used
|
|
425
|
+
// to logically group shapes (e.g, to propagate matricies)
|
|
426
|
+
constructor: function(){
|
|
427
|
+
gs.Container._init.call(this);
|
|
428
|
+
},
|
|
429
|
+
setRawNode: function(rawNode){
|
|
430
|
+
// summary:
|
|
431
|
+
// sets a raw SVG node to be used by this shape
|
|
432
|
+
// rawNode: Node
|
|
433
|
+
// an SVG node
|
|
434
|
+
this.rawNode = rawNode;
|
|
435
|
+
// Bind GFX object with SVG node for ease of retrieval - that is to
|
|
436
|
+
// save code/performance to keep this association elsewhere
|
|
437
|
+
this.rawNode.__gfxObject__ = this;
|
|
438
|
+
},
|
|
439
|
+
destroy: function(){
|
|
440
|
+
// summary:
|
|
441
|
+
// Releases all internal resources owned by this shape. Once this method has been called,
|
|
442
|
+
// the instance is considered disposed and should not be used anymore.
|
|
443
|
+
this.clear(true);
|
|
444
|
+
// avoid this.inherited
|
|
445
|
+
svg.Shape.prototype.destroy.apply(this, arguments);
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
svg.Group.nodeType = "g";
|
|
449
|
+
|
|
450
|
+
svg.Rect = declare("dojox.gfx.svg.Rect", [svg.Shape, gs.Rect], {
|
|
451
|
+
// summary:
|
|
452
|
+
// a rectangle shape (SVG)
|
|
453
|
+
setShape: function(newShape){
|
|
454
|
+
// summary:
|
|
455
|
+
// sets a rectangle shape object (SVG)
|
|
456
|
+
// newShape: Object
|
|
457
|
+
// a rectangle shape object
|
|
458
|
+
this.shape = g.makeParameters(this.shape, newShape);
|
|
459
|
+
this.bbox = null;
|
|
460
|
+
for(var i in this.shape){
|
|
461
|
+
if(i != "type" && i != "r"){
|
|
462
|
+
this.rawNode.setAttribute(i, this.shape[i]);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
if(this.shape.r != null){
|
|
466
|
+
this.rawNode.setAttribute("ry", this.shape.r);
|
|
467
|
+
this.rawNode.setAttribute("rx", this.shape.r);
|
|
468
|
+
}
|
|
469
|
+
return this; // self
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
svg.Rect.nodeType = "rect";
|
|
473
|
+
|
|
474
|
+
svg.Ellipse = declare("dojox.gfx.svg.Ellipse", [svg.Shape, gs.Ellipse], {});
|
|
475
|
+
svg.Ellipse.nodeType = "ellipse";
|
|
476
|
+
|
|
477
|
+
svg.Circle = declare("dojox.gfx.svg.Circle", [svg.Shape, gs.Circle], {});
|
|
478
|
+
svg.Circle.nodeType = "circle";
|
|
479
|
+
|
|
480
|
+
svg.Line = declare("dojox.gfx.svg.Line", [svg.Shape, gs.Line], {});
|
|
481
|
+
svg.Line.nodeType = "line";
|
|
482
|
+
|
|
483
|
+
svg.Polyline = declare("dojox.gfx.svg.Polyline", [svg.Shape, gs.Polyline], {
|
|
484
|
+
// summary:
|
|
485
|
+
// a polyline/polygon shape (SVG)
|
|
486
|
+
setShape: function(points, closed){
|
|
487
|
+
// summary:
|
|
488
|
+
// sets a polyline/polygon shape object (SVG)
|
|
489
|
+
// points: Object|Array
|
|
490
|
+
// a polyline/polygon shape object, or an array of points
|
|
491
|
+
if(points && points instanceof Array){
|
|
492
|
+
this.shape = g.makeParameters(this.shape, { points: points });
|
|
493
|
+
if(closed && this.shape.points.length){
|
|
494
|
+
this.shape.points.push(this.shape.points[0]);
|
|
495
|
+
}
|
|
496
|
+
}else{
|
|
497
|
+
this.shape = g.makeParameters(this.shape, points);
|
|
498
|
+
}
|
|
499
|
+
this.bbox = null;
|
|
500
|
+
this._normalizePoints();
|
|
501
|
+
var attr = [], p = this.shape.points;
|
|
502
|
+
for(var i = 0; i < p.length; ++i){
|
|
503
|
+
attr.push(p[i].x.toFixed(8), p[i].y.toFixed(8));
|
|
504
|
+
}
|
|
505
|
+
this.rawNode.setAttribute("points", attr.join(" "));
|
|
506
|
+
return this; // self
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
svg.Polyline.nodeType = "polyline";
|
|
510
|
+
|
|
511
|
+
svg.Image = declare("dojox.gfx.svg.Image", [svg.Shape, gs.Image], {
|
|
512
|
+
// summary:
|
|
513
|
+
// an image (SVG)
|
|
514
|
+
setShape: function(newShape){
|
|
515
|
+
// summary:
|
|
516
|
+
// sets an image shape object (SVG)
|
|
517
|
+
// newShape: Object
|
|
518
|
+
// an image shape object
|
|
519
|
+
this.shape = g.makeParameters(this.shape, newShape);
|
|
520
|
+
this.bbox = null;
|
|
521
|
+
var rawNode = this.rawNode;
|
|
522
|
+
for(var i in this.shape){
|
|
523
|
+
if(i != "type" && i != "src"){
|
|
524
|
+
rawNode.setAttribute(i, this.shape[i]);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
rawNode.setAttribute("preserveAspectRatio", "none");
|
|
528
|
+
_setAttributeNS(rawNode, svg.xmlns.xlink, "xlink:href", this.shape.src);
|
|
529
|
+
// Bind GFX object with SVG node for ease of retrieval - that is to
|
|
530
|
+
// save code/performance to keep this association elsewhere
|
|
531
|
+
rawNode.__gfxObject__ = this;
|
|
532
|
+
return this; // self
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
svg.Image.nodeType = "image";
|
|
536
|
+
|
|
537
|
+
svg.Text = declare("dojox.gfx.svg.Text", [svg.Shape, gs.Text], {
|
|
538
|
+
// summary:
|
|
539
|
+
// an anchored text (SVG)
|
|
540
|
+
setShape: function(newShape){
|
|
541
|
+
// summary:
|
|
542
|
+
// sets a text shape object (SVG)
|
|
543
|
+
// newShape: Object
|
|
544
|
+
// a text shape object
|
|
545
|
+
this.shape = g.makeParameters(this.shape, newShape);
|
|
546
|
+
this.bbox = null;
|
|
547
|
+
var r = this.rawNode, s = this.shape;
|
|
548
|
+
r.setAttribute("x", s.x);
|
|
549
|
+
r.setAttribute("y", s.y);
|
|
550
|
+
r.setAttribute("text-anchor", s.align);
|
|
551
|
+
r.setAttribute("text-decoration", s.decoration);
|
|
552
|
+
r.setAttribute("rotate", s.rotated ? 90 : 0);
|
|
553
|
+
r.setAttribute("kerning", s.kerning ? "auto" : 0);
|
|
554
|
+
r.setAttribute("text-rendering", textRenderingFix);
|
|
555
|
+
|
|
556
|
+
// update the text content
|
|
557
|
+
if(r.firstChild){
|
|
558
|
+
r.firstChild.nodeValue = s.text;
|
|
559
|
+
}else{
|
|
560
|
+
r.appendChild(_createTextNode(s.text));
|
|
561
|
+
}
|
|
562
|
+
return this; // self
|
|
563
|
+
},
|
|
564
|
+
getTextWidth: function(){
|
|
565
|
+
// summary:
|
|
566
|
+
// get the text width in pixels
|
|
567
|
+
var rawNode = this.rawNode,
|
|
568
|
+
oldParent = rawNode.parentNode,
|
|
569
|
+
_measurementNode = rawNode.cloneNode(true);
|
|
570
|
+
_measurementNode.style.visibility = "hidden";
|
|
571
|
+
|
|
572
|
+
// solution to the "orphan issue" in FF
|
|
573
|
+
var _width = 0, _text = _measurementNode.firstChild.nodeValue;
|
|
574
|
+
oldParent.appendChild(_measurementNode);
|
|
575
|
+
|
|
576
|
+
// solution to the "orphan issue" in Opera
|
|
577
|
+
// (nodeValue == "" hangs firefox)
|
|
578
|
+
if(_text!=""){
|
|
579
|
+
while(!_width){
|
|
580
|
+
//Yang: work around svgweb bug 417 -- http://code.google.com/p/svgweb/issues/detail?id=417
|
|
581
|
+
if (_measurementNode.getBBox)
|
|
582
|
+
_width = parseInt(_measurementNode.getBBox().width);
|
|
583
|
+
else
|
|
584
|
+
_width = 68;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
oldParent.removeChild(_measurementNode);
|
|
588
|
+
return _width;
|
|
589
|
+
},
|
|
590
|
+
getBoundingBox: function(){
|
|
591
|
+
var s = this.getShape(), bbox = null;
|
|
592
|
+
if(s.text){
|
|
593
|
+
// try/catch the FF native getBBox error.
|
|
594
|
+
try {
|
|
595
|
+
bbox = this.rawNode.getBBox();
|
|
596
|
+
} catch (e) {
|
|
597
|
+
// under FF when the node is orphan (all other browsers return a 0ed bbox.
|
|
598
|
+
bbox = {x:0, y:0, width:0, height:0};
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
return bbox;
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
svg.Text.nodeType = "text";
|
|
605
|
+
|
|
606
|
+
svg.Path = declare("dojox.gfx.svg.Path", [svg.Shape, pathLib.Path], {
|
|
607
|
+
// summary:
|
|
608
|
+
// a path shape (SVG)
|
|
609
|
+
_updateWithSegment: function(segment){
|
|
610
|
+
// summary:
|
|
611
|
+
// updates the bounding box of path with new segment
|
|
612
|
+
// segment: Object
|
|
613
|
+
// a segment
|
|
614
|
+
this.inherited(arguments);
|
|
615
|
+
if(typeof(this.shape.path) == "string"){
|
|
616
|
+
this.rawNode.setAttribute("d", this.shape.path);
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
setShape: function(newShape){
|
|
620
|
+
// summary:
|
|
621
|
+
// forms a path using a shape (SVG)
|
|
622
|
+
// newShape: Object
|
|
623
|
+
// an SVG path string or a path object (see dojox/gfx.defaultPath)
|
|
624
|
+
this.inherited(arguments);
|
|
625
|
+
if(this.shape.path){
|
|
626
|
+
this.rawNode.setAttribute("d", this.shape.path);
|
|
627
|
+
}else{
|
|
628
|
+
this.rawNode.removeAttribute("d");
|
|
629
|
+
}
|
|
630
|
+
return this; // self
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
svg.Path.nodeType = "path";
|
|
634
|
+
|
|
635
|
+
svg.TextPath = declare("dojox.gfx.svg.TextPath", [svg.Shape, pathLib.TextPath], {
|
|
636
|
+
// summary:
|
|
637
|
+
// a textpath shape (SVG)
|
|
638
|
+
_updateWithSegment: function(segment){
|
|
639
|
+
// summary:
|
|
640
|
+
// updates the bounding box of path with new segment
|
|
641
|
+
// segment: Object
|
|
642
|
+
// a segment
|
|
643
|
+
this.inherited(arguments);
|
|
644
|
+
this._setTextPath();
|
|
645
|
+
},
|
|
646
|
+
setShape: function(newShape){
|
|
647
|
+
// summary:
|
|
648
|
+
// forms a path using a shape (SVG)
|
|
649
|
+
// newShape: Object
|
|
650
|
+
// an SVG path string or a path object (see dojox/gfx.defaultPath)
|
|
651
|
+
this.inherited(arguments);
|
|
652
|
+
this._setTextPath();
|
|
653
|
+
return this; // self
|
|
654
|
+
},
|
|
655
|
+
_setTextPath: function(){
|
|
656
|
+
if(typeof this.shape.path != "string"){ return; }
|
|
657
|
+
var r = this.rawNode;
|
|
658
|
+
if(!r.firstChild){
|
|
659
|
+
var tp = _createElementNS(svg.xmlns.svg, "textPath"),
|
|
660
|
+
tx = _createTextNode("");
|
|
661
|
+
tp.appendChild(tx);
|
|
662
|
+
r.appendChild(tp);
|
|
663
|
+
}
|
|
664
|
+
var ref = r.firstChild.getAttributeNS(svg.xmlns.xlink, "href"),
|
|
665
|
+
path = ref && svg.getRef(ref);
|
|
666
|
+
if(!path){
|
|
667
|
+
var surface = this._getParentSurface();
|
|
668
|
+
if(surface){
|
|
669
|
+
var defs = surface.defNode;
|
|
670
|
+
path = _createElementNS(svg.xmlns.svg, "path");
|
|
671
|
+
var id = g._base._getUniqueId();
|
|
672
|
+
path.setAttribute("id", id);
|
|
673
|
+
defs.appendChild(path);
|
|
674
|
+
_setAttributeNS(r.firstChild, svg.xmlns.xlink, "xlink:href", "#" + id);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
if(path){
|
|
678
|
+
path.setAttribute("d", this.shape.path);
|
|
679
|
+
}
|
|
680
|
+
},
|
|
681
|
+
_setText: function(){
|
|
682
|
+
var r = this.rawNode;
|
|
683
|
+
if(!r.firstChild){
|
|
684
|
+
var tp = _createElementNS(svg.xmlns.svg, "textPath"),
|
|
685
|
+
tx = _createTextNode("");
|
|
686
|
+
tp.appendChild(tx);
|
|
687
|
+
r.appendChild(tp);
|
|
688
|
+
}
|
|
689
|
+
r = r.firstChild;
|
|
690
|
+
var t = this.text;
|
|
691
|
+
r.setAttribute("alignment-baseline", "middle");
|
|
692
|
+
switch(t.align){
|
|
693
|
+
case "middle":
|
|
694
|
+
r.setAttribute("text-anchor", "middle");
|
|
695
|
+
r.setAttribute("startOffset", "50%");
|
|
696
|
+
break;
|
|
697
|
+
case "end":
|
|
698
|
+
r.setAttribute("text-anchor", "end");
|
|
699
|
+
r.setAttribute("startOffset", "100%");
|
|
700
|
+
break;
|
|
701
|
+
default:
|
|
702
|
+
r.setAttribute("text-anchor", "start");
|
|
703
|
+
r.setAttribute("startOffset", "0%");
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
//r.parentNode.setAttribute("alignment-baseline", "central");
|
|
707
|
+
//r.setAttribute("dominant-baseline", "central");
|
|
708
|
+
r.setAttribute("baseline-shift", "0.5ex");
|
|
709
|
+
r.setAttribute("text-decoration", t.decoration);
|
|
710
|
+
r.setAttribute("rotate", t.rotated ? 90 : 0);
|
|
711
|
+
r.setAttribute("kerning", t.kerning ? "auto" : 0);
|
|
712
|
+
r.firstChild.data = t.text;
|
|
713
|
+
}
|
|
714
|
+
});
|
|
715
|
+
svg.TextPath.nodeType = "text";
|
|
716
|
+
|
|
717
|
+
// Fix for setDimension bug:
|
|
718
|
+
// http://bugs.dojotoolkit.org/ticket/16100
|
|
719
|
+
// (https://code.google.com/p/chromium/issues/detail?id=162628)
|
|
720
|
+
var hasSvgSetAttributeBug = (function(){ var matches = /WebKit\/(\d*)/.exec(uagent); return matches ? matches[1] : 0})() > 534;
|
|
721
|
+
|
|
722
|
+
svg.Surface = declare("dojox.gfx.svg.Surface", gs.Surface, {
|
|
723
|
+
// summary:
|
|
724
|
+
// a surface object to be used for drawings (SVG)
|
|
725
|
+
constructor: function(){
|
|
726
|
+
gs.Container._init.call(this);
|
|
727
|
+
},
|
|
728
|
+
destroy: function(){
|
|
729
|
+
// no need to call svg.Container.clear to remove the children raw
|
|
730
|
+
// nodes since the surface raw node will be removed. So, only dispose at gfx level
|
|
731
|
+
gs.Container.clear.call(this, true);
|
|
732
|
+
this.defNode = null; // release the external reference
|
|
733
|
+
this.inherited(arguments);
|
|
734
|
+
},
|
|
735
|
+
setDimensions: function(width, height){
|
|
736
|
+
// summary:
|
|
737
|
+
// sets the width and height of the rawNode
|
|
738
|
+
// width: String
|
|
739
|
+
// width of surface, e.g., "100px"
|
|
740
|
+
// height: String
|
|
741
|
+
// height of surface, e.g., "100px"
|
|
742
|
+
if(!this.rawNode){ return this; }
|
|
743
|
+
this.rawNode.setAttribute("width", width);
|
|
744
|
+
this.rawNode.setAttribute("height", height);
|
|
745
|
+
if(hasSvgSetAttributeBug){
|
|
746
|
+
this.rawNode.style.width = width;
|
|
747
|
+
this.rawNode.style.height = height;
|
|
748
|
+
}
|
|
749
|
+
return this; // self
|
|
750
|
+
},
|
|
751
|
+
getDimensions: function(){
|
|
752
|
+
// summary:
|
|
753
|
+
// returns an object with properties "width" and "height"
|
|
754
|
+
var t = this.rawNode ? {
|
|
755
|
+
width: g.normalizedLength(this.rawNode.getAttribute("width")),
|
|
756
|
+
height: g.normalizedLength(this.rawNode.getAttribute("height"))} : null;
|
|
757
|
+
return t; // Object
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
svg.createSurface = function(parentNode, width, height){
|
|
762
|
+
// summary:
|
|
763
|
+
// creates a surface (SVG)
|
|
764
|
+
// parentNode: Node
|
|
765
|
+
// a parent node
|
|
766
|
+
// width: String|Number
|
|
767
|
+
// width of surface, e.g., "100px" or 100
|
|
768
|
+
// height: String|Number
|
|
769
|
+
// height of surface, e.g., "100px" or 100
|
|
770
|
+
// returns: dojox/gfx/shape.Surface
|
|
771
|
+
// newly created surface
|
|
772
|
+
|
|
773
|
+
var s = new svg.Surface();
|
|
774
|
+
s.rawNode = _createElementNS(svg.xmlns.svg, "svg");
|
|
775
|
+
s.rawNode.setAttribute("overflow", "hidden");
|
|
776
|
+
if(width){
|
|
777
|
+
s.rawNode.setAttribute("width", width);
|
|
778
|
+
}
|
|
779
|
+
if(height){
|
|
780
|
+
s.rawNode.setAttribute("height", height);
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
var defNode = _createElementNS(svg.xmlns.svg, "defs");
|
|
784
|
+
s.rawNode.appendChild(defNode);
|
|
785
|
+
s.defNode = defNode;
|
|
786
|
+
|
|
787
|
+
s._parent = dom.byId(parentNode);
|
|
788
|
+
s._parent.appendChild(s.rawNode);
|
|
789
|
+
|
|
790
|
+
g._base._fixMsTouchAction(s);
|
|
791
|
+
|
|
792
|
+
return s; // dojox/gfx.Surface
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
// Extenders
|
|
796
|
+
|
|
797
|
+
var Font = {
|
|
798
|
+
_setFont: function(){
|
|
799
|
+
// summary:
|
|
800
|
+
// sets a font object (SVG)
|
|
801
|
+
var f = this.fontStyle;
|
|
802
|
+
// next line doesn't work in Firefox 2 or Opera 9
|
|
803
|
+
//this.rawNode.setAttribute("font", dojox.gfx.makeFontString(this.fontStyle));
|
|
804
|
+
this.rawNode.setAttribute("font-style", f.style);
|
|
805
|
+
this.rawNode.setAttribute("font-variant", f.variant);
|
|
806
|
+
this.rawNode.setAttribute("font-weight", f.weight);
|
|
807
|
+
this.rawNode.setAttribute("font-size", f.size);
|
|
808
|
+
this.rawNode.setAttribute("font-family", f.family);
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
var C = gs.Container;
|
|
813
|
+
var Container = svg.Container = {
|
|
814
|
+
openBatch: function() {
|
|
815
|
+
// summary:
|
|
816
|
+
// starts a new batch, subsequent new child shapes will be held in
|
|
817
|
+
// the batch instead of appending to the container directly
|
|
818
|
+
if(!this._batch){
|
|
819
|
+
this.fragment = _createFragment();
|
|
820
|
+
}
|
|
821
|
+
++this._batch;
|
|
822
|
+
return this;
|
|
823
|
+
},
|
|
824
|
+
closeBatch: function() {
|
|
825
|
+
// summary:
|
|
826
|
+
// submits the current batch, append all pending child shapes to DOM
|
|
827
|
+
this._batch = this._batch > 0 ? --this._batch : 0;
|
|
828
|
+
if (this.fragment && !this._batch) {
|
|
829
|
+
this.rawNode.appendChild(this.fragment);
|
|
830
|
+
delete this.fragment;
|
|
831
|
+
}
|
|
832
|
+
return this;
|
|
833
|
+
},
|
|
834
|
+
add: function(shape){
|
|
835
|
+
// summary:
|
|
836
|
+
// adds a shape to a group/surface
|
|
837
|
+
// shape: dojox/gfx/shape.Shape
|
|
838
|
+
// an VML shape object
|
|
839
|
+
if(this != shape.getParent()){
|
|
840
|
+
if (this.fragment) {
|
|
841
|
+
this.fragment.appendChild(shape.rawNode);
|
|
842
|
+
} else {
|
|
843
|
+
this.rawNode.appendChild(shape.rawNode);
|
|
844
|
+
}
|
|
845
|
+
C.add.apply(this, arguments);
|
|
846
|
+
// update clipnode with new parent
|
|
847
|
+
shape.setClip(shape.clip);
|
|
848
|
+
}
|
|
849
|
+
return this; // self
|
|
850
|
+
},
|
|
851
|
+
remove: function(shape, silently){
|
|
852
|
+
// summary:
|
|
853
|
+
// remove a shape from a group/surface
|
|
854
|
+
// shape: dojox/gfx/shape.Shape
|
|
855
|
+
// an VML shape object
|
|
856
|
+
// silently: Boolean?
|
|
857
|
+
// if true, regenerate a picture
|
|
858
|
+
if(this == shape.getParent()){
|
|
859
|
+
if(this.rawNode == shape.rawNode.parentNode){
|
|
860
|
+
this.rawNode.removeChild(shape.rawNode);
|
|
861
|
+
}
|
|
862
|
+
if(this.fragment && this.fragment == shape.rawNode.parentNode){
|
|
863
|
+
this.fragment.removeChild(shape.rawNode);
|
|
864
|
+
}
|
|
865
|
+
// remove clip node from parent
|
|
866
|
+
shape._removeClipNode();
|
|
867
|
+
C.remove.apply(this, arguments);
|
|
868
|
+
}
|
|
869
|
+
return this; // self
|
|
870
|
+
},
|
|
871
|
+
clear: function(){
|
|
872
|
+
// summary:
|
|
873
|
+
// removes all shapes from a group/surface
|
|
874
|
+
var r = this.rawNode;
|
|
875
|
+
while(r.lastChild){
|
|
876
|
+
r.removeChild(r.lastChild);
|
|
877
|
+
}
|
|
878
|
+
var defNode = this.defNode;
|
|
879
|
+
if(defNode){
|
|
880
|
+
while(defNode.lastChild){
|
|
881
|
+
defNode.removeChild(defNode.lastChild);
|
|
882
|
+
}
|
|
883
|
+
r.appendChild(defNode);
|
|
884
|
+
}
|
|
885
|
+
return C.clear.apply(this, arguments);
|
|
886
|
+
},
|
|
887
|
+
getBoundingBox: C.getBoundingBox,
|
|
888
|
+
_moveChildToFront: C._moveChildToFront,
|
|
889
|
+
_moveChildToBack: C._moveChildToBack
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
var Creator = svg.Creator = {
|
|
893
|
+
// summary:
|
|
894
|
+
// SVG shape creators
|
|
895
|
+
createObject: function(shapeType, rawShape){
|
|
896
|
+
// summary:
|
|
897
|
+
// creates an instance of the passed shapeType class
|
|
898
|
+
// shapeType: Function
|
|
899
|
+
// a class constructor to create an instance of
|
|
900
|
+
// rawShape: Object
|
|
901
|
+
// properties to be passed in to the classes "setShape" method
|
|
902
|
+
if(!this.rawNode){ return null; }
|
|
903
|
+
var shape = new shapeType(),
|
|
904
|
+
node = _createElementNS(svg.xmlns.svg, shapeType.nodeType);
|
|
905
|
+
|
|
906
|
+
shape.setRawNode(node);
|
|
907
|
+
shape.setShape(rawShape);
|
|
908
|
+
// rawNode.appendChild() will be done inside this.add(shape) below
|
|
909
|
+
this.add(shape);
|
|
910
|
+
return shape; // dojox/gfx/shape.Shape
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
|
|
914
|
+
lang.extend(svg.Text, Font);
|
|
915
|
+
lang.extend(svg.TextPath, Font);
|
|
916
|
+
|
|
917
|
+
lang.extend(svg.Group, Container);
|
|
918
|
+
lang.extend(svg.Group, gs.Creator);
|
|
919
|
+
lang.extend(svg.Group, Creator);
|
|
920
|
+
|
|
921
|
+
lang.extend(svg.Surface, Container);
|
|
922
|
+
lang.extend(svg.Surface, gs.Creator);
|
|
923
|
+
lang.extend(svg.Surface, Creator);
|
|
924
|
+
|
|
925
|
+
// Mouse/Touch event
|
|
926
|
+
svg.fixTarget = function(event, gfxElement) {
|
|
927
|
+
// summary:
|
|
928
|
+
// Adds the gfxElement to event.gfxTarget if none exists. This new
|
|
929
|
+
// property will carry the GFX element associated with this event.
|
|
930
|
+
// event: Object
|
|
931
|
+
// The current input event (MouseEvent or TouchEvent)
|
|
932
|
+
// gfxElement: Object
|
|
933
|
+
// The GFX target element
|
|
934
|
+
if (!event.gfxTarget) {
|
|
935
|
+
if (safMobile && event.target.wholeText) {
|
|
936
|
+
// Workaround iOS bug when touching text nodes
|
|
937
|
+
event.gfxTarget = event.target.parentElement.__gfxObject__;
|
|
938
|
+
} else {
|
|
939
|
+
event.gfxTarget = event.target.__gfxObject__;
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
return true;
|
|
943
|
+
};
|
|
944
|
+
|
|
945
|
+
// some specific override for svgweb + flash
|
|
946
|
+
if(svg.useSvgWeb){
|
|
947
|
+
// override createSurface()
|
|
948
|
+
svg.createSurface = function(parentNode, width, height){
|
|
949
|
+
var s = new svg.Surface();
|
|
950
|
+
|
|
951
|
+
// ensure width / height
|
|
952
|
+
if(!width || !height){
|
|
953
|
+
var pos = domGeom.position(parentNode);
|
|
954
|
+
width = width || pos.w;
|
|
955
|
+
height = height || pos.h;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
// ensure id
|
|
959
|
+
parentNode = dom.byId(parentNode);
|
|
960
|
+
var id = parentNode.id ? parentNode.id+'_svgweb' : g._base._getUniqueId();
|
|
961
|
+
|
|
962
|
+
// create dynamic svg root
|
|
963
|
+
var mockSvg = _createElementNS(svg.xmlns.svg, 'svg');
|
|
964
|
+
mockSvg.id = id;
|
|
965
|
+
mockSvg.setAttribute('width', width);
|
|
966
|
+
mockSvg.setAttribute('height', height);
|
|
967
|
+
svgweb.appendChild(mockSvg, parentNode);
|
|
968
|
+
|
|
969
|
+
// notice: any call to the raw node before flash init will fail.
|
|
970
|
+
mockSvg.addEventListener('SVGLoad', function(){
|
|
971
|
+
// become loaded
|
|
972
|
+
s.rawNode = this;
|
|
973
|
+
s.isLoaded = true;
|
|
974
|
+
|
|
975
|
+
// init defs
|
|
976
|
+
var defNode = _createElementNS(svg.xmlns.svg, "defs");
|
|
977
|
+
s.rawNode.appendChild(defNode);
|
|
978
|
+
s.defNode = defNode;
|
|
979
|
+
|
|
980
|
+
// notify application
|
|
981
|
+
if (s.onLoad)
|
|
982
|
+
s.onLoad(s);
|
|
983
|
+
}, false);
|
|
984
|
+
|
|
985
|
+
// flash not loaded yet
|
|
986
|
+
s.isLoaded = false;
|
|
987
|
+
return s;
|
|
988
|
+
};
|
|
989
|
+
|
|
990
|
+
// override Surface.destroy()
|
|
991
|
+
svg.Surface.extend({
|
|
992
|
+
destroy: function(){
|
|
993
|
+
var mockSvg = this.rawNode;
|
|
994
|
+
svgweb.removeChild(mockSvg, mockSvg.parentNode);
|
|
995
|
+
}
|
|
996
|
+
});
|
|
997
|
+
|
|
998
|
+
// override connect() & disconnect() for Shape & Surface event processing
|
|
999
|
+
var _eventsProcessing = {
|
|
1000
|
+
connect: function(name, object, method){
|
|
1001
|
+
// connect events using the mock addEventListener() provided by svgweb
|
|
1002
|
+
if (name.substring(0, 2)==='on') { name = name.substring(2); }
|
|
1003
|
+
if (arguments.length == 2) {
|
|
1004
|
+
method = object;
|
|
1005
|
+
} else {
|
|
1006
|
+
method = lang.hitch(object, method);
|
|
1007
|
+
}
|
|
1008
|
+
this.getEventSource().addEventListener(name, method, false);
|
|
1009
|
+
return [this, name, method];
|
|
1010
|
+
},
|
|
1011
|
+
disconnect: function(token){
|
|
1012
|
+
// disconnect events using the mock removeEventListener() provided by svgweb
|
|
1013
|
+
this.getEventSource().removeEventListener(token[1], token[2], false);
|
|
1014
|
+
delete token[0];
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
|
|
1018
|
+
lang.extend(svg.Shape, _eventsProcessing);
|
|
1019
|
+
lang.extend(svg.Surface, _eventsProcessing);
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
return svg;
|
|
1023
|
+
});
|