extjs-rails 4.1.0.alpha5 → 4.1.0.alpha6
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/extjs-rails.js +95613 -11000
- data/lib/extjs-rails/version.rb +1 -1
- metadata +2 -509
- data/app/assets/javascripts/src/AbstractComponent.js +0 -3290
- data/app/assets/javascripts/src/AbstractManager.js +0 -144
- data/app/assets/javascripts/src/AbstractPlugin.js +0 -72
- data/app/assets/javascripts/src/Action.js +0 -276
- data/app/assets/javascripts/src/Ajax.js +0 -99
- data/app/assets/javascripts/src/Component.js +0 -1344
- data/app/assets/javascripts/src/ComponentLoader.js +0 -202
- data/app/assets/javascripts/src/ComponentManager.js +0 -47
- data/app/assets/javascripts/src/ComponentQuery.js +0 -521
- data/app/assets/javascripts/src/Editor.js +0 -494
- data/app/assets/javascripts/src/ElementLoader.js +0 -404
- data/app/assets/javascripts/src/FocusManager.js +0 -712
- data/app/assets/javascripts/src/Img.js +0 -111
- data/app/assets/javascripts/src/Layer.js +0 -543
- data/app/assets/javascripts/src/LoadMask.js +0 -432
- data/app/assets/javascripts/src/ModelManager.js +0 -186
- data/app/assets/javascripts/src/PluginManager.js +0 -110
- data/app/assets/javascripts/src/ProgressBar.js +0 -336
- data/app/assets/javascripts/src/Shadow.js +0 -233
- data/app/assets/javascripts/src/ShadowPool.js +0 -43
- data/app/assets/javascripts/src/Template.js +0 -331
- data/app/assets/javascripts/src/XTemplate.js +0 -365
- data/app/assets/javascripts/src/XTemplateCompiler.js +0 -450
- data/app/assets/javascripts/src/XTemplateParser.js +0 -249
- data/app/assets/javascripts/src/ZIndexManager.js +0 -519
- data/app/assets/javascripts/src/app/Application.js +0 -271
- data/app/assets/javascripts/src/app/Controller.js +0 -458
- data/app/assets/javascripts/src/app/EventBus.js +0 -112
- data/app/assets/javascripts/src/button/Button.js +0 -1483
- data/app/assets/javascripts/src/button/Cycle.js +0 -215
- data/app/assets/javascripts/src/button/Split.js +0 -99
- data/app/assets/javascripts/src/chart/Callout.js +0 -140
- data/app/assets/javascripts/src/chart/Chart.js +0 -966
- data/app/assets/javascripts/src/chart/Highlight.js +0 -172
- data/app/assets/javascripts/src/chart/Label.js +0 -241
- data/app/assets/javascripts/src/chart/Legend.js +0 -474
- data/app/assets/javascripts/src/chart/LegendItem.js +0 -217
- data/app/assets/javascripts/src/chart/Mask.js +0 -230
- data/app/assets/javascripts/src/chart/MaskLayer.js +0 -48
- data/app/assets/javascripts/src/chart/Navigation.js +0 -79
- data/app/assets/javascripts/src/chart/Shape.js +0 -106
- data/app/assets/javascripts/src/chart/Tip.js +0 -98
- data/app/assets/javascripts/src/chart/TipSurface.js +0 -42
- data/app/assets/javascripts/src/chart/axis/Abstract.js +0 -73
- data/app/assets/javascripts/src/chart/axis/Axis.js +0 -961
- data/app/assets/javascripts/src/chart/axis/Category.js +0 -130
- data/app/assets/javascripts/src/chart/axis/Gauge.js +0 -203
- data/app/assets/javascripts/src/chart/axis/Numeric.js +0 -235
- data/app/assets/javascripts/src/chart/axis/Radial.js +0 -204
- data/app/assets/javascripts/src/chart/axis/Time.js +0 -135
- data/app/assets/javascripts/src/chart/series/Area.js +0 -803
- data/app/assets/javascripts/src/chart/series/Bar.js +0 -853
- data/app/assets/javascripts/src/chart/series/Cartesian.js +0 -328
- data/app/assets/javascripts/src/chart/series/Column.js +0 -104
- data/app/assets/javascripts/src/chart/series/Gauge.js +0 -490
- data/app/assets/javascripts/src/chart/series/Line.js +0 -1104
- data/app/assets/javascripts/src/chart/series/Pie.js +0 -1072
- data/app/assets/javascripts/src/chart/series/Radar.js +0 -440
- data/app/assets/javascripts/src/chart/series/Scatter.js +0 -668
- data/app/assets/javascripts/src/chart/series/Series.js +0 -443
- data/app/assets/javascripts/src/chart/theme/Base.js +0 -175
- data/app/assets/javascripts/src/chart/theme/Theme.js +0 -253
- data/app/assets/javascripts/src/container/AbstractContainer.js +0 -1062
- data/app/assets/javascripts/src/container/ButtonGroup.js +0 -143
- data/app/assets/javascripts/src/container/Container.js +0 -212
- data/app/assets/javascripts/src/container/DockingContainer.js +0 -265
- data/app/assets/javascripts/src/container/Viewport.js +0 -184
- data/app/assets/javascripts/src/core/dom/Element.form.js +0 -50
- data/app/assets/javascripts/src/core/dom/Element.static-more.js +0 -159
- data/app/assets/javascripts/src/core/examples/index.html +0 -321
- data/app/assets/javascripts/src/core/examples/index.js +0 -6
- data/app/assets/javascripts/src/core/examples/src/Sample/CTO.js +0 -25
- data/app/assets/javascripts/src/core/examples/src/Sample/CoolGuy.js +0 -20
- data/app/assets/javascripts/src/core/examples/src/Sample/Developer.js +0 -43
- data/app/assets/javascripts/src/core/examples/src/Sample/Gun.js +0 -3
- data/app/assets/javascripts/src/core/examples/src/Sample/HumanResource.js +0 -23
- data/app/assets/javascripts/src/core/examples/src/Sample/Musician.js +0 -20
- data/app/assets/javascripts/src/core/examples/src/Sample/Person.js +0 -50
- data/app/assets/javascripts/src/core/examples/src/Sample/ability/CanComposeSongs.js +0 -9
- data/app/assets/javascripts/src/core/examples/src/Sample/ability/CanPlayGuitar.js +0 -9
- data/app/assets/javascripts/src/core/examples/src/Sample/ability/CanSing.js +0 -18
- data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/A.js +0 -3
- data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/B.js +0 -3
- data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/C.js +0 -3
- data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/D.js +0 -3
- data/app/assets/javascripts/src/core/examples/src/Sample/deadlock/E.js +0 -3
- data/app/assets/javascripts/src/core/examples/src/Sample/notdeadlock/A.js +0 -3
- data/app/assets/javascripts/src/core/examples/src/Sample/notdeadlock/B.js +0 -4
- data/app/assets/javascripts/src/core/examples/src/Sample/notdeadlock/C.js +0 -3
- data/app/assets/javascripts/src/core/src/EventManager.js +0 -1167
- data/app/assets/javascripts/src/core/src/EventObject.js +0 -883
- data/app/assets/javascripts/src/core/src/Ext-more.js +0 -1283
- data/app/assets/javascripts/src/core/src/Ext.js +0 -736
- data/app/assets/javascripts/src/core/src/Support.js +0 -662
- data/app/assets/javascripts/src/core/src/class/Base.js +0 -1085
- data/app/assets/javascripts/src/core/src/class/Class.js +0 -676
- data/app/assets/javascripts/src/core/src/class/ClassManager.js +0 -1591
- data/app/assets/javascripts/src/core/src/class/Loader.js +0 -1423
- data/app/assets/javascripts/src/core/src/dom/AbstractElement.alignment.js +0 -173
- data/app/assets/javascripts/src/core/src/dom/AbstractElement.insertion.js +0 -193
- data/app/assets/javascripts/src/core/src/dom/AbstractElement.js +0 -681
- data/app/assets/javascripts/src/core/src/dom/AbstractElement.position.js +0 -356
- data/app/assets/javascripts/src/core/src/dom/AbstractElement.static.js +0 -474
- data/app/assets/javascripts/src/core/src/dom/AbstractElement.style.js +0 -851
- data/app/assets/javascripts/src/core/src/dom/AbstractElement.traversal.js +0 -180
- data/app/assets/javascripts/src/core/src/dom/AbstractHelper.js +0 -291
- data/app/assets/javascripts/src/core/src/dom/AbstractQuery.js +0 -72
- data/app/assets/javascripts/src/core/src/dom/CompositeElement.js +0 -75
- data/app/assets/javascripts/src/core/src/dom/CompositeElementLite.js +0 -436
- data/app/assets/javascripts/src/core/src/dom/DomQuery-aria.js +0 -1049
- data/app/assets/javascripts/src/core/src/env/Browser.js +0 -186
- data/app/assets/javascripts/src/core/src/env/FeatureDetector.js +0 -274
- data/app/assets/javascripts/src/core/src/env/OS.js +0 -141
- data/app/assets/javascripts/src/core/src/lang/Array.js +0 -1205
- data/app/assets/javascripts/src/core/src/lang/Date.js +0 -1463
- data/app/assets/javascripts/src/core/src/lang/Error.js +0 -326
- data/app/assets/javascripts/src/core/src/lang/Function.js +0 -485
- data/app/assets/javascripts/src/core/src/lang/Number.js +0 -175
- data/app/assets/javascripts/src/core/src/lang/Object.js +0 -606
- data/app/assets/javascripts/src/core/src/lang/String.js +0 -333
- data/app/assets/javascripts/src/core/src/misc/JSON.js +0 -236
- data/app/assets/javascripts/src/core/src/perf/Accumulator.js +0 -244
- data/app/assets/javascripts/src/core/src/perf/Monitor.js +0 -197
- data/app/assets/javascripts/src/core/src/util/DelayedTask.js +0 -71
- data/app/assets/javascripts/src/core/src/util/Event.js +0 -215
- data/app/assets/javascripts/src/core/src/util/Format.js +0 -551
- data/app/assets/javascripts/src/core/src/util/TaskManager.js +0 -417
- data/app/assets/javascripts/src/core/src/version/Version.js +0 -364
- data/app/assets/javascripts/src/core/test/unit/README.MD +0 -91
- data/app/assets/javascripts/src/core/test/unit/bootstrap.js +0 -39
- data/app/assets/javascripts/src/core/test/unit/build/build-data.js +0 -34
- data/app/assets/javascripts/src/core/test/unit/build/build.sh +0 -2
- data/app/assets/javascripts/src/core/test/unit/data.js +0 -27
- data/app/assets/javascripts/src/core/test/unit/index.html +0 -15
- data/app/assets/javascripts/src/core/test/unit/other_specs/dom.html +0 -40
- data/app/assets/javascripts/src/core/test/unit/other_specs/dom/extjs-api.js +0 -12
- data/app/assets/javascripts/src/core/test/unit/other_specs/dom/platform-api.js +0 -134
- data/app/assets/javascripts/src/core/test/unit/other_specs/dom/sanity.js +0 -4
- data/app/assets/javascripts/src/core/test/unit/other_specs/dom/touch-api-out.js +0 -128
- data/app/assets/javascripts/src/core/test/unit/other_specs/dom/touch-api.js +0 -89
- data/app/assets/javascripts/src/core/test/unit/other_specs/env/Environment.js +0 -357
- data/app/assets/javascripts/src/core/test/unit/resources/APITest.js +0 -37
- data/app/assets/javascripts/src/core/test/unit/resources/jsb3.js +0 -14
- data/app/assets/javascripts/src/core/test/unit/resources/test-setup.js +0 -137
- data/app/assets/javascripts/src/core/test/unit/spec/EventManager.js +0 -629
- data/app/assets/javascripts/src/core/test/unit/spec/Ext-mess.backup +0 -198
- data/app/assets/javascripts/src/core/test/unit/spec/Ext-more.js +0 -520
- data/app/assets/javascripts/src/core/test/unit/spec/Ext.js +0 -1550
- data/app/assets/javascripts/src/core/test/unit/spec/Support.js +0 -250
- data/app/assets/javascripts/src/core/test/unit/spec/class/Base.js +0 -47
- data/app/assets/javascripts/src/core/test/unit/spec/class/Class.js +0 -561
- data/app/assets/javascripts/src/core/test/unit/spec/class/ClassManager.js +0 -555
- data/app/assets/javascripts/src/core/test/unit/spec/dom/CompositeElementLite.js +0 -409
- data/app/assets/javascripts/src/core/test/unit/spec/dom/DomHelper.js +0 -444
- data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.insertion.js +0 -342
- data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.js +0 -731
- data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.static.js +0 -201
- data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.style.js +0 -118
- data/app/assets/javascripts/src/core/test/unit/spec/dom/Element.traversal.js +0 -336
- data/app/assets/javascripts/src/core/test/unit/spec/lang/Array.js +0 -1229
- data/app/assets/javascripts/src/core/test/unit/spec/lang/Date.js +0 -697
- data/app/assets/javascripts/src/core/test/unit/spec/lang/Error.js +0 -277
- data/app/assets/javascripts/src/core/test/unit/spec/lang/Function.js +0 -536
- data/app/assets/javascripts/src/core/test/unit/spec/lang/Number.js +0 -323
- data/app/assets/javascripts/src/core/test/unit/spec/lang/Object.js +0 -591
- data/app/assets/javascripts/src/core/test/unit/spec/lang/String.js +0 -451
- data/app/assets/javascripts/src/core/test/unit/spec/misc/JSON.js +0 -252
- data/app/assets/javascripts/src/core/test/unit/spec/util/Format.js +0 -521
- data/app/assets/javascripts/src/core/test/unit/spec/version/Version.js +0 -148
- data/app/assets/javascripts/src/core/test/unit/specs.html +0 -19
- data/app/assets/javascripts/src/data/AbstractStore.js +0 -887
- data/app/assets/javascripts/src/data/ArrayStore.js +0 -74
- data/app/assets/javascripts/src/data/Batch.js +0 -236
- data/app/assets/javascripts/src/data/BufferStore.js +0 -13
- data/app/assets/javascripts/src/data/Connection.js +0 -969
- data/app/assets/javascripts/src/data/DirectStore.js +0 -50
- data/app/assets/javascripts/src/data/Errors.js +0 -52
- data/app/assets/javascripts/src/data/Field.js +0 -341
- data/app/assets/javascripts/src/data/IdGenerator.js +0 -198
- data/app/assets/javascripts/src/data/JsonP.js +0 -253
- data/app/assets/javascripts/src/data/JsonPStore.js +0 -51
- data/app/assets/javascripts/src/data/JsonStore.js +0 -60
- data/app/assets/javascripts/src/data/Model.js +0 -1673
- data/app/assets/javascripts/src/data/NodeInterface.js +0 -1294
- data/app/assets/javascripts/src/data/NodeStore.js +0 -254
- data/app/assets/javascripts/src/data/Operation.js +0 -331
- data/app/assets/javascripts/src/data/Request.js +0 -40
- data/app/assets/javascripts/src/data/ResultSet.js +0 -56
- data/app/assets/javascripts/src/data/SequentialIdGenerator.js +0 -61
- data/app/assets/javascripts/src/data/SortTypes.js +0 -125
- data/app/assets/javascripts/src/data/Store.js +0 -2609
- data/app/assets/javascripts/src/data/StoreManager.js +0 -156
- data/app/assets/javascripts/src/data/Tree.js +0 -290
- data/app/assets/javascripts/src/data/TreeStore.js +0 -655
- data/app/assets/javascripts/src/data/Types.js +0 -190
- data/app/assets/javascripts/src/data/UuidGenerator.js +0 -215
- data/app/assets/javascripts/src/data/XmlStore.js +0 -76
- data/app/assets/javascripts/src/data/association/Association.js +0 -243
- data/app/assets/javascripts/src/data/association/BelongsTo.js +0 -291
- data/app/assets/javascripts/src/data/association/HasMany.js +0 -289
- data/app/assets/javascripts/src/data/association/HasOne.js +0 -304
- data/app/assets/javascripts/src/data/proxy/Ajax.js +0 -282
- data/app/assets/javascripts/src/data/proxy/Client.js +0 -21
- data/app/assets/javascripts/src/data/proxy/Direct.js +0 -181
- data/app/assets/javascripts/src/data/proxy/JsonP.js +0 -313
- data/app/assets/javascripts/src/data/proxy/LocalStorage.js +0 -69
- data/app/assets/javascripts/src/data/proxy/Memory.js +0 -156
- data/app/assets/javascripts/src/data/proxy/Proxy.js +0 -433
- data/app/assets/javascripts/src/data/proxy/Rest.js +0 -173
- data/app/assets/javascripts/src/data/proxy/Server.js +0 -460
- data/app/assets/javascripts/src/data/proxy/SessionStorage.js +0 -39
- data/app/assets/javascripts/src/data/proxy/WebStorage.js +0 -546
- data/app/assets/javascripts/src/data/reader/Array.js +0 -68
- data/app/assets/javascripts/src/data/reader/Json.js +0 -383
- data/app/assets/javascripts/src/data/reader/Reader.js +0 -735
- data/app/assets/javascripts/src/data/reader/Xml.js +0 -292
- data/app/assets/javascripts/src/data/validations.js +0 -149
- data/app/assets/javascripts/src/data/writer/Json.js +0 -81
- data/app/assets/javascripts/src/data/writer/Writer.js +0 -147
- data/app/assets/javascripts/src/data/writer/Xml.js +0 -88
- data/app/assets/javascripts/src/dd/DD.js +0 -300
- data/app/assets/javascripts/src/dd/DDProxy.js +0 -204
- data/app/assets/javascripts/src/dd/DDTarget.js +0 -171
- data/app/assets/javascripts/src/dd/DragDrop.js +0 -1101
- data/app/assets/javascripts/src/dd/DragDropManager.js +0 -1264
- data/app/assets/javascripts/src/dd/DragSource.js +0 -392
- data/app/assets/javascripts/src/dd/DragTracker.js +0 -562
- data/app/assets/javascripts/src/dd/DragZone.js +0 -137
- data/app/assets/javascripts/src/dd/DropTarget.js +0 -118
- data/app/assets/javascripts/src/dd/DropZone.js +0 -254
- data/app/assets/javascripts/src/dd/Registry.js +0 -117
- data/app/assets/javascripts/src/dd/ScrollManager.js +0 -218
- data/app/assets/javascripts/src/dd/StatusProxy.js +0 -179
- data/app/assets/javascripts/src/diag/layout/Context.js +0 -523
- data/app/assets/javascripts/src/diag/layout/ContextItem.js +0 -179
- data/app/assets/javascripts/src/direct/Event.js +0 -35
- data/app/assets/javascripts/src/direct/ExceptionEvent.js +0 -16
- data/app/assets/javascripts/src/direct/JsonProvider.js +0 -82
- data/app/assets/javascripts/src/direct/Manager.js +0 -263
- data/app/assets/javascripts/src/direct/PollingProvider.js +0 -156
- data/app/assets/javascripts/src/direct/Provider.js +0 -96
- data/app/assets/javascripts/src/direct/RemotingEvent.js +0 -24
- data/app/assets/javascripts/src/direct/RemotingMethod.js +0 -100
- data/app/assets/javascripts/src/direct/RemotingProvider.js +0 -510
- data/app/assets/javascripts/src/direct/Transaction.js +0 -41
- data/app/assets/javascripts/src/dom/Element.alignment.js +0 -378
- data/app/assets/javascripts/src/dom/Element.anim.js +0 -962
- data/app/assets/javascripts/src/dom/Element.dd.js +0 -40
- data/app/assets/javascripts/src/dom/Element.fx.js +0 -194
- data/app/assets/javascripts/src/dom/Element.js +0 -1407
- data/app/assets/javascripts/src/dom/Element.position.js +0 -501
- data/app/assets/javascripts/src/dom/Element.scroll.js +0 -214
- data/app/assets/javascripts/src/dom/Element.style.js +0 -792
- data/app/assets/javascripts/src/dom/Element.traversal.js +0 -8
- data/app/assets/javascripts/src/dom/Helper.js +0 -466
- data/app/assets/javascripts/src/dom/Query.js +0 -1067
- data/app/assets/javascripts/src/draw/Color.js +0 -303
- data/app/assets/javascripts/src/draw/Component.js +0 -245
- data/app/assets/javascripts/src/draw/CompositeSprite.js +0 -299
- data/app/assets/javascripts/src/draw/Draw.js +0 -1217
- data/app/assets/javascripts/src/draw/Matrix.js +0 -183
- data/app/assets/javascripts/src/draw/Sprite.js +0 -554
- data/app/assets/javascripts/src/draw/SpriteDD.js +0 -87
- data/app/assets/javascripts/src/draw/Surface.js +0 -1001
- data/app/assets/javascripts/src/draw/Text.js +0 -175
- data/app/assets/javascripts/src/draw/engine/ImageExporter.js +0 -106
- data/app/assets/javascripts/src/draw/engine/Svg.js +0 -734
- data/app/assets/javascripts/src/draw/engine/SvgExporter.js +0 -280
- data/app/assets/javascripts/src/draw/engine/Vml.js +0 -916
- data/app/assets/javascripts/src/flash/Component.js +0 -248
- data/app/assets/javascripts/src/form/Basic.js +0 -1018
- data/app/assets/javascripts/src/form/CheckboxGroup.js +0 -441
- data/app/assets/javascripts/src/form/CheckboxManager.js +0 -26
- data/app/assets/javascripts/src/form/FieldAncestor.js +0 -210
- data/app/assets/javascripts/src/form/FieldContainer.js +0 -290
- data/app/assets/javascripts/src/form/FieldSet.js +0 -506
- data/app/assets/javascripts/src/form/Label.js +0 -110
- data/app/assets/javascripts/src/form/Labelable.js +0 -764
- data/app/assets/javascripts/src/form/Panel.js +0 -335
- data/app/assets/javascripts/src/form/RadioGroup.js +0 -124
- data/app/assets/javascripts/src/form/RadioManager.js +0 -26
- data/app/assets/javascripts/src/form/action/Action.js +0 -307
- data/app/assets/javascripts/src/form/action/DirectLoad.js +0 -107
- data/app/assets/javascripts/src/form/action/DirectSubmit.js +0 -119
- data/app/assets/javascripts/src/form/action/Load.js +0 -120
- data/app/assets/javascripts/src/form/action/StandardSubmit.js +0 -34
- data/app/assets/javascripts/src/form/action/Submit.js +0 -257
- data/app/assets/javascripts/src/form/field/Base.js +0 -813
- data/app/assets/javascripts/src/form/field/Checkbox.js +0 -505
- data/app/assets/javascripts/src/form/field/ComboBox.js +0 -1427
- data/app/assets/javascripts/src/form/field/Date.js +0 -578
- data/app/assets/javascripts/src/form/field/Display.js +0 -155
- data/app/assets/javascripts/src/form/field/Field.js +0 -430
- data/app/assets/javascripts/src/form/field/File.js +0 -265
- data/app/assets/javascripts/src/form/field/Hidden.js +0 -75
- data/app/assets/javascripts/src/form/field/HtmlEditor.js +0 -1439
- data/app/assets/javascripts/src/form/field/Number.js +0 -380
- data/app/assets/javascripts/src/form/field/Picker.js +0 -321
- data/app/assets/javascripts/src/form/field/Radio.js +0 -279
- data/app/assets/javascripts/src/form/field/Spinner.js +0 -321
- data/app/assets/javascripts/src/form/field/Text.js +0 -727
- data/app/assets/javascripts/src/form/field/TextArea.js +0 -228
- data/app/assets/javascripts/src/form/field/Time.js +0 -459
- data/app/assets/javascripts/src/form/field/Trigger.js +0 -469
- data/app/assets/javascripts/src/form/field/VTypes.js +0 -172
- data/app/assets/javascripts/src/fx/Anim.js +0 -472
- data/app/assets/javascripts/src/fx/Animator.js +0 -410
- data/app/assets/javascripts/src/fx/CubicBezier.js +0 -77
- data/app/assets/javascripts/src/fx/Easing.js +0 -136
- data/app/assets/javascripts/src/fx/Manager.js +0 -353
- data/app/assets/javascripts/src/fx/PropertyHandler.js +0 -381
- data/app/assets/javascripts/src/fx/Queue.js +0 -123
- data/app/assets/javascripts/src/fx/target/Component.js +0 -118
- data/app/assets/javascripts/src/fx/target/CompositeElement.js +0 -46
- data/app/assets/javascripts/src/fx/target/CompositeElementCSS.js +0 -22
- data/app/assets/javascripts/src/fx/target/CompositeSprite.js +0 -34
- data/app/assets/javascripts/src/fx/target/Element.js +0 -83
- data/app/assets/javascripts/src/fx/target/ElementCSS.js +0 -77
- data/app/assets/javascripts/src/fx/target/Sprite.js +0 -128
- data/app/assets/javascripts/src/fx/target/Target.js +0 -36
- data/app/assets/javascripts/src/grid/CellEditor.js +0 -172
- data/app/assets/javascripts/src/grid/ColumnComponentLayout.js +0 -34
- data/app/assets/javascripts/src/grid/ColumnLayout.js +0 -201
- data/app/assets/javascripts/src/grid/Lockable.js +0 -863
- data/app/assets/javascripts/src/grid/LockingView.js +0 -169
- data/app/assets/javascripts/src/grid/PagingScroller.js +0 -539
- data/app/assets/javascripts/src/grid/Panel.js +0 -393
- data/app/assets/javascripts/src/grid/RowEditor.js +0 -731
- data/app/assets/javascripts/src/grid/RowNumberer.js +0 -76
- data/app/assets/javascripts/src/grid/Scroller.js +0 -5
- data/app/assets/javascripts/src/grid/View.js +0 -44
- data/app/assets/javascripts/src/grid/ViewDropZone.js +0 -41
- data/app/assets/javascripts/src/grid/column/Action.js +0 -318
- data/app/assets/javascripts/src/grid/column/Boolean.js +0 -82
- data/app/assets/javascripts/src/grid/column/Column.js +0 -835
- data/app/assets/javascripts/src/grid/column/Date.js +0 -63
- data/app/assets/javascripts/src/grid/column/Number.js +0 -52
- data/app/assets/javascripts/src/grid/column/Template.js +0 -58
- data/app/assets/javascripts/src/grid/feature/AbstractSummary.js +0 -154
- data/app/assets/javascripts/src/grid/feature/Chunking.js +0 -77
- data/app/assets/javascripts/src/grid/feature/Feature.js +0 -158
- data/app/assets/javascripts/src/grid/feature/Grouping.js +0 -822
- data/app/assets/javascripts/src/grid/feature/GroupingSummary.js +0 -243
- data/app/assets/javascripts/src/grid/feature/RowBody.js +0 -116
- data/app/assets/javascripts/src/grid/feature/RowWrap.js +0 -120
- data/app/assets/javascripts/src/grid/feature/Summary.js +0 -167
- data/app/assets/javascripts/src/grid/header/Container.js +0 -965
- data/app/assets/javascripts/src/grid/header/DragZone.js +0 -69
- data/app/assets/javascripts/src/grid/header/DropZone.js +0 -265
- data/app/assets/javascripts/src/grid/plugin/CellEditing.js +0 -453
- data/app/assets/javascripts/src/grid/plugin/DragDrop.js +0 -254
- data/app/assets/javascripts/src/grid/plugin/Editing.js +0 -561
- data/app/assets/javascripts/src/grid/plugin/HeaderReorderer.js +0 -49
- data/app/assets/javascripts/src/grid/plugin/HeaderResizer.js +0 -292
- data/app/assets/javascripts/src/grid/plugin/RowEditing.js +0 -339
- data/app/assets/javascripts/src/grid/property/Grid.js +0 -351
- data/app/assets/javascripts/src/grid/property/HeaderContainer.js +0 -109
- data/app/assets/javascripts/src/grid/property/Property.js +0 -36
- data/app/assets/javascripts/src/grid/property/Store.js +0 -141
- data/app/assets/javascripts/src/layout/ClassList.js +0 -90
- data/app/assets/javascripts/src/layout/Context.js +0 -1232
- data/app/assets/javascripts/src/layout/ContextItem.js +0 -1470
- data/app/assets/javascripts/src/layout/Layout.js +0 -761
- data/app/assets/javascripts/src/layout/component/Auto.js +0 -220
- data/app/assets/javascripts/src/layout/component/Body.js +0 -80
- data/app/assets/javascripts/src/layout/component/BoundList.js +0 -95
- data/app/assets/javascripts/src/layout/component/Button.js +0 -261
- data/app/assets/javascripts/src/layout/component/Component.js +0 -427
- data/app/assets/javascripts/src/layout/component/Dock.js +0 -1132
- data/app/assets/javascripts/src/layout/component/Draw.js +0 -79
- data/app/assets/javascripts/src/layout/component/FieldSet.js +0 -62
- data/app/assets/javascripts/src/layout/component/ProgressBar.js +0 -54
- data/app/assets/javascripts/src/layout/component/Tab.js +0 -23
- data/app/assets/javascripts/src/layout/component/field/ComboBox.js +0 -52
- data/app/assets/javascripts/src/layout/component/field/Field.js +0 -372
- data/app/assets/javascripts/src/layout/component/field/FieldContainer.js +0 -48
- data/app/assets/javascripts/src/layout/component/field/HtmlEditor.js +0 -54
- data/app/assets/javascripts/src/layout/component/field/Slider.js +0 -58
- data/app/assets/javascripts/src/layout/component/field/Text.js +0 -75
- data/app/assets/javascripts/src/layout/component/field/TextArea.js +0 -51
- data/app/assets/javascripts/src/layout/component/field/Trigger.js +0 -132
- data/app/assets/javascripts/src/layout/container/Absolute.js +0 -121
- data/app/assets/javascripts/src/layout/container/Accordion.js +0 -308
- data/app/assets/javascripts/src/layout/container/Anchor.js +0 -403
- data/app/assets/javascripts/src/layout/container/Auto.js +0 -70
- data/app/assets/javascripts/src/layout/container/Border-old-js +0 -1079
- data/app/assets/javascripts/src/layout/container/Border.js +0 -816
- data/app/assets/javascripts/src/layout/container/Box.js +0 -929
- data/app/assets/javascripts/src/layout/container/Card.js +0 -361
- data/app/assets/javascripts/src/layout/container/CheckboxGroup.js +0 -376
- data/app/assets/javascripts/src/layout/container/Column.js +0 -234
- data/app/assets/javascripts/src/layout/container/Container.js +0 -961
- data/app/assets/javascripts/src/layout/container/Editor.js +0 -74
- data/app/assets/javascripts/src/layout/container/Fit.js +0 -287
- data/app/assets/javascripts/src/layout/container/Form.js +0 -157
- data/app/assets/javascripts/src/layout/container/HBox.js +0 -134
- data/app/assets/javascripts/src/layout/container/Table.js +0 -412
- data/app/assets/javascripts/src/layout/container/VBox.js +0 -139
- data/app/assets/javascripts/src/layout/container/boxOverflow/Menu.js +0 -365
- data/app/assets/javascripts/src/layout/container/boxOverflow/None.js +0 -83
- data/app/assets/javascripts/src/layout/container/boxOverflow/Scroller.js +0 -475
- data/app/assets/javascripts/src/menu/CheckItem.js +0 -169
- data/app/assets/javascripts/src/menu/ColorPicker.js +0 -110
- data/app/assets/javascripts/src/menu/DatePicker.js +0 -100
- data/app/assets/javascripts/src/menu/Item.js +0 -553
- data/app/assets/javascripts/src/menu/KeyNav.js +0 -134
- data/app/assets/javascripts/src/menu/Manager.js +0 -219
- data/app/assets/javascripts/src/menu/Menu.js +0 -579
- data/app/assets/javascripts/src/menu/Separator.js +0 -126
- data/app/assets/javascripts/src/panel/AbstractPanel.js +0 -323
- data/app/assets/javascripts/src/panel/DD.js +0 -99
- data/app/assets/javascripts/src/panel/Header.js +0 -518
- data/app/assets/javascripts/src/panel/Panel.js +0 -2150
- data/app/assets/javascripts/src/panel/Proxy.js +0 -131
- data/app/assets/javascripts/src/panel/Table.js +0 -1018
- data/app/assets/javascripts/src/panel/Tool.js +0 -304
- data/app/assets/javascripts/src/picker/Color.js +0 -219
- data/app/assets/javascripts/src/picker/Date.js +0 -1140
- data/app/assets/javascripts/src/picker/Month.js +0 -490
- data/app/assets/javascripts/src/picker/Time.js +0 -165
- data/app/assets/javascripts/src/resizer/BorderSplitter.js +0 -22
- data/app/assets/javascripts/src/resizer/BorderSplitterTracker.js +0 -210
- data/app/assets/javascripts/src/resizer/Handle.js +0 -29
- data/app/assets/javascripts/src/resizer/ResizeTracker.js +0 -346
- data/app/assets/javascripts/src/resizer/Resizer.js +0 -477
- data/app/assets/javascripts/src/resizer/Splitter.js +0 -242
- data/app/assets/javascripts/src/resizer/SplitterTracker.js +0 -230
- data/app/assets/javascripts/src/selection/CellModel.js +0 -395
- data/app/assets/javascripts/src/selection/CheckboxModel.js +0 -234
- data/app/assets/javascripts/src/selection/DataViewModel.js +0 -160
- data/app/assets/javascripts/src/selection/Model.js +0 -646
- data/app/assets/javascripts/src/selection/RowModel.js +0 -499
- data/app/assets/javascripts/src/selection/TreeModel.js +0 -78
- data/app/assets/javascripts/src/slider/Multi.js +0 -835
- data/app/assets/javascripts/src/slider/Single.js +0 -56
- data/app/assets/javascripts/src/slider/Thumb.js +0 -259
- data/app/assets/javascripts/src/slider/Tip.js +0 -130
- data/app/assets/javascripts/src/state/CookieProvider.js +0 -120
- data/app/assets/javascripts/src/state/LocalStorageProvider.js +0 -72
- data/app/assets/javascripts/src/state/Manager.js +0 -70
- data/app/assets/javascripts/src/state/Provider.js +0 -182
- data/app/assets/javascripts/src/state/Stateful.js +0 -364
- data/app/assets/javascripts/src/tab/Bar.js +0 -258
- data/app/assets/javascripts/src/tab/Panel.js +0 -654
- data/app/assets/javascripts/src/tab/Tab.js +0 -358
- data/app/assets/javascripts/src/tail.js +0 -10
- data/app/assets/javascripts/src/tip/QuickTip.js +0 -335
- data/app/assets/javascripts/src/tip/QuickTipManager.js +0 -239
- data/app/assets/javascripts/src/tip/Tip.js +0 -160
- data/app/assets/javascripts/src/tip/ToolTip.js +0 -691
- data/app/assets/javascripts/src/toolbar/Fill.js +0 -28
- data/app/assets/javascripts/src/toolbar/Item.js +0 -16
- data/app/assets/javascripts/src/toolbar/Paging.js +0 -600
- data/app/assets/javascripts/src/toolbar/Separator.js +0 -23
- data/app/assets/javascripts/src/toolbar/Spacer.js +0 -33
- data/app/assets/javascripts/src/toolbar/TextItem.js +0 -57
- data/app/assets/javascripts/src/toolbar/Toolbar-legacy.js +0 -123
- data/app/assets/javascripts/src/toolbar/Toolbar.js +0 -447
- data/app/assets/javascripts/src/tree/Column.js +0 -90
- data/app/assets/javascripts/src/tree/Panel.js +0 -505
- data/app/assets/javascripts/src/tree/View.js +0 -658
- data/app/assets/javascripts/src/tree/ViewDragZone.js +0 -49
- data/app/assets/javascripts/src/tree/ViewDropZone.js +0 -287
- data/app/assets/javascripts/src/tree/plugin/TreeViewDragDrop.js +0 -244
- data/app/assets/javascripts/src/util/AbstractMixedCollection.js +0 -772
- data/app/assets/javascripts/src/util/Animate.js +0 -426
- data/app/assets/javascripts/src/util/Bindable.js +0 -102
- data/app/assets/javascripts/src/util/CSS.js +0 -185
- data/app/assets/javascripts/src/util/ClickRepeater.js +0 -238
- data/app/assets/javascripts/src/util/ComponentDragger.js +0 -126
- data/app/assets/javascripts/src/util/Cookies.js +0 -91
- data/app/assets/javascripts/src/util/ElementContainer.js +0 -293
- data/app/assets/javascripts/src/util/Filter.js +0 -159
- data/app/assets/javascripts/src/util/Floating.js +0 -321
- data/app/assets/javascripts/src/util/Grouper.js +0 -26
- data/app/assets/javascripts/src/util/HashMap.js +0 -356
- data/app/assets/javascripts/src/util/History.js +0 -285
- data/app/assets/javascripts/src/util/Inflector.js +0 -297
- data/app/assets/javascripts/src/util/KeyMap.js +0 -427
- data/app/assets/javascripts/src/util/KeyNav.js +0 -239
- data/app/assets/javascripts/src/util/LruCache.js +0 -257
- data/app/assets/javascripts/src/util/Memento.js +0 -131
- data/app/assets/javascripts/src/util/MixedCollection.js +0 -239
- data/app/assets/javascripts/src/util/Observable.js +0 -1003
- data/app/assets/javascripts/src/util/Offset.js +0 -60
- data/app/assets/javascripts/src/util/Point.js +0 -93
- data/app/assets/javascripts/src/util/ProtoElement.js +0 -205
- data/app/assets/javascripts/src/util/Queue.js +0 -76
- data/app/assets/javascripts/src/util/Region.js +0 -388
- data/app/assets/javascripts/src/util/Renderable.js +0 -1079
- data/app/assets/javascripts/src/util/Sortable.js +0 -248
- data/app/assets/javascripts/src/util/Sorter.js +0 -179
- data/app/assets/javascripts/src/util/TextMetrics.js +0 -148
- data/app/assets/javascripts/src/view/AbstractView.js +0 -1103
- data/app/assets/javascripts/src/view/BoundList.js +0 -207
- data/app/assets/javascripts/src/view/BoundListKeyNav.js +0 -92
- data/app/assets/javascripts/src/view/DragZone.js +0 -106
- data/app/assets/javascripts/src/view/DropZone.js +0 -240
- data/app/assets/javascripts/src/view/Table.js +0 -1229
- data/app/assets/javascripts/src/view/TableChunker.js +0 -139
- data/app/assets/javascripts/src/view/View.js +0 -636
- data/app/assets/javascripts/src/window/MessageBox.js +0 -880
- data/app/assets/javascripts/src/window/Window-legacy.js +0 -56
- data/app/assets/javascripts/src/window/Window.js +0 -793
@@ -1,299 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @class Ext.draw.CompositeSprite
|
3
|
-
*
|
4
|
-
* A composite Sprite handles a group of sprites with common methods to a sprite
|
5
|
-
* such as `hide`, `show`, `setAttributes`. These methods are applied to the set of sprites
|
6
|
-
* added to the group.
|
7
|
-
*
|
8
|
-
* CompositeSprite extends {@link Ext.util.MixedCollection} so you can use the same methods
|
9
|
-
* in `MixedCollection` to iterate through sprites, add and remove elements, etc.
|
10
|
-
*
|
11
|
-
* In order to create a CompositeSprite, one has to provide a handle to the surface where it is
|
12
|
-
* rendered:
|
13
|
-
*
|
14
|
-
* var group = Ext.create('Ext.draw.CompositeSprite', {
|
15
|
-
* surface: drawComponent.surface
|
16
|
-
* });
|
17
|
-
*
|
18
|
-
* Then just by using `MixedCollection` methods it's possible to add {@link Ext.draw.Sprite}s:
|
19
|
-
*
|
20
|
-
* group.add(sprite1);
|
21
|
-
* group.add(sprite2);
|
22
|
-
* group.add(sprite3);
|
23
|
-
*
|
24
|
-
* And then apply common Sprite methods to them:
|
25
|
-
*
|
26
|
-
* group.setAttributes({
|
27
|
-
* fill: '#f00'
|
28
|
-
* }, true);
|
29
|
-
*/
|
30
|
-
Ext.define('Ext.draw.CompositeSprite', {
|
31
|
-
|
32
|
-
/* Begin Definitions */
|
33
|
-
|
34
|
-
extend: 'Ext.util.MixedCollection',
|
35
|
-
mixins: {
|
36
|
-
animate: 'Ext.util.Animate'
|
37
|
-
},
|
38
|
-
autoDestroy: false,
|
39
|
-
|
40
|
-
/* End Definitions */
|
41
|
-
isCompositeSprite: true,
|
42
|
-
constructor: function(config) {
|
43
|
-
var me = this;
|
44
|
-
|
45
|
-
config = config || {};
|
46
|
-
Ext.apply(me, config);
|
47
|
-
|
48
|
-
me.addEvents(
|
49
|
-
'mousedown',
|
50
|
-
'mouseup',
|
51
|
-
'mouseover',
|
52
|
-
'mouseout',
|
53
|
-
'click'
|
54
|
-
);
|
55
|
-
me.id = Ext.id(null, 'ext-sprite-group-');
|
56
|
-
me.callParent();
|
57
|
-
},
|
58
|
-
|
59
|
-
// @private
|
60
|
-
onClick: function(e) {
|
61
|
-
this.fireEvent('click', e);
|
62
|
-
},
|
63
|
-
|
64
|
-
// @private
|
65
|
-
onMouseUp: function(e) {
|
66
|
-
this.fireEvent('mouseup', e);
|
67
|
-
},
|
68
|
-
|
69
|
-
// @private
|
70
|
-
onMouseDown: function(e) {
|
71
|
-
this.fireEvent('mousedown', e);
|
72
|
-
},
|
73
|
-
|
74
|
-
// @private
|
75
|
-
onMouseOver: function(e) {
|
76
|
-
this.fireEvent('mouseover', e);
|
77
|
-
},
|
78
|
-
|
79
|
-
// @private
|
80
|
-
onMouseOut: function(e) {
|
81
|
-
this.fireEvent('mouseout', e);
|
82
|
-
},
|
83
|
-
|
84
|
-
attachEvents: function(o) {
|
85
|
-
var me = this;
|
86
|
-
|
87
|
-
o.on({
|
88
|
-
scope: me,
|
89
|
-
mousedown: me.onMouseDown,
|
90
|
-
mouseup: me.onMouseUp,
|
91
|
-
mouseover: me.onMouseOver,
|
92
|
-
mouseout: me.onMouseOut,
|
93
|
-
click: me.onClick
|
94
|
-
});
|
95
|
-
},
|
96
|
-
|
97
|
-
// Inherit docs from MixedCollection
|
98
|
-
add: function(key, o) {
|
99
|
-
var result = this.callParent(arguments);
|
100
|
-
this.attachEvents(result);
|
101
|
-
return result;
|
102
|
-
},
|
103
|
-
|
104
|
-
insert: function(index, key, o) {
|
105
|
-
return this.callParent(arguments);
|
106
|
-
},
|
107
|
-
|
108
|
-
// Inherit docs from MixedCollection
|
109
|
-
remove: function(o) {
|
110
|
-
var me = this;
|
111
|
-
|
112
|
-
o.un({
|
113
|
-
scope: me,
|
114
|
-
mousedown: me.onMouseDown,
|
115
|
-
mouseup: me.onMouseUp,
|
116
|
-
mouseover: me.onMouseOver,
|
117
|
-
mouseout: me.onMouseOut,
|
118
|
-
click: me.onClick
|
119
|
-
});
|
120
|
-
return me.callParent(arguments);
|
121
|
-
},
|
122
|
-
|
123
|
-
/**
|
124
|
-
* Returns the group bounding box.
|
125
|
-
* Behaves like {@link Ext.draw.Sprite#getBBox} method.
|
126
|
-
* @return {Object} an object with x, y, width, and height properties.
|
127
|
-
*/
|
128
|
-
getBBox: function() {
|
129
|
-
var i = 0,
|
130
|
-
sprite,
|
131
|
-
bb,
|
132
|
-
items = this.items,
|
133
|
-
len = this.length,
|
134
|
-
infinity = Infinity,
|
135
|
-
minX = infinity,
|
136
|
-
maxHeight = -infinity,
|
137
|
-
minY = infinity,
|
138
|
-
maxWidth = -infinity,
|
139
|
-
maxWidthBBox, maxHeightBBox;
|
140
|
-
|
141
|
-
for (; i < len; i++) {
|
142
|
-
sprite = items[i];
|
143
|
-
if (sprite.el && ! sprite.bboxExcluded) {
|
144
|
-
bb = sprite.getBBox();
|
145
|
-
minX = Math.min(minX, bb.x);
|
146
|
-
minY = Math.min(minY, bb.y);
|
147
|
-
maxHeight = Math.max(maxHeight, bb.height + bb.y);
|
148
|
-
maxWidth = Math.max(maxWidth, bb.width + bb.x);
|
149
|
-
}
|
150
|
-
}
|
151
|
-
|
152
|
-
return {
|
153
|
-
x: minX,
|
154
|
-
y: minY,
|
155
|
-
height: maxHeight - minY,
|
156
|
-
width: maxWidth - minX
|
157
|
-
};
|
158
|
-
},
|
159
|
-
|
160
|
-
/**
|
161
|
-
* Iterates through all sprites calling `setAttributes` on each one. For more information {@link Ext.draw.Sprite}
|
162
|
-
* provides a description of the attributes that can be set with this method.
|
163
|
-
* @param {Object} attrs Attributes to be changed on the sprite.
|
164
|
-
* @param {Boolean} redraw Flag to immediatly draw the change.
|
165
|
-
* @return {Ext.draw.CompositeSprite} this
|
166
|
-
*/
|
167
|
-
setAttributes: function(attrs, redraw) {
|
168
|
-
var i = 0,
|
169
|
-
items = this.items,
|
170
|
-
len = this.length;
|
171
|
-
|
172
|
-
for (; i < len; i++) {
|
173
|
-
items[i].setAttributes(attrs, redraw);
|
174
|
-
}
|
175
|
-
return this;
|
176
|
-
},
|
177
|
-
|
178
|
-
/**
|
179
|
-
* Hides all sprites. If the first parameter of the method is true
|
180
|
-
* then a redraw will be forced for each sprite.
|
181
|
-
* @param {Boolean} redraw Flag to immediatly draw the change.
|
182
|
-
* @return {Ext.draw.CompositeSprite} this
|
183
|
-
*/
|
184
|
-
hide: function(redraw) {
|
185
|
-
var i = 0,
|
186
|
-
items = this.items,
|
187
|
-
len = this.length;
|
188
|
-
|
189
|
-
for (; i < len; i++) {
|
190
|
-
items[i].hide(redraw);
|
191
|
-
}
|
192
|
-
return this;
|
193
|
-
},
|
194
|
-
|
195
|
-
/**
|
196
|
-
* Shows all sprites. If the first parameter of the method is true
|
197
|
-
* then a redraw will be forced for each sprite.
|
198
|
-
* @param {Boolean} redraw Flag to immediatly draw the change.
|
199
|
-
* @return {Ext.draw.CompositeSprite} this
|
200
|
-
*/
|
201
|
-
show: function(redraw) {
|
202
|
-
var i = 0,
|
203
|
-
items = this.items,
|
204
|
-
len = this.length;
|
205
|
-
|
206
|
-
for (; i < len; i++) {
|
207
|
-
items[i].show(redraw);
|
208
|
-
}
|
209
|
-
return this;
|
210
|
-
},
|
211
|
-
|
212
|
-
redraw: function() {
|
213
|
-
var me = this,
|
214
|
-
i = 0,
|
215
|
-
items = me.items,
|
216
|
-
surface = me.getSurface(),
|
217
|
-
len = me.length;
|
218
|
-
|
219
|
-
if (surface) {
|
220
|
-
for (; i < len; i++) {
|
221
|
-
surface.renderItem(items[i]);
|
222
|
-
}
|
223
|
-
}
|
224
|
-
return me;
|
225
|
-
},
|
226
|
-
|
227
|
-
setStyle: function(obj) {
|
228
|
-
var i = 0,
|
229
|
-
items = this.items,
|
230
|
-
len = this.length,
|
231
|
-
item, el;
|
232
|
-
|
233
|
-
for (; i < len; i++) {
|
234
|
-
item = items[i];
|
235
|
-
el = item.el;
|
236
|
-
if (el) {
|
237
|
-
el.setStyle(obj);
|
238
|
-
}
|
239
|
-
}
|
240
|
-
},
|
241
|
-
|
242
|
-
addCls: function(obj) {
|
243
|
-
var i = 0,
|
244
|
-
items = this.items,
|
245
|
-
surface = this.getSurface(),
|
246
|
-
len = this.length;
|
247
|
-
|
248
|
-
if (surface) {
|
249
|
-
for (; i < len; i++) {
|
250
|
-
surface.addCls(items[i], obj);
|
251
|
-
}
|
252
|
-
}
|
253
|
-
},
|
254
|
-
|
255
|
-
removeCls: function(obj) {
|
256
|
-
var i = 0,
|
257
|
-
items = this.items,
|
258
|
-
surface = this.getSurface(),
|
259
|
-
len = this.length;
|
260
|
-
|
261
|
-
if (surface) {
|
262
|
-
for (; i < len; i++) {
|
263
|
-
surface.removeCls(items[i], obj);
|
264
|
-
}
|
265
|
-
}
|
266
|
-
},
|
267
|
-
|
268
|
-
/**
|
269
|
-
* Grab the surface from the items
|
270
|
-
* @private
|
271
|
-
* @return {Ext.draw.Surface} The surface, null if not found
|
272
|
-
*/
|
273
|
-
getSurface: function(){
|
274
|
-
var first = this.first();
|
275
|
-
if (first) {
|
276
|
-
return first.surface;
|
277
|
-
}
|
278
|
-
return null;
|
279
|
-
},
|
280
|
-
|
281
|
-
/**
|
282
|
-
* Destroys the SpriteGroup
|
283
|
-
*/
|
284
|
-
destroy: function(){
|
285
|
-
var me = this,
|
286
|
-
surface = me.getSurface(),
|
287
|
-
destroySprites = me.autoDestroy,
|
288
|
-
item;
|
289
|
-
|
290
|
-
if (surface) {
|
291
|
-
while (me.getCount() > 0) {
|
292
|
-
item = me.first();
|
293
|
-
me.remove(item);
|
294
|
-
surface.remove(item, destroySprites);
|
295
|
-
}
|
296
|
-
}
|
297
|
-
me.clearListeners();
|
298
|
-
}
|
299
|
-
});
|
@@ -1,1217 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @class Ext.draw.Draw
|
3
|
-
* Base Drawing class. Provides base drawing functions.
|
4
|
-
* @private
|
5
|
-
*/
|
6
|
-
Ext.define('Ext.draw.Draw', {
|
7
|
-
/* Begin Definitions */
|
8
|
-
|
9
|
-
singleton: true,
|
10
|
-
|
11
|
-
requires: ['Ext.draw.Color'],
|
12
|
-
|
13
|
-
/* End Definitions */
|
14
|
-
|
15
|
-
pathToStringRE: /,?([achlmqrstvxz]),?/gi,
|
16
|
-
pathCommandRE: /([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,
|
17
|
-
pathValuesRE: /(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,
|
18
|
-
stopsRE: /^(\d+%?)$/,
|
19
|
-
radian: Math.PI / 180,
|
20
|
-
|
21
|
-
availableAnimAttrs: {
|
22
|
-
along: "along",
|
23
|
-
blur: null,
|
24
|
-
"clip-rect": "csv",
|
25
|
-
cx: null,
|
26
|
-
cy: null,
|
27
|
-
fill: "color",
|
28
|
-
"fill-opacity": null,
|
29
|
-
"font-size": null,
|
30
|
-
height: null,
|
31
|
-
opacity: null,
|
32
|
-
path: "path",
|
33
|
-
r: null,
|
34
|
-
rotation: "csv",
|
35
|
-
rx: null,
|
36
|
-
ry: null,
|
37
|
-
scale: "csv",
|
38
|
-
stroke: "color",
|
39
|
-
"stroke-opacity": null,
|
40
|
-
"stroke-width": null,
|
41
|
-
translation: "csv",
|
42
|
-
width: null,
|
43
|
-
x: null,
|
44
|
-
y: null
|
45
|
-
},
|
46
|
-
|
47
|
-
is: function(o, type) {
|
48
|
-
type = String(type).toLowerCase();
|
49
|
-
return (type == "object" && o === Object(o)) ||
|
50
|
-
(type == "undefined" && typeof o == type) ||
|
51
|
-
(type == "null" && o === null) ||
|
52
|
-
(type == "array" && Array.isArray && Array.isArray(o)) ||
|
53
|
-
(Object.prototype.toString.call(o).toLowerCase().slice(8, -1)) == type;
|
54
|
-
},
|
55
|
-
|
56
|
-
ellipsePath: function(sprite) {
|
57
|
-
var attr = sprite.attr;
|
58
|
-
return Ext.String.format("M{0},{1}A{2},{3},0,1,1,{0},{4}A{2},{3},0,1,1,{0},{1}z", attr.x, attr.y - attr.ry, attr.rx, attr.ry, attr.y + attr.ry);
|
59
|
-
},
|
60
|
-
|
61
|
-
rectPath: function(sprite) {
|
62
|
-
var attr = sprite.attr;
|
63
|
-
if (attr.radius) {
|
64
|
-
return Ext.String.format("M{0},{1}l{2},0a{3},{3},0,0,1,{3},{3}l0,{5}a{3},{3},0,0,1,{4},{3}l{6},0a{3},{3},0,0,1,{4},{4}l0,{7}a{3},{3},0,0,1,{3},{4}z", attr.x + attr.radius, attr.y, attr.width - attr.radius * 2, attr.radius, -attr.radius, attr.height - attr.radius * 2, attr.radius * 2 - attr.width, attr.radius * 2 - attr.height);
|
65
|
-
}
|
66
|
-
else {
|
67
|
-
return Ext.String.format("M{0},{1}L{2},{1},{2},{3},{0},{3}z", attr.x, attr.y, attr.width + attr.x, attr.height + attr.y);
|
68
|
-
}
|
69
|
-
},
|
70
|
-
|
71
|
-
// To be deprecated, converts itself (an arrayPath) to a proper SVG path string
|
72
|
-
path2string: function () {
|
73
|
-
return this.join(",").replace(Ext.draw.Draw.pathToStringRE, "$1");
|
74
|
-
},
|
75
|
-
|
76
|
-
// Convert the passed arrayPath to a proper SVG path string (d attribute)
|
77
|
-
pathToString: function(arrayPath) {
|
78
|
-
return arrayPath.join(",").replace(Ext.draw.Draw.pathToStringRE, "$1");
|
79
|
-
},
|
80
|
-
|
81
|
-
parsePathString: function (pathString) {
|
82
|
-
if (!pathString) {
|
83
|
-
return null;
|
84
|
-
}
|
85
|
-
var paramCounts = {a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0},
|
86
|
-
data = [],
|
87
|
-
me = this;
|
88
|
-
if (me.is(pathString, "array") && me.is(pathString[0], "array")) { // rough assumption
|
89
|
-
data = me.pathClone(pathString);
|
90
|
-
}
|
91
|
-
if (!data.length) {
|
92
|
-
String(pathString).replace(me.pathCommandRE, function (a, b, c) {
|
93
|
-
var params = [],
|
94
|
-
name = b.toLowerCase();
|
95
|
-
c.replace(me.pathValuesRE, function (a, b) {
|
96
|
-
b && params.push(+b);
|
97
|
-
});
|
98
|
-
if (name == "m" && params.length > 2) {
|
99
|
-
data.push([b].concat(Ext.Array.splice(params, 0, 2)));
|
100
|
-
name = "l";
|
101
|
-
b = (b == "m") ? "l" : "L";
|
102
|
-
}
|
103
|
-
while (params.length >= paramCounts[name]) {
|
104
|
-
data.push([b].concat(Ext.Array.splice(params, 0, paramCounts[name])));
|
105
|
-
if (!paramCounts[name]) {
|
106
|
-
break;
|
107
|
-
}
|
108
|
-
}
|
109
|
-
});
|
110
|
-
}
|
111
|
-
data.toString = me.path2string;
|
112
|
-
return data;
|
113
|
-
},
|
114
|
-
|
115
|
-
mapPath: function (path, matrix) {
|
116
|
-
if (!matrix) {
|
117
|
-
return path;
|
118
|
-
}
|
119
|
-
var x, y, i, ii, j, jj, pathi;
|
120
|
-
path = this.path2curve(path);
|
121
|
-
for (i = 0, ii = path.length; i < ii; i++) {
|
122
|
-
pathi = path[i];
|
123
|
-
for (j = 1, jj = pathi.length; j < jj-1; j += 2) {
|
124
|
-
x = matrix.x(pathi[j], pathi[j + 1]);
|
125
|
-
y = matrix.y(pathi[j], pathi[j + 1]);
|
126
|
-
pathi[j] = x;
|
127
|
-
pathi[j + 1] = y;
|
128
|
-
}
|
129
|
-
}
|
130
|
-
return path;
|
131
|
-
},
|
132
|
-
|
133
|
-
pathClone: function(pathArray) {
|
134
|
-
var res = [],
|
135
|
-
j, jj, i, ii;
|
136
|
-
if (!this.is(pathArray, "array") || !this.is(pathArray && pathArray[0], "array")) { // rough assumption
|
137
|
-
pathArray = this.parsePathString(pathArray);
|
138
|
-
}
|
139
|
-
for (i = 0, ii = pathArray.length; i < ii; i++) {
|
140
|
-
res[i] = [];
|
141
|
-
for (j = 0, jj = pathArray[i].length; j < jj; j++) {
|
142
|
-
res[i][j] = pathArray[i][j];
|
143
|
-
}
|
144
|
-
}
|
145
|
-
res.toString = this.path2string;
|
146
|
-
return res;
|
147
|
-
},
|
148
|
-
|
149
|
-
pathToAbsolute: function (pathArray) {
|
150
|
-
if (!this.is(pathArray, "array") || !this.is(pathArray && pathArray[0], "array")) { // rough assumption
|
151
|
-
pathArray = this.parsePathString(pathArray);
|
152
|
-
}
|
153
|
-
var res = [],
|
154
|
-
x = 0,
|
155
|
-
y = 0,
|
156
|
-
mx = 0,
|
157
|
-
my = 0,
|
158
|
-
i = 0,
|
159
|
-
ln = pathArray.length,
|
160
|
-
r, pathSegment, j, ln2;
|
161
|
-
// MoveTo initial x/y position
|
162
|
-
if (ln && pathArray[0][0] == "M") {
|
163
|
-
x = +pathArray[0][1];
|
164
|
-
y = +pathArray[0][2];
|
165
|
-
mx = x;
|
166
|
-
my = y;
|
167
|
-
i++;
|
168
|
-
res[0] = ["M", x, y];
|
169
|
-
}
|
170
|
-
for (; i < ln; i++) {
|
171
|
-
r = res[i] = [];
|
172
|
-
pathSegment = pathArray[i];
|
173
|
-
if (pathSegment[0] != pathSegment[0].toUpperCase()) {
|
174
|
-
r[0] = pathSegment[0].toUpperCase();
|
175
|
-
switch (r[0]) {
|
176
|
-
// Elliptical Arc
|
177
|
-
case "A":
|
178
|
-
r[1] = pathSegment[1];
|
179
|
-
r[2] = pathSegment[2];
|
180
|
-
r[3] = pathSegment[3];
|
181
|
-
r[4] = pathSegment[4];
|
182
|
-
r[5] = pathSegment[5];
|
183
|
-
r[6] = +(pathSegment[6] + x);
|
184
|
-
r[7] = +(pathSegment[7] + y);
|
185
|
-
break;
|
186
|
-
// Vertical LineTo
|
187
|
-
case "V":
|
188
|
-
r[1] = +pathSegment[1] + y;
|
189
|
-
break;
|
190
|
-
// Horizontal LineTo
|
191
|
-
case "H":
|
192
|
-
r[1] = +pathSegment[1] + x;
|
193
|
-
break;
|
194
|
-
case "M":
|
195
|
-
// MoveTo
|
196
|
-
mx = +pathSegment[1] + x;
|
197
|
-
my = +pathSegment[2] + y;
|
198
|
-
default:
|
199
|
-
j = 1;
|
200
|
-
ln2 = pathSegment.length;
|
201
|
-
for (; j < ln2; j++) {
|
202
|
-
r[j] = +pathSegment[j] + ((j % 2) ? x : y);
|
203
|
-
}
|
204
|
-
}
|
205
|
-
}
|
206
|
-
else {
|
207
|
-
j = 0;
|
208
|
-
ln2 = pathSegment.length;
|
209
|
-
for (; j < ln2; j++) {
|
210
|
-
res[i][j] = pathSegment[j];
|
211
|
-
}
|
212
|
-
}
|
213
|
-
switch (r[0]) {
|
214
|
-
// ClosePath
|
215
|
-
case "Z":
|
216
|
-
x = mx;
|
217
|
-
y = my;
|
218
|
-
break;
|
219
|
-
// Horizontal LineTo
|
220
|
-
case "H":
|
221
|
-
x = r[1];
|
222
|
-
break;
|
223
|
-
// Vertical LineTo
|
224
|
-
case "V":
|
225
|
-
y = r[1];
|
226
|
-
break;
|
227
|
-
// MoveTo
|
228
|
-
case "M":
|
229
|
-
pathSegment = res[i];
|
230
|
-
ln2 = pathSegment.length;
|
231
|
-
mx = pathSegment[ln2 - 2];
|
232
|
-
my = pathSegment[ln2 - 1];
|
233
|
-
default:
|
234
|
-
pathSegment = res[i];
|
235
|
-
ln2 = pathSegment.length;
|
236
|
-
x = pathSegment[ln2 - 2];
|
237
|
-
y = pathSegment[ln2 - 1];
|
238
|
-
}
|
239
|
-
}
|
240
|
-
res.toString = this.path2string;
|
241
|
-
return res;
|
242
|
-
},
|
243
|
-
|
244
|
-
// TO BE DEPRECATED
|
245
|
-
pathToRelative: function (pathArray) {
|
246
|
-
if (!this.is(pathArray, "array") || !this.is(pathArray && pathArray[0], "array")) {
|
247
|
-
pathArray = this.parsePathString(pathArray);
|
248
|
-
}
|
249
|
-
var res = [],
|
250
|
-
x = 0,
|
251
|
-
y = 0,
|
252
|
-
mx = 0,
|
253
|
-
my = 0,
|
254
|
-
start = 0,
|
255
|
-
r,
|
256
|
-
pa,
|
257
|
-
i,
|
258
|
-
j,
|
259
|
-
k,
|
260
|
-
len,
|
261
|
-
ii,
|
262
|
-
jj,
|
263
|
-
kk;
|
264
|
-
|
265
|
-
if (pathArray[0][0] == "M") {
|
266
|
-
x = pathArray[0][1];
|
267
|
-
y = pathArray[0][2];
|
268
|
-
mx = x;
|
269
|
-
my = y;
|
270
|
-
start++;
|
271
|
-
res.push(["M", x, y]);
|
272
|
-
}
|
273
|
-
for (i = start, ii = pathArray.length; i < ii; i++) {
|
274
|
-
r = res[i] = [];
|
275
|
-
pa = pathArray[i];
|
276
|
-
if (pa[0] != pa[0].toLowerCase()) {
|
277
|
-
r[0] = pa[0].toLowerCase();
|
278
|
-
switch (r[0]) {
|
279
|
-
case "a":
|
280
|
-
r[1] = pa[1];
|
281
|
-
r[2] = pa[2];
|
282
|
-
r[3] = pa[3];
|
283
|
-
r[4] = pa[4];
|
284
|
-
r[5] = pa[5];
|
285
|
-
r[6] = +(pa[6] - x).toFixed(3);
|
286
|
-
r[7] = +(pa[7] - y).toFixed(3);
|
287
|
-
break;
|
288
|
-
case "v":
|
289
|
-
r[1] = +(pa[1] - y).toFixed(3);
|
290
|
-
break;
|
291
|
-
case "m":
|
292
|
-
mx = pa[1];
|
293
|
-
my = pa[2];
|
294
|
-
default:
|
295
|
-
for (j = 1, jj = pa.length; j < jj; j++) {
|
296
|
-
r[j] = +(pa[j] - ((j % 2) ? x : y)).toFixed(3);
|
297
|
-
}
|
298
|
-
}
|
299
|
-
} else {
|
300
|
-
r = res[i] = [];
|
301
|
-
if (pa[0] == "m") {
|
302
|
-
mx = pa[1] + x;
|
303
|
-
my = pa[2] + y;
|
304
|
-
}
|
305
|
-
for (k = 0, kk = pa.length; k < kk; k++) {
|
306
|
-
res[i][k] = pa[k];
|
307
|
-
}
|
308
|
-
}
|
309
|
-
len = res[i].length;
|
310
|
-
switch (res[i][0]) {
|
311
|
-
case "z":
|
312
|
-
x = mx;
|
313
|
-
y = my;
|
314
|
-
break;
|
315
|
-
case "h":
|
316
|
-
x += +res[i][len - 1];
|
317
|
-
break;
|
318
|
-
case "v":
|
319
|
-
y += +res[i][len - 1];
|
320
|
-
break;
|
321
|
-
default:
|
322
|
-
x += +res[i][len - 2];
|
323
|
-
y += +res[i][len - 1];
|
324
|
-
}
|
325
|
-
}
|
326
|
-
res.toString = this.path2string;
|
327
|
-
return res;
|
328
|
-
},
|
329
|
-
|
330
|
-
// Returns a path converted to a set of curveto commands
|
331
|
-
path2curve: function (path) {
|
332
|
-
var me = this,
|
333
|
-
points = me.pathToAbsolute(path),
|
334
|
-
ln = points.length,
|
335
|
-
attrs = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},
|
336
|
-
i, seg, segLn, point;
|
337
|
-
|
338
|
-
for (i = 0; i < ln; i++) {
|
339
|
-
points[i] = me.command2curve(points[i], attrs);
|
340
|
-
if (points[i].length > 7) {
|
341
|
-
points[i].shift();
|
342
|
-
point = points[i];
|
343
|
-
while (point.length) {
|
344
|
-
Ext.Array.splice(points, i++, 0, ["C"].concat(Ext.Array.splice(point, 0, 6)));
|
345
|
-
}
|
346
|
-
Ext.Array.erase(points, i, 1);
|
347
|
-
ln = points.length;
|
348
|
-
i--;
|
349
|
-
}
|
350
|
-
seg = points[i];
|
351
|
-
segLn = seg.length;
|
352
|
-
attrs.x = seg[segLn - 2];
|
353
|
-
attrs.y = seg[segLn - 1];
|
354
|
-
attrs.bx = parseFloat(seg[segLn - 4]) || attrs.x;
|
355
|
-
attrs.by = parseFloat(seg[segLn - 3]) || attrs.y;
|
356
|
-
}
|
357
|
-
return points;
|
358
|
-
},
|
359
|
-
|
360
|
-
interpolatePaths: function (path, path2) {
|
361
|
-
var me = this,
|
362
|
-
p = me.pathToAbsolute(path),
|
363
|
-
p2 = me.pathToAbsolute(path2),
|
364
|
-
attrs = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},
|
365
|
-
attrs2 = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null},
|
366
|
-
fixArc = function (pp, i) {
|
367
|
-
if (pp[i].length > 7) {
|
368
|
-
pp[i].shift();
|
369
|
-
var pi = pp[i];
|
370
|
-
while (pi.length) {
|
371
|
-
Ext.Array.splice(pp, i++, 0, ["C"].concat(Ext.Array.splice(pi, 0, 6)));
|
372
|
-
}
|
373
|
-
Ext.Array.erase(pp, i, 1);
|
374
|
-
ii = Math.max(p.length, p2.length || 0);
|
375
|
-
}
|
376
|
-
},
|
377
|
-
fixM = function (path1, path2, a1, a2, i) {
|
378
|
-
if (path1 && path2 && path1[i][0] == "M" && path2[i][0] != "M") {
|
379
|
-
Ext.Array.splice(path2, i, 0, ["M", a2.x, a2.y]);
|
380
|
-
a1.bx = 0;
|
381
|
-
a1.by = 0;
|
382
|
-
a1.x = path1[i][1];
|
383
|
-
a1.y = path1[i][2];
|
384
|
-
ii = Math.max(p.length, p2.length || 0);
|
385
|
-
}
|
386
|
-
},
|
387
|
-
i, ii,
|
388
|
-
seg, seg2, seglen, seg2len;
|
389
|
-
for (i = 0, ii = Math.max(p.length, p2.length || 0); i < ii; i++) {
|
390
|
-
p[i] = me.command2curve(p[i], attrs);
|
391
|
-
fixArc(p, i);
|
392
|
-
(p2[i] = me.command2curve(p2[i], attrs2));
|
393
|
-
fixArc(p2, i);
|
394
|
-
fixM(p, p2, attrs, attrs2, i);
|
395
|
-
fixM(p2, p, attrs2, attrs, i);
|
396
|
-
seg = p[i];
|
397
|
-
seg2 = p2[i];
|
398
|
-
seglen = seg.length;
|
399
|
-
seg2len = seg2.length;
|
400
|
-
attrs.x = seg[seglen - 2];
|
401
|
-
attrs.y = seg[seglen - 1];
|
402
|
-
attrs.bx = parseFloat(seg[seglen - 4]) || attrs.x;
|
403
|
-
attrs.by = parseFloat(seg[seglen - 3]) || attrs.y;
|
404
|
-
attrs2.bx = (parseFloat(seg2[seg2len - 4]) || attrs2.x);
|
405
|
-
attrs2.by = (parseFloat(seg2[seg2len - 3]) || attrs2.y);
|
406
|
-
attrs2.x = seg2[seg2len - 2];
|
407
|
-
attrs2.y = seg2[seg2len - 1];
|
408
|
-
}
|
409
|
-
return [p, p2];
|
410
|
-
},
|
411
|
-
|
412
|
-
//Returns any path command as a curveto command based on the attrs passed
|
413
|
-
command2curve: function (pathCommand, d) {
|
414
|
-
var me = this;
|
415
|
-
if (!pathCommand) {
|
416
|
-
return ["C", d.x, d.y, d.x, d.y, d.x, d.y];
|
417
|
-
}
|
418
|
-
if (pathCommand[0] != "T" && pathCommand[0] != "Q") {
|
419
|
-
d.qx = d.qy = null;
|
420
|
-
}
|
421
|
-
switch (pathCommand[0]) {
|
422
|
-
case "M":
|
423
|
-
d.X = pathCommand[1];
|
424
|
-
d.Y = pathCommand[2];
|
425
|
-
break;
|
426
|
-
case "A":
|
427
|
-
pathCommand = ["C"].concat(me.arc2curve.apply(me, [d.x, d.y].concat(pathCommand.slice(1))));
|
428
|
-
break;
|
429
|
-
case "S":
|
430
|
-
pathCommand = ["C", d.x + (d.x - (d.bx || d.x)), d.y + (d.y - (d.by || d.y))].concat(pathCommand.slice(1));
|
431
|
-
break;
|
432
|
-
case "T":
|
433
|
-
d.qx = d.x + (d.x - (d.qx || d.x));
|
434
|
-
d.qy = d.y + (d.y - (d.qy || d.y));
|
435
|
-
pathCommand = ["C"].concat(me.quadratic2curve(d.x, d.y, d.qx, d.qy, pathCommand[1], pathCommand[2]));
|
436
|
-
break;
|
437
|
-
case "Q":
|
438
|
-
d.qx = pathCommand[1];
|
439
|
-
d.qy = pathCommand[2];
|
440
|
-
pathCommand = ["C"].concat(me.quadratic2curve(d.x, d.y, pathCommand[1], pathCommand[2], pathCommand[3], pathCommand[4]));
|
441
|
-
break;
|
442
|
-
case "L":
|
443
|
-
pathCommand = ["C"].concat(d.x, d.y, pathCommand[1], pathCommand[2], pathCommand[1], pathCommand[2]);
|
444
|
-
break;
|
445
|
-
case "H":
|
446
|
-
pathCommand = ["C"].concat(d.x, d.y, pathCommand[1], d.y, pathCommand[1], d.y);
|
447
|
-
break;
|
448
|
-
case "V":
|
449
|
-
pathCommand = ["C"].concat(d.x, d.y, d.x, pathCommand[1], d.x, pathCommand[1]);
|
450
|
-
break;
|
451
|
-
case "Z":
|
452
|
-
pathCommand = ["C"].concat(d.x, d.y, d.X, d.Y, d.X, d.Y);
|
453
|
-
break;
|
454
|
-
}
|
455
|
-
return pathCommand;
|
456
|
-
},
|
457
|
-
|
458
|
-
quadratic2curve: function (x1, y1, ax, ay, x2, y2) {
|
459
|
-
var _13 = 1 / 3,
|
460
|
-
_23 = 2 / 3;
|
461
|
-
return [
|
462
|
-
_13 * x1 + _23 * ax,
|
463
|
-
_13 * y1 + _23 * ay,
|
464
|
-
_13 * x2 + _23 * ax,
|
465
|
-
_13 * y2 + _23 * ay,
|
466
|
-
x2,
|
467
|
-
y2
|
468
|
-
];
|
469
|
-
},
|
470
|
-
|
471
|
-
rotate: function (x, y, rad) {
|
472
|
-
var cos = Math.cos(rad),
|
473
|
-
sin = Math.sin(rad),
|
474
|
-
X = x * cos - y * sin,
|
475
|
-
Y = x * sin + y * cos;
|
476
|
-
return {x: X, y: Y};
|
477
|
-
},
|
478
|
-
|
479
|
-
arc2curve: function (x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) {
|
480
|
-
// for more information of where this Math came from visit:
|
481
|
-
// http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
|
482
|
-
var me = this,
|
483
|
-
PI = Math.PI,
|
484
|
-
radian = me.radian,
|
485
|
-
_120 = PI * 120 / 180,
|
486
|
-
rad = radian * (+angle || 0),
|
487
|
-
res = [],
|
488
|
-
math = Math,
|
489
|
-
mcos = math.cos,
|
490
|
-
msin = math.sin,
|
491
|
-
msqrt = math.sqrt,
|
492
|
-
mabs = math.abs,
|
493
|
-
masin = math.asin,
|
494
|
-
xy, cos, sin, x, y, h, rx2, ry2, k, cx, cy, f1, f2, df, c1, s1, c2, s2,
|
495
|
-
t, hx, hy, m1, m2, m3, m4, newres, i, ln, f2old, x2old, y2old;
|
496
|
-
if (!recursive) {
|
497
|
-
xy = me.rotate(x1, y1, -rad);
|
498
|
-
x1 = xy.x;
|
499
|
-
y1 = xy.y;
|
500
|
-
xy = me.rotate(x2, y2, -rad);
|
501
|
-
x2 = xy.x;
|
502
|
-
y2 = xy.y;
|
503
|
-
cos = mcos(radian * angle);
|
504
|
-
sin = msin(radian * angle);
|
505
|
-
x = (x1 - x2) / 2;
|
506
|
-
y = (y1 - y2) / 2;
|
507
|
-
h = (x * x) / (rx * rx) + (y * y) / (ry * ry);
|
508
|
-
if (h > 1) {
|
509
|
-
h = msqrt(h);
|
510
|
-
rx = h * rx;
|
511
|
-
ry = h * ry;
|
512
|
-
}
|
513
|
-
rx2 = rx * rx;
|
514
|
-
ry2 = ry * ry;
|
515
|
-
k = (large_arc_flag == sweep_flag ? -1 : 1) *
|
516
|
-
msqrt(mabs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));
|
517
|
-
cx = k * rx * y / ry + (x1 + x2) / 2;
|
518
|
-
cy = k * -ry * x / rx + (y1 + y2) / 2;
|
519
|
-
f1 = masin(((y1 - cy) / ry).toFixed(7));
|
520
|
-
f2 = masin(((y2 - cy) / ry).toFixed(7));
|
521
|
-
|
522
|
-
f1 = x1 < cx ? PI - f1 : f1;
|
523
|
-
f2 = x2 < cx ? PI - f2 : f2;
|
524
|
-
if (f1 < 0) {
|
525
|
-
f1 = PI * 2 + f1;
|
526
|
-
}
|
527
|
-
if (f2 < 0) {
|
528
|
-
f2 = PI * 2 + f2;
|
529
|
-
}
|
530
|
-
if (sweep_flag && f1 > f2) {
|
531
|
-
f1 = f1 - PI * 2;
|
532
|
-
}
|
533
|
-
if (!sweep_flag && f2 > f1) {
|
534
|
-
f2 = f2 - PI * 2;
|
535
|
-
}
|
536
|
-
}
|
537
|
-
else {
|
538
|
-
f1 = recursive[0];
|
539
|
-
f2 = recursive[1];
|
540
|
-
cx = recursive[2];
|
541
|
-
cy = recursive[3];
|
542
|
-
}
|
543
|
-
df = f2 - f1;
|
544
|
-
if (mabs(df) > _120) {
|
545
|
-
f2old = f2;
|
546
|
-
x2old = x2;
|
547
|
-
y2old = y2;
|
548
|
-
f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1);
|
549
|
-
x2 = cx + rx * mcos(f2);
|
550
|
-
y2 = cy + ry * msin(f2);
|
551
|
-
res = me.arc2curve(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]);
|
552
|
-
}
|
553
|
-
df = f2 - f1;
|
554
|
-
c1 = mcos(f1);
|
555
|
-
s1 = msin(f1);
|
556
|
-
c2 = mcos(f2);
|
557
|
-
s2 = msin(f2);
|
558
|
-
t = math.tan(df / 4);
|
559
|
-
hx = 4 / 3 * rx * t;
|
560
|
-
hy = 4 / 3 * ry * t;
|
561
|
-
m1 = [x1, y1];
|
562
|
-
m2 = [x1 + hx * s1, y1 - hy * c1];
|
563
|
-
m3 = [x2 + hx * s2, y2 - hy * c2];
|
564
|
-
m4 = [x2, y2];
|
565
|
-
m2[0] = 2 * m1[0] - m2[0];
|
566
|
-
m2[1] = 2 * m1[1] - m2[1];
|
567
|
-
if (recursive) {
|
568
|
-
return [m2, m3, m4].concat(res);
|
569
|
-
}
|
570
|
-
else {
|
571
|
-
res = [m2, m3, m4].concat(res).join().split(",");
|
572
|
-
newres = [];
|
573
|
-
ln = res.length;
|
574
|
-
for (i = 0; i < ln; i++) {
|
575
|
-
newres[i] = i % 2 ? me.rotate(res[i - 1], res[i], rad).y : me.rotate(res[i], res[i + 1], rad).x;
|
576
|
-
}
|
577
|
-
return newres;
|
578
|
-
}
|
579
|
-
},
|
580
|
-
|
581
|
-
// TO BE DEPRECATED
|
582
|
-
rotateAndTranslatePath: function (sprite) {
|
583
|
-
var alpha = sprite.rotation.degrees,
|
584
|
-
cx = sprite.rotation.x,
|
585
|
-
cy = sprite.rotation.y,
|
586
|
-
dx = sprite.translation.x,
|
587
|
-
dy = sprite.translation.y,
|
588
|
-
path,
|
589
|
-
i,
|
590
|
-
p,
|
591
|
-
xy,
|
592
|
-
j,
|
593
|
-
res = [];
|
594
|
-
if (!alpha && !dx && !dy) {
|
595
|
-
return this.pathToAbsolute(sprite.attr.path);
|
596
|
-
}
|
597
|
-
dx = dx || 0;
|
598
|
-
dy = dy || 0;
|
599
|
-
path = this.pathToAbsolute(sprite.attr.path);
|
600
|
-
for (i = path.length; i--;) {
|
601
|
-
p = res[i] = path[i].slice();
|
602
|
-
if (p[0] == "A") {
|
603
|
-
xy = this.rotatePoint(p[6], p[7], alpha, cx, cy);
|
604
|
-
p[6] = xy.x + dx;
|
605
|
-
p[7] = xy.y + dy;
|
606
|
-
} else {
|
607
|
-
j = 1;
|
608
|
-
while (p[j + 1] != null) {
|
609
|
-
xy = this.rotatePoint(p[j], p[j + 1], alpha, cx, cy);
|
610
|
-
p[j] = xy.x + dx;
|
611
|
-
p[j + 1] = xy.y + dy;
|
612
|
-
j += 2;
|
613
|
-
}
|
614
|
-
}
|
615
|
-
}
|
616
|
-
return res;
|
617
|
-
},
|
618
|
-
|
619
|
-
// TO BE DEPRECATED
|
620
|
-
rotatePoint: function (x, y, alpha, cx, cy) {
|
621
|
-
if (!alpha) {
|
622
|
-
return {
|
623
|
-
x: x,
|
624
|
-
y: y
|
625
|
-
};
|
626
|
-
}
|
627
|
-
cx = cx || 0;
|
628
|
-
cy = cy || 0;
|
629
|
-
x = x - cx;
|
630
|
-
y = y - cy;
|
631
|
-
alpha = alpha * this.radian;
|
632
|
-
var cos = Math.cos(alpha),
|
633
|
-
sin = Math.sin(alpha);
|
634
|
-
return {
|
635
|
-
x: x * cos - y * sin + cx,
|
636
|
-
y: x * sin + y * cos + cy
|
637
|
-
};
|
638
|
-
},
|
639
|
-
|
640
|
-
pathDimensions: function (path) {
|
641
|
-
if (!path || !(path + "")) {
|
642
|
-
return {x: 0, y: 0, width: 0, height: 0};
|
643
|
-
}
|
644
|
-
path = this.path2curve(path);
|
645
|
-
var x = 0,
|
646
|
-
y = 0,
|
647
|
-
X = [],
|
648
|
-
Y = [],
|
649
|
-
i = 0,
|
650
|
-
ln = path.length,
|
651
|
-
p, xmin, ymin, dim;
|
652
|
-
for (; i < ln; i++) {
|
653
|
-
p = path[i];
|
654
|
-
if (p[0] == "M") {
|
655
|
-
x = p[1];
|
656
|
-
y = p[2];
|
657
|
-
X.push(x);
|
658
|
-
Y.push(y);
|
659
|
-
}
|
660
|
-
else {
|
661
|
-
dim = this.curveDim(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
|
662
|
-
X = X.concat(dim.min.x, dim.max.x);
|
663
|
-
Y = Y.concat(dim.min.y, dim.max.y);
|
664
|
-
x = p[5];
|
665
|
-
y = p[6];
|
666
|
-
}
|
667
|
-
}
|
668
|
-
xmin = Math.min.apply(0, X);
|
669
|
-
ymin = Math.min.apply(0, Y);
|
670
|
-
return {
|
671
|
-
x: xmin,
|
672
|
-
y: ymin,
|
673
|
-
path: path,
|
674
|
-
width: Math.max.apply(0, X) - xmin,
|
675
|
-
height: Math.max.apply(0, Y) - ymin
|
676
|
-
};
|
677
|
-
},
|
678
|
-
|
679
|
-
intersectInside: function(path, cp1, cp2) {
|
680
|
-
return (cp2[0] - cp1[0]) * (path[1] - cp1[1]) > (cp2[1] - cp1[1]) * (path[0] - cp1[0]);
|
681
|
-
},
|
682
|
-
|
683
|
-
intersectIntersection: function(s, e, cp1, cp2) {
|
684
|
-
var p = [],
|
685
|
-
dcx = cp1[0] - cp2[0],
|
686
|
-
dcy = cp1[1] - cp2[1],
|
687
|
-
dpx = s[0] - e[0],
|
688
|
-
dpy = s[1] - e[1],
|
689
|
-
n1 = cp1[0] * cp2[1] - cp1[1] * cp2[0],
|
690
|
-
n2 = s[0] * e[1] - s[1] * e[0],
|
691
|
-
n3 = 1 / (dcx * dpy - dcy * dpx);
|
692
|
-
|
693
|
-
p[0] = (n1 * dpx - n2 * dcx) * n3;
|
694
|
-
p[1] = (n1 * dpy - n2 * dcy) * n3;
|
695
|
-
return p;
|
696
|
-
},
|
697
|
-
|
698
|
-
intersect: function(subjectPolygon, clipPolygon) {
|
699
|
-
var me = this,
|
700
|
-
i = 0,
|
701
|
-
ln = clipPolygon.length,
|
702
|
-
cp1 = clipPolygon[ln - 1],
|
703
|
-
outputList = subjectPolygon,
|
704
|
-
cp2, s, e, point, ln2, inputList, j;
|
705
|
-
for (; i < ln; ++i) {
|
706
|
-
cp2 = clipPolygon[i];
|
707
|
-
inputList = outputList;
|
708
|
-
outputList = [];
|
709
|
-
s = inputList[inputList.length - 1];
|
710
|
-
j = 0;
|
711
|
-
ln2 = inputList.length;
|
712
|
-
for (; j < ln2; j++) {
|
713
|
-
e = inputList[j];
|
714
|
-
if (me.intersectInside(e, cp1, cp2)) {
|
715
|
-
if (!me.intersectInside(s, cp1, cp2)) {
|
716
|
-
outputList.push(me.intersectIntersection(s, e, cp1, cp2));
|
717
|
-
}
|
718
|
-
outputList.push(e);
|
719
|
-
}
|
720
|
-
else if (me.intersectInside(s, cp1, cp2)) {
|
721
|
-
outputList.push(me.intersectIntersection(s, e, cp1, cp2));
|
722
|
-
}
|
723
|
-
s = e;
|
724
|
-
}
|
725
|
-
cp1 = cp2;
|
726
|
-
}
|
727
|
-
return outputList;
|
728
|
-
},
|
729
|
-
|
730
|
-
bezier : function (a, b, c, d, x) {
|
731
|
-
if (x === 0) {
|
732
|
-
return a;
|
733
|
-
}
|
734
|
-
else if (x === 1) {
|
735
|
-
return d;
|
736
|
-
}
|
737
|
-
var du = 1 - x,
|
738
|
-
d3 = du * du * du,
|
739
|
-
r = x / du;
|
740
|
-
return d3 * (a + r * (3 * b + r * (3 * c + d * r)));
|
741
|
-
},
|
742
|
-
|
743
|
-
bezierDim : function (a, b, c, d) {
|
744
|
-
var points = [], r,
|
745
|
-
A, top, C, delta, bottom, s,
|
746
|
-
min, max, i;
|
747
|
-
// The min and max happens on boundary or b' == 0
|
748
|
-
if (a + 3 * c == d + 3 * b) {
|
749
|
-
r = a - b;
|
750
|
-
r /= 2 * (a - b - b + c);
|
751
|
-
if ( r < 1 && r > 0) {
|
752
|
-
points.push(r);
|
753
|
-
}
|
754
|
-
} else {
|
755
|
-
// b'(x) / -3 = (a-3b+3c-d)x^2+ (-2a+4b-2c)x + (a-b)
|
756
|
-
// delta = -4 (-b^2+a c+b c-c^2-a d+b d)
|
757
|
-
A = a - 3 * b + 3 * c - d;
|
758
|
-
top = 2 * (a - b - b + c);
|
759
|
-
C = a - b;
|
760
|
-
delta = top * top - 4 * A * C;
|
761
|
-
bottom = A + A;
|
762
|
-
if (delta === 0) {
|
763
|
-
r = top / bottom;
|
764
|
-
if (r < 1 && r > 0) {
|
765
|
-
points.push(r);
|
766
|
-
}
|
767
|
-
} else if (delta > 0) {
|
768
|
-
s = Math.sqrt(delta);
|
769
|
-
r = (s + top) / bottom;
|
770
|
-
|
771
|
-
if (r < 1 && r > 0) {
|
772
|
-
points.push(r);
|
773
|
-
}
|
774
|
-
|
775
|
-
r = (top - s) / bottom;
|
776
|
-
|
777
|
-
if (r < 1 && r > 0) {
|
778
|
-
points.push(r);
|
779
|
-
}
|
780
|
-
}
|
781
|
-
}
|
782
|
-
min = Math.min(a, d);
|
783
|
-
max = Math.max(a, d);
|
784
|
-
for (i = 0; i < points.length; i++) {
|
785
|
-
min = Math.min(min, this.bezier(a, b, c, d, points[i]));
|
786
|
-
max = Math.max(max, this.bezier(a, b, c, d, points[i]));
|
787
|
-
}
|
788
|
-
return [min, max];
|
789
|
-
},
|
790
|
-
|
791
|
-
curveDim: function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
|
792
|
-
var x = this.bezierDim(p1x, c1x, c2x, p2x),
|
793
|
-
y = this.bezierDim(p1y, c1y, c2y, p2y);
|
794
|
-
return {
|
795
|
-
min: {
|
796
|
-
x: x[0],
|
797
|
-
y: y[0]
|
798
|
-
},
|
799
|
-
max: {
|
800
|
-
x: x[1],
|
801
|
-
y: y[1]
|
802
|
-
}
|
803
|
-
};
|
804
|
-
},
|
805
|
-
|
806
|
-
/**
|
807
|
-
* @private
|
808
|
-
*
|
809
|
-
* Calculates bezier curve control anchor points for a particular point in a path, with a
|
810
|
-
* smoothing curve applied. The smoothness of the curve is controlled by the 'value' parameter.
|
811
|
-
* Note that this algorithm assumes that the line being smoothed is normalized going from left
|
812
|
-
* to right; it makes special adjustments assuming this orientation.
|
813
|
-
*
|
814
|
-
* @param {Number} prevX X coordinate of the previous point in the path
|
815
|
-
* @param {Number} prevY Y coordinate of the previous point in the path
|
816
|
-
* @param {Number} curX X coordinate of the current point in the path
|
817
|
-
* @param {Number} curY Y coordinate of the current point in the path
|
818
|
-
* @param {Number} nextX X coordinate of the next point in the path
|
819
|
-
* @param {Number} nextY Y coordinate of the next point in the path
|
820
|
-
* @param {Number} value A value to control the smoothness of the curve; this is used to
|
821
|
-
* divide the distance between points, so a value of 2 corresponds to
|
822
|
-
* half the distance between points (a very smooth line) while higher values
|
823
|
-
* result in less smooth curves. Defaults to 4.
|
824
|
-
* @return {Object} Object containing x1, y1, x2, y2 bezier control anchor points; x1 and y1
|
825
|
-
* are the control point for the curve toward the previous path point, and
|
826
|
-
* x2 and y2 are the control point for the curve toward the next path point.
|
827
|
-
*/
|
828
|
-
getAnchors: function (prevX, prevY, curX, curY, nextX, nextY, value) {
|
829
|
-
value = value || 4;
|
830
|
-
var M = Math,
|
831
|
-
PI = M.PI,
|
832
|
-
halfPI = PI / 2,
|
833
|
-
abs = M.abs,
|
834
|
-
sin = M.sin,
|
835
|
-
cos = M.cos,
|
836
|
-
atan = M.atan,
|
837
|
-
control1Length, control2Length, control1Angle, control2Angle,
|
838
|
-
control1X, control1Y, control2X, control2Y, alpha;
|
839
|
-
|
840
|
-
// Find the length of each control anchor line, by dividing the horizontal distance
|
841
|
-
// between points by the value parameter.
|
842
|
-
control1Length = (curX - prevX) / value;
|
843
|
-
control2Length = (nextX - curX) / value;
|
844
|
-
|
845
|
-
// Determine the angle of each control anchor line. If the middle point is a vertical
|
846
|
-
// turnaround then we force it to a flat horizontal angle to prevent the curve from
|
847
|
-
// dipping above or below the middle point. Otherwise we use an angle that points
|
848
|
-
// toward the previous/next target point.
|
849
|
-
if ((curY >= prevY && curY >= nextY) || (curY <= prevY && curY <= nextY)) {
|
850
|
-
control1Angle = control2Angle = halfPI;
|
851
|
-
} else {
|
852
|
-
control1Angle = atan((curX - prevX) / abs(curY - prevY));
|
853
|
-
if (prevY < curY) {
|
854
|
-
control1Angle = PI - control1Angle;
|
855
|
-
}
|
856
|
-
control2Angle = atan((nextX - curX) / abs(curY - nextY));
|
857
|
-
if (nextY < curY) {
|
858
|
-
control2Angle = PI - control2Angle;
|
859
|
-
}
|
860
|
-
}
|
861
|
-
|
862
|
-
// Adjust the calculated angles so they point away from each other on the same line
|
863
|
-
alpha = halfPI - ((control1Angle + control2Angle) % (PI * 2)) / 2;
|
864
|
-
if (alpha > halfPI) {
|
865
|
-
alpha -= PI;
|
866
|
-
}
|
867
|
-
control1Angle += alpha;
|
868
|
-
control2Angle += alpha;
|
869
|
-
|
870
|
-
// Find the control anchor points from the angles and length
|
871
|
-
control1X = curX - control1Length * sin(control1Angle);
|
872
|
-
control1Y = curY + control1Length * cos(control1Angle);
|
873
|
-
control2X = curX + control2Length * sin(control2Angle);
|
874
|
-
control2Y = curY + control2Length * cos(control2Angle);
|
875
|
-
|
876
|
-
// One last adjustment, make sure that no control anchor point extends vertically past
|
877
|
-
// its target prev/next point, as that results in curves dipping above or below and
|
878
|
-
// bending back strangely. If we find this happening we keep the control angle but
|
879
|
-
// reduce the length of the control line so it stays within bounds.
|
880
|
-
if ((curY > prevY && control1Y < prevY) || (curY < prevY && control1Y > prevY)) {
|
881
|
-
control1X += abs(prevY - control1Y) * (control1X - curX) / (control1Y - curY);
|
882
|
-
control1Y = prevY;
|
883
|
-
}
|
884
|
-
if ((curY > nextY && control2Y < nextY) || (curY < nextY && control2Y > nextY)) {
|
885
|
-
control2X -= abs(nextY - control2Y) * (control2X - curX) / (control2Y - curY);
|
886
|
-
control2Y = nextY;
|
887
|
-
}
|
888
|
-
|
889
|
-
return {
|
890
|
-
x1: control1X,
|
891
|
-
y1: control1Y,
|
892
|
-
x2: control2X,
|
893
|
-
y2: control2Y
|
894
|
-
};
|
895
|
-
},
|
896
|
-
|
897
|
-
/* Smoothing function for a path. Converts a path into cubic beziers. Value defines the divider of the distance between points.
|
898
|
-
* Defaults to a value of 4.
|
899
|
-
*/
|
900
|
-
smooth: function (originalPath, value) {
|
901
|
-
var path = this.path2curve(originalPath),
|
902
|
-
newp = [path[0]],
|
903
|
-
x = path[0][1],
|
904
|
-
y = path[0][2],
|
905
|
-
j,
|
906
|
-
points,
|
907
|
-
i = 1,
|
908
|
-
ii = path.length,
|
909
|
-
beg = 1,
|
910
|
-
mx = x,
|
911
|
-
my = y,
|
912
|
-
cx = 0,
|
913
|
-
cy = 0,
|
914
|
-
pathi,
|
915
|
-
pathil,
|
916
|
-
pathim,
|
917
|
-
pathiml,
|
918
|
-
pathip,
|
919
|
-
pathipl,
|
920
|
-
begl;
|
921
|
-
|
922
|
-
for (; i < ii; i++) {
|
923
|
-
pathi = path[i];
|
924
|
-
pathil = pathi.length;
|
925
|
-
pathim = path[i - 1];
|
926
|
-
pathiml = pathim.length;
|
927
|
-
pathip = path[i + 1];
|
928
|
-
pathipl = pathip && pathip.length;
|
929
|
-
if (pathi[0] == "M") {
|
930
|
-
mx = pathi[1];
|
931
|
-
my = pathi[2];
|
932
|
-
j = i + 1;
|
933
|
-
while (path[j][0] != "C") {
|
934
|
-
j++;
|
935
|
-
}
|
936
|
-
cx = path[j][5];
|
937
|
-
cy = path[j][6];
|
938
|
-
newp.push(["M", mx, my]);
|
939
|
-
beg = newp.length;
|
940
|
-
x = mx;
|
941
|
-
y = my;
|
942
|
-
continue;
|
943
|
-
}
|
944
|
-
if (pathi[pathil - 2] == mx && pathi[pathil - 1] == my && (!pathip || pathip[0] == "M")) {
|
945
|
-
begl = newp[beg].length;
|
946
|
-
points = this.getAnchors(pathim[pathiml - 2], pathim[pathiml - 1], mx, my, newp[beg][begl - 2], newp[beg][begl - 1], value);
|
947
|
-
newp[beg][1] = points.x2;
|
948
|
-
newp[beg][2] = points.y2;
|
949
|
-
}
|
950
|
-
else if (!pathip || pathip[0] == "M") {
|
951
|
-
points = {
|
952
|
-
x1: pathi[pathil - 2],
|
953
|
-
y1: pathi[pathil - 1]
|
954
|
-
};
|
955
|
-
} else {
|
956
|
-
points = this.getAnchors(pathim[pathiml - 2], pathim[pathiml - 1], pathi[pathil - 2], pathi[pathil - 1], pathip[pathipl - 2], pathip[pathipl - 1], value);
|
957
|
-
}
|
958
|
-
newp.push(["C", x, y, points.x1, points.y1, pathi[pathil - 2], pathi[pathil - 1]]);
|
959
|
-
x = points.x2;
|
960
|
-
y = points.y2;
|
961
|
-
}
|
962
|
-
return newp;
|
963
|
-
},
|
964
|
-
|
965
|
-
findDotAtSegment: function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
|
966
|
-
var t1 = 1 - t;
|
967
|
-
return {
|
968
|
-
x: Math.pow(t1, 3) * p1x + Math.pow(t1, 2) * 3 * t * c1x + t1 * 3 * t * t * c2x + Math.pow(t, 3) * p2x,
|
969
|
-
y: Math.pow(t1, 3) * p1y + Math.pow(t1, 2) * 3 * t * c1y + t1 * 3 * t * t * c2y + Math.pow(t, 3) * p2y
|
970
|
-
};
|
971
|
-
},
|
972
|
-
|
973
|
-
snapEnds: function (from, to, stepsMax, prettyNumbers) {
|
974
|
-
if (Ext.isDate(from)) {
|
975
|
-
return this.snapEndsByDate(from, to, stepsMax);
|
976
|
-
}
|
977
|
-
var step = (to - from) / stepsMax,
|
978
|
-
level = Math.floor(Math.log(step) / Math.LN10) + 1,
|
979
|
-
m = Math.pow(10, level),
|
980
|
-
cur,
|
981
|
-
modulo = Math.round((step % m) * Math.pow(10, 2 - level)),
|
982
|
-
interval = [[0, 15], [20, 4], [30, 2], [40, 4], [50, 9], [60, 4], [70, 2], [80, 4], [100, 15]],
|
983
|
-
stepCount = 0,
|
984
|
-
value,
|
985
|
-
weight,
|
986
|
-
i,
|
987
|
-
topValue,
|
988
|
-
topWeight = 1e9,
|
989
|
-
ln = interval.length;
|
990
|
-
cur = from = Math.floor(from / m) * m;
|
991
|
-
|
992
|
-
if(prettyNumbers){
|
993
|
-
for (i = 0; i < ln; i++) {
|
994
|
-
value = interval[i][0];
|
995
|
-
weight = (value - modulo) < 0 ? 1e6 : (value - modulo) / interval[i][1];
|
996
|
-
if (weight < topWeight) {
|
997
|
-
topValue = value;
|
998
|
-
topWeight = weight;
|
999
|
-
}
|
1000
|
-
}
|
1001
|
-
step = Math.floor(step * Math.pow(10, -level)) * Math.pow(10, level) + topValue * Math.pow(10, level - 2);
|
1002
|
-
while (cur < to) {
|
1003
|
-
cur += step;
|
1004
|
-
stepCount++;
|
1005
|
-
}
|
1006
|
-
to = +cur.toFixed(10);
|
1007
|
-
}else{
|
1008
|
-
stepCount = stepsMax;
|
1009
|
-
}
|
1010
|
-
|
1011
|
-
return {
|
1012
|
-
from: from,
|
1013
|
-
to: to,
|
1014
|
-
power: level,
|
1015
|
-
step: step,
|
1016
|
-
steps: stepCount
|
1017
|
-
};
|
1018
|
-
},
|
1019
|
-
|
1020
|
-
/**
|
1021
|
-
* snapEndsByDate is a utility method to deduce an appropriate tick configuration for the data set of given
|
1022
|
-
* feature. Refer to {@link #snapEnds}.
|
1023
|
-
*
|
1024
|
-
* @param {Date} from The minimum value in the data
|
1025
|
-
* @param {Date} to The maximum value in the data
|
1026
|
-
* @param {Number} stepsMax The maximum number of ticks
|
1027
|
-
* @param {Boolean} lockEnds If true, the 'from' and 'to' parameters will be used as fixed end values
|
1028
|
-
* and will not be adjusted
|
1029
|
-
* @return {Object} The calculated step and ends info; properties are:
|
1030
|
-
* - from: The result start value, which may be lower than the original start value
|
1031
|
-
* - to: The result end value, which may be higher than the original end value
|
1032
|
-
* - step: The value size of each step
|
1033
|
-
* - steps: The number of steps. NOTE: the steps may not divide the from/to range perfectly evenly;
|
1034
|
-
* there may be a smaller distance between the last step and the end value than between prior
|
1035
|
-
* steps, particularly when the `endsLocked` param is true. Therefore it is best to not use
|
1036
|
-
* the `steps` result when finding the axis tick points, instead use the `step`, `to`, and
|
1037
|
-
* `from` to find the correct point for each tick.
|
1038
|
-
*/
|
1039
|
-
snapEndsByDate: function (from, to, stepsMax, lockEnds) {
|
1040
|
-
var selectedStep = false,
|
1041
|
-
scales = [
|
1042
|
-
[Ext.Date.MILLI, [1, 2, 3, 5, 10, 20, 30, 50, 100, 200, 300, 500]],
|
1043
|
-
[Ext.Date.SECOND, [1, 2, 3, 5, 10, 15, 30]],
|
1044
|
-
[Ext.Date.MINUTE, [1, 2, 3, 5, 10, 20, 30]],
|
1045
|
-
[Ext.Date.HOUR, [1, 2, 3, 4, 6, 12]],
|
1046
|
-
[Ext.Date.DAY, [1, 2, 3, 7, 14]],
|
1047
|
-
[Ext.Date.MONTH, [1, 2, 3, 4, 6]]
|
1048
|
-
],
|
1049
|
-
sLen = scales.length,
|
1050
|
-
stop = false,
|
1051
|
-
scale, j, yearDiff, s;
|
1052
|
-
|
1053
|
-
// Find the most desirable scale
|
1054
|
-
for (s = 0; s < sLen; s++) {
|
1055
|
-
scale = scales[s];
|
1056
|
-
if (!stop) {
|
1057
|
-
for (j = 0; j < scale[1].length; j++) {
|
1058
|
-
if (to < Ext.Date.add(from, scale[0], scale[1][j] * stepsMax)) {
|
1059
|
-
selectedStep = [scale[0], scale[1][j]];
|
1060
|
-
stop = true;
|
1061
|
-
break;
|
1062
|
-
}
|
1063
|
-
}
|
1064
|
-
}
|
1065
|
-
}
|
1066
|
-
|
1067
|
-
if (!selectedStep) {
|
1068
|
-
yearDiff = this.snapEnds(from.getFullYear(), to.getFullYear() + 1, stepsMax, lockEnds);
|
1069
|
-
selectedStep = [Date.YEAR, Math.round(yearDiff.step)];
|
1070
|
-
}
|
1071
|
-
return this.snapEndsByDateAndStep(from, to, selectedStep, lockEnds);
|
1072
|
-
},
|
1073
|
-
|
1074
|
-
|
1075
|
-
/**
|
1076
|
-
* snapEndsByDateAndStep is a utility method to deduce an appropriate tick configuration for the data set of given
|
1077
|
-
* feature and specific step size.
|
1078
|
-
* @param {Date} from The minimum value in the data
|
1079
|
-
* @param {Date} to The maximum value in the data
|
1080
|
-
* @param {Array} step An array with two components: The first is the unit of the step (day, month, year, etc). The second one is the number of units for the step (1, 2, etc.).
|
1081
|
-
* @param {Boolean} lockEnds If true, the 'from' and 'to' parameters will be used as fixed end values
|
1082
|
-
* and will not be adjusted
|
1083
|
-
*/
|
1084
|
-
snapEndsByDateAndStep: function(from, to, step, lockEnds) {
|
1085
|
-
var fromStat = [from.getFullYear(), from.getMonth(), from.getDate(),
|
1086
|
-
from.getHours(), from.getMinutes(), from.getSeconds(), from.getMilliseconds()],
|
1087
|
-
steps = 0, testFrom, testTo;
|
1088
|
-
if (lockEnds) {
|
1089
|
-
testFrom = from;
|
1090
|
-
} else {
|
1091
|
-
switch (step[0]) {
|
1092
|
-
case Ext.Date.MILLI:
|
1093
|
-
testFrom = new Date(fromStat[0], fromStat[1], fromStat[2], fromStat[3],
|
1094
|
-
fromStat[4], fromStat[5], Math.floor(fromStat[6] / step[1]) * step[1]);
|
1095
|
-
break;
|
1096
|
-
case Ext.Date.SECOND:
|
1097
|
-
testFrom = new Date(fromStat[0], fromStat[1], fromStat[2], fromStat[3],
|
1098
|
-
fromStat[4], Math.floor(fromStat[5] / step[1]) * step[1], 0);
|
1099
|
-
break;
|
1100
|
-
case Ext.Date.MINUTE:
|
1101
|
-
testFrom = new Date(fromStat[0], fromStat[1], fromStat[2], fromStat[3],
|
1102
|
-
Math.floor(fromStat[4] / step[1]) * step[1], 0, 0);
|
1103
|
-
break;
|
1104
|
-
case Ext.Date.HOUR:
|
1105
|
-
testFrom = new Date(fromStat[0], fromStat[1], fromStat[2],
|
1106
|
-
Math.floor(fromStat[3] / step[1]) * step[1], 0, 0, 0);
|
1107
|
-
break;
|
1108
|
-
case Ext.Date.DAY:
|
1109
|
-
testFrom = new Date(fromStat[0], fromStat[1],
|
1110
|
-
Math.floor(fromStat[2] - 1 / step[1]) * step[1] + 1, 0, 0, 0, 0);
|
1111
|
-
break;
|
1112
|
-
case Ext.Date.MONTH:
|
1113
|
-
testFrom = new Date(fromStat[0], Math.floor(fromStat[1] / step[1]) * step[1], 1, 0, 0, 0, 0);
|
1114
|
-
break;
|
1115
|
-
default: // Ext.Date.YEAR
|
1116
|
-
testFrom = new Date(Math.floor(fromStat[0] / step[1]) * step[1], 0, 1, 0, 0, 0, 0);
|
1117
|
-
break;
|
1118
|
-
}
|
1119
|
-
}
|
1120
|
-
|
1121
|
-
testTo = testFrom;
|
1122
|
-
// TODO(zhangbei) : We can do it better somehow...
|
1123
|
-
while (testTo < to) {
|
1124
|
-
testTo = Ext.Date.add(testTo, step[0], step[1]);
|
1125
|
-
steps++;
|
1126
|
-
}
|
1127
|
-
|
1128
|
-
if (lockEnds) {
|
1129
|
-
testTo = to;
|
1130
|
-
}
|
1131
|
-
return {
|
1132
|
-
from : +testFrom,
|
1133
|
-
to : +testTo,
|
1134
|
-
step : (testTo - testFrom) / steps,
|
1135
|
-
steps : steps
|
1136
|
-
};
|
1137
|
-
},
|
1138
|
-
|
1139
|
-
sorter: function (a, b) {
|
1140
|
-
return a.offset - b.offset;
|
1141
|
-
},
|
1142
|
-
|
1143
|
-
rad: function(degrees) {
|
1144
|
-
return degrees % 360 * Math.PI / 180;
|
1145
|
-
},
|
1146
|
-
|
1147
|
-
degrees: function(radian) {
|
1148
|
-
return radian * 180 / Math.PI % 360;
|
1149
|
-
},
|
1150
|
-
|
1151
|
-
withinBox: function(x, y, bbox) {
|
1152
|
-
bbox = bbox || {};
|
1153
|
-
return (x >= bbox.x && x <= (bbox.x + bbox.width) && y >= bbox.y && y <= (bbox.y + bbox.height));
|
1154
|
-
},
|
1155
|
-
|
1156
|
-
parseGradient: function(gradient) {
|
1157
|
-
var me = this,
|
1158
|
-
type = gradient.type || 'linear',
|
1159
|
-
angle = gradient.angle || 0,
|
1160
|
-
radian = me.radian,
|
1161
|
-
stops = gradient.stops,
|
1162
|
-
stopsArr = [],
|
1163
|
-
stop,
|
1164
|
-
vector,
|
1165
|
-
max,
|
1166
|
-
stopObj;
|
1167
|
-
|
1168
|
-
if (type == 'linear') {
|
1169
|
-
vector = [0, 0, Math.cos(angle * radian), Math.sin(angle * radian)];
|
1170
|
-
max = 1 / (Math.max(Math.abs(vector[2]), Math.abs(vector[3])) || 1);
|
1171
|
-
vector[2] *= max;
|
1172
|
-
vector[3] *= max;
|
1173
|
-
if (vector[2] < 0) {
|
1174
|
-
vector[0] = -vector[2];
|
1175
|
-
vector[2] = 0;
|
1176
|
-
}
|
1177
|
-
if (vector[3] < 0) {
|
1178
|
-
vector[1] = -vector[3];
|
1179
|
-
vector[3] = 0;
|
1180
|
-
}
|
1181
|
-
}
|
1182
|
-
|
1183
|
-
for (stop in stops) {
|
1184
|
-
if (stops.hasOwnProperty(stop) && me.stopsRE.test(stop)) {
|
1185
|
-
stopObj = {
|
1186
|
-
offset: parseInt(stop, 10),
|
1187
|
-
color: Ext.draw.Color.toHex(stops[stop].color) || '#ffffff',
|
1188
|
-
opacity: stops[stop].opacity || 1
|
1189
|
-
};
|
1190
|
-
stopsArr.push(stopObj);
|
1191
|
-
}
|
1192
|
-
}
|
1193
|
-
// Sort by pct property
|
1194
|
-
Ext.Array.sort(stopsArr, me.sorter);
|
1195
|
-
if (type == 'linear') {
|
1196
|
-
return {
|
1197
|
-
id: gradient.id,
|
1198
|
-
type: type,
|
1199
|
-
vector: vector,
|
1200
|
-
stops: stopsArr
|
1201
|
-
};
|
1202
|
-
}
|
1203
|
-
else {
|
1204
|
-
return {
|
1205
|
-
id: gradient.id,
|
1206
|
-
type: type,
|
1207
|
-
centerX: gradient.centerX,
|
1208
|
-
centerY: gradient.centerY,
|
1209
|
-
focalX: gradient.focalX,
|
1210
|
-
focalY: gradient.focalY,
|
1211
|
-
radius: gradient.radius,
|
1212
|
-
vector: vector,
|
1213
|
-
stops: stopsArr
|
1214
|
-
};
|
1215
|
-
}
|
1216
|
-
}
|
1217
|
-
});
|