swf2js 0.1.2 → 0.4.0
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/README.md +81 -14
- package/package.json +11 -7
- package/studio/actionscript-roundtrip.test.js +54 -0
- package/studio/actionscript-scripts.test.js +169 -0
- package/studio/animated-image.test.js +137 -0
- package/studio/arithmetic.test.js +16 -0
- package/studio/as3-import.test.js +110 -0
- package/studio/audio-info.test.js +44 -0
- package/studio/components.test.js +152 -0
- package/studio/document-editing.test.js +92 -0
- package/studio/examples/01-space-mission.json +1628 -0
- package/studio/examples/02-clockwork-vault.json +1079 -0
- package/studio/examples/03-neon-synth.json +1364 -0
- package/studio/examples/04-kinetic-poster.json +923 -0
- package/studio/examples/05-signal-relay.json +1131 -0
- package/studio/examples/06-calculator.json +564 -0
- package/studio/frame-editing.test.js +129 -0
- package/studio/frame-events.test.js +117 -0
- package/studio/groups.test.js +88 -0
- package/studio/index.html +962 -0
- package/studio/interaction-triggers.test.js +37 -0
- package/studio/linked-actions.test.js +48 -0
- package/studio/lottie.test.js +208 -0
- package/studio/masks.test.js +43 -0
- package/studio/media-assets.test.js +62 -0
- package/studio/paint-tools.test.js +60 -0
- package/studio/playback.test.js +17 -0
- package/studio/project-io.test.js +405 -0
- package/studio/project-preview.test.js +475 -0
- package/studio/scene-transition.test.js +32 -0
- package/studio/server/archive-companions.js +27 -0
- package/studio/server/as3-library.js +91 -0
- package/studio/server/assets.js +162 -0
- package/studio/server/audio-info.js +82 -0
- package/studio/server/font-files.js +332 -0
- package/studio/server/http.js +135 -0
- package/studio/server/linked-actions.js +93 -0
- package/studio/server/png-decode.js +1 -0
- package/studio/server/project-movie.js +1164 -0
- package/studio/server/project-preview.js +152 -0
- package/studio/server/projects.js +370 -0
- package/studio/server/report.js +29 -0
- package/studio/server/routes.js +93 -0
- package/studio/server/swf-authoring.js +90 -0
- package/studio/server/swf-control-runtime.as +513 -0
- package/studio/server/swf-controls.js +119 -0
- package/studio/server/swf-export.js +293 -0
- package/studio/server/swf-import.js +1675 -0
- package/studio/server/swf-morphs.js +64 -0
- package/studio/server/swf-routes.js +42 -0
- package/studio/server/swf-streams.js +80 -0
- package/studio/server/swf-transition-runtime.as +52 -0
- package/studio/server/tween-recovery.js +106 -0
- package/studio/server-api.test.js +283 -0
- package/studio/server.js +320 -0
- package/studio/src/animated-image.js +423 -0
- package/studio/src/appearance-inspector.js +63 -0
- package/studio/src/arithmetic.js +50 -0
- package/studio/src/authored-controls.js +42 -0
- package/studio/src/busy.js +41 -0
- package/studio/src/canvas.js +430 -0
- package/studio/src/clipper-browser.js +2 -0
- package/studio/src/color-transform.js +38 -0
- package/studio/src/component-inspector.js +126 -0
- package/studio/src/components.js +268 -0
- package/studio/src/display-frame.js +262 -0
- package/studio/src/document-editing.js +69 -0
- package/studio/src/event-editor.js +150 -0
- package/studio/src/frame-editing.js +150 -0
- package/studio/src/frame-events.js +128 -0
- package/studio/src/frame-image.js +28 -0
- package/studio/src/groups.js +125 -0
- package/studio/src/handler-editor.js +122 -0
- package/studio/src/history.js +83 -0
- package/studio/src/imported-paths.js +99 -0
- package/studio/src/index.js +3582 -0
- package/studio/src/interaction-triggers.js +42 -0
- package/studio/src/json-patch.js +77 -0
- package/studio/src/layer-icons.js +25 -0
- package/studio/src/lottie-export.js +948 -0
- package/studio/src/lottie-import.js +1138 -0
- package/studio/src/masks.js +69 -0
- package/studio/src/media-assets.js +188 -0
- package/studio/src/media-library.js +193 -0
- package/studio/src/model.js +431 -0
- package/studio/src/numeric-fields.js +46 -0
- package/studio/src/object-list.js +57 -0
- package/studio/src/paint-tools.js +76 -0
- package/studio/src/placement-effects.js +74 -0
- package/studio/src/playback.js +10 -0
- package/studio/src/preview-audio.js +64 -0
- package/studio/src/preview-interactions.js +106 -0
- package/studio/src/preview-recorder.js +335 -0
- package/studio/src/preview-surface.js +338 -0
- package/studio/src/project-io.js +905 -0
- package/studio/src/project-session.js +375 -0
- package/studio/src/projects-dialog.js +319 -0
- package/studio/src/scene-transition.js +129 -0
- package/studio/src/script-editor.js +175 -0
- package/studio/src/script-references.js +74 -0
- package/studio/src/scripted-controls.js +146 -0
- package/studio/src/scripts.js +185 -0
- package/studio/src/stage-guides.js +101 -0
- package/studio/src/svg-animation.js +416 -0
- package/studio/src/svg-context.js +522 -0
- package/studio/src/svg-frame.js +413 -0
- package/studio/src/svg-import.js +1208 -0
- package/studio/src/swf-recording.js +104 -0
- package/studio/src/symbol-library.js +39 -0
- package/studio/src/symbols.js +62 -0
- package/studio/src/text-fields.js +58 -0
- package/studio/src/theme.js +43 -0
- package/studio/src/timeline.js +321 -0
- package/studio/src/vector-cut.js +103 -0
- package/studio/src/vector-geometry.js +254 -0
- package/studio/src/vector-style.js +146 -0
- package/studio/src/video-encode.js +84 -0
- package/studio/src/video-export.js +331 -0
- package/studio/src/video-mux.js +339 -0
- package/studio/src/video-playback.js +281 -0
- package/studio/src/workspace.js +344 -0
- package/studio/stroke-style.test.js +119 -0
- package/studio/styles.css +1547 -0
- package/studio/svg-export.test.js +162 -0
- package/studio/svg-import.test.js +318 -0
- package/studio/swf-authoring.test.js +140 -0
- package/studio/swf-export.test.js +324 -0
- package/studio/swf-import.test.js +489 -0
- package/studio/symbols.test.js +68 -0
- package/studio/tests/accessibility-interactions.mjs +138 -0
- package/studio/tests/appearance-interactions.mjs +103 -0
- package/studio/tests/control-interactions.mjs +60 -0
- package/studio/tests/event-interactions.mjs +117 -0
- package/studio/tests/external-resources.mjs +174 -0
- package/studio/tests/frame-image.mjs +71 -0
- package/studio/tests/html-export.mjs +68 -0
- package/studio/tests/import-files.mjs +131 -0
- package/studio/tests/lottie.mjs +125 -0
- package/studio/tests/mask-interactions.mjs +148 -0
- package/studio/tests/media-interactions.mjs +109 -0
- package/studio/tests/paint-interactions.mjs +64 -0
- package/studio/tests/project-interactions.mjs +244 -0
- package/studio/tests/script-interactions.mjs +178 -0
- package/studio/tests/scripted-control-interactions.mjs +107 -0
- package/studio/tests/svg-export.mjs +149 -0
- package/studio/tests/text-field-interactions.mjs +64 -0
- package/studio/tests/theme-interactions.mjs +53 -0
- package/studio/tests/timeline-browser.mjs +507 -0
- package/studio/tests/transition-interactions.mjs +94 -0
- package/studio/tests/trigger-interactions.mjs +93 -0
- package/studio/tests/video-export.mjs +243 -0
- package/studio/tests/workspace-interactions.mjs +226 -0
- package/studio/tween-recovery.test.js +31 -0
- package/studio/vector-style.test.js +56 -0
- package/studio/video-export.test.js +326 -0
- package/studiospec/actionscript.md +88 -0
- package/studiospec/architecture.md +378 -0
- package/studiospec/controls.md +100 -0
- package/studiospec/file-support.md +268 -0
- package/studiospec/lottie.md +69 -0
- package/studiospec/requirements.md +135 -0
- package/studiospec/stroke-style.md +95 -0
- package/studiospec/svg-export.md +83 -0
- package/studiospec/svg-import.md +139 -0
- package/studiospec/swooflib-integration.md +115 -0
- package/studiospec/tasks.md +573 -0
- package/studiospec/video-export.md +127 -0
- package/swf2js/__tests__/actionscript.test.js +1609 -0
- package/swf2js/__tests__/adpcm-audio.test.js +43 -0
- package/swf2js/__tests__/as2-compiler.test.js +153 -0
- package/swf2js/__tests__/as3-mixed-depth.test.js +498 -0
- package/swf2js/__tests__/authored-sprite-hit.test.js +118 -0
- package/swf2js/__tests__/authored-sprite-sizing.test.js +164 -0
- package/swf2js/__tests__/avm1-action-prefix.test.js +134 -0
- package/swf2js/__tests__/avm1-attach-movie.test.js +1151 -0
- package/swf2js/__tests__/avm1-boxhead-budget.test.js +73 -0
- package/swf2js/__tests__/avm1-cfg-bubble-tanks.test.js +101 -0
- package/swf2js/__tests__/avm1-cfg-mario-kart.test.js +184 -0
- package/swf2js/__tests__/avm1-cfg-mario.test.js +31 -0
- package/swf2js/__tests__/avm1-cfg-pacman.test.js +49 -0
- package/swf2js/__tests__/avm1-checkers-gameplay.test.js +122 -0
- package/swf2js/__tests__/avm1-clip-actions.test.js +2002 -0
- package/swf2js/__tests__/avm1-clone-drag.test.js +626 -0
- package/swf2js/__tests__/avm1-decompiler.test.js +102 -0
- package/swf2js/__tests__/avm1-dynamic-locals.test.js +159 -0
- package/swf2js/__tests__/avm1-formal-parameters.test.js +71 -0
- package/swf2js/__tests__/avm1-key-events.test.js +52 -0
- package/swf2js/__tests__/avm1-load-bitmap.test.js +75 -0
- package/swf2js/__tests__/avm1-loading-host-actions.test.js +764 -0
- package/swf2js/__tests__/avm1-multibyte-strings.test.js +63 -0
- package/swf2js/__tests__/avm1-pacman-gameplay.test.js +115 -0
- package/swf2js/__tests__/avm1-shape-hittest.test.js +311 -0
- package/swf2js/__tests__/avm1-shared-bodies.test.js +57 -0
- package/swf2js/__tests__/avm1-shared-runtime.test.js +1364 -0
- package/swf2js/__tests__/avm1-snake-gameplay.test.js +139 -0
- package/swf2js/__tests__/avm1-super.test.js +70 -0
- package/swf2js/__tests__/avm1-target-path.test.js +325 -0
- package/swf2js/__tests__/avm1-try.test.js +229 -0
- package/swf2js/__tests__/avm2-activation-closures.test.js +65 -0
- package/swf2js/__tests__/avm2-applytype.test.js +180 -0
- package/swf2js/__tests__/avm2-call-ops.test.js +232 -0
- package/swf2js/__tests__/avm2-callsuperid.test.js +231 -0
- package/swf2js/__tests__/avm2-class-initializer.test.js +219 -0
- package/swf2js/__tests__/avm2-custom-namespace.test.js +139 -0
- package/swf2js/__tests__/avm2-describe-type.test.js +96 -0
- package/swf2js/__tests__/avm2-dictionary.test.js +96 -0
- package/swf2js/__tests__/avm2-domain-memory.test.js +332 -0
- package/swf2js/__tests__/avm2-e4x.test.js +326 -0
- package/swf2js/__tests__/avm2-exceptions.test.js +81 -0
- package/swf2js/__tests__/avm2-findprop.test.js +110 -0
- package/swf2js/__tests__/avm2-getlex.test.js +166 -0
- package/swf2js/__tests__/avm2-global-slot.test.js +106 -0
- package/swf2js/__tests__/avm2-interface.test.js +95 -0
- package/swf2js/__tests__/avm2-multiname-precedence.test.js +148 -0
- package/swf2js/__tests__/avm2-named-namespace-types.test.js +106 -0
- package/swf2js/__tests__/avm2-optional-args.test.js +100 -0
- package/swf2js/__tests__/avm2-outer-scopes.test.js +101 -0
- package/swf2js/__tests__/avm2-package-internal-class.test.js +106 -0
- package/swf2js/__tests__/avm2-protected-namespace.test.js +105 -0
- package/swf2js/__tests__/avm2-protected.test.js +214 -0
- package/swf2js/__tests__/avm2-qwop-gameplay.test.js +116 -0
- package/swf2js/__tests__/avm2-runtime-namespaces.test.js +159 -0
- package/swf2js/__tests__/avm2-script-traits.test.js +89 -0
- package/swf2js/__tests__/avm2-shared-runtime.test.js +52 -0
- package/swf2js/__tests__/avm2-slot-ops.test.js +117 -0
- package/swf2js/__tests__/avm2-type-ops.test.js +224 -0
- package/swf2js/__tests__/bevel-filter.test.js +116 -0
- package/swf2js/__tests__/bitmap-button-mask.test.js +106 -0
- package/swf2js/__tests__/bitmap-data-draw.test.js +388 -0
- package/swf2js/__tests__/bitmap-decoder.test.js +108 -0
- package/swf2js/__tests__/bitmapdata-color-bounds.test.js +70 -0
- package/swf2js/__tests__/bitmapdata-copy-channel.test.js +91 -0
- package/swf2js/__tests__/bitmapdata-copy-pixels.test.js +136 -0
- package/swf2js/__tests__/bitmapdata-fill-compare.test.js +241 -0
- package/swf2js/__tests__/bitmapdata-filter.test.js +232 -0
- package/swf2js/__tests__/bitmapdata-hit-test.test.js +71 -0
- package/swf2js/__tests__/bitmapdata-merge.test.js +84 -0
- package/swf2js/__tests__/bitmapdata-palette-map.test.js +92 -0
- package/swf2js/__tests__/bitmapdata-pixels-io.test.js +198 -0
- package/swf2js/__tests__/bitmapdata-threshold.test.js +97 -0
- package/swf2js/__tests__/bitmapdata-vector.test.js +82 -0
- package/swf2js/__tests__/blur-filter.test.js +48 -0
- package/swf2js/__tests__/bundle-emitter.test.js +394 -0
- package/swf2js/__tests__/button-actions.test.js +370 -0
- package/swf2js/__tests__/button-color-transform.test.js +48 -0
- package/swf2js/__tests__/button-decoder.test.js +106 -0
- package/swf2js/__tests__/button-hit-test.test.js +825 -0
- package/swf2js/__tests__/button-scaling-grid.test.js +124 -0
- package/swf2js/__tests__/button-sound.test.js +105 -0
- package/swf2js/__tests__/bytearray-coercion.test.js +23 -0
- package/swf2js/__tests__/bytearray-object-serialization.test.js +380 -0
- package/swf2js/__tests__/cfg-switch-loop.test.js +103 -0
- package/swf2js/__tests__/clip-depth-mask.test.js +119 -0
- package/swf2js/__tests__/clipped-bitmap-fill.test.js +118 -0
- package/swf2js/__tests__/companion-swf.test.js +638 -0
- package/swf2js/__tests__/context-menu.test.js +149 -0
- package/swf2js/__tests__/convolution-filter.test.js +74 -0
- package/swf2js/__tests__/definefont4.test.js +280 -0
- package/swf2js/__tests__/display-displacement.test.js +161 -0
- package/swf2js/__tests__/display-list.test.js +80 -0
- package/swf2js/__tests__/display-mask-render.test.js +656 -0
- package/swf2js/__tests__/displayobject-stage.test.js +320 -0
- package/swf2js/__tests__/embedded-script-audio.test.js +131 -0
- package/swf2js/__tests__/embedded-swf.test.js +202 -0
- package/swf2js/__tests__/embedded-textfield.test.js +107 -0
- package/swf2js/__tests__/embedded-timeline-audio.test.js +182 -0
- package/swf2js/__tests__/embedded-timeline-input.test.js +420 -0
- package/swf2js/__tests__/embedded-timer-lifecycle.test.js +145 -0
- package/swf2js/__tests__/event-priority-order.test.js +125 -0
- package/swf2js/__tests__/event-weak-listeners.test.js +53 -0
- package/swf2js/__tests__/event-will-trigger.test.js +43 -0
- package/swf2js/__tests__/flash-text-engine-content.test.js +115 -0
- package/swf2js/__tests__/flash-text-engine-format.test.js +95 -0
- package/swf2js/__tests__/flash-text-engine-line.test.js +314 -0
- package/swf2js/__tests__/font-encoder.test.js +95 -0
- package/swf2js/__tests__/font-outline-text.test.js +659 -0
- package/swf2js/__tests__/glow-shadow-filter.test.js +68 -0
- package/swf2js/__tests__/graphics-bitmap-smoothing.test.js +32 -0
- package/swf2js/__tests__/graphics-fill-lifetime.test.js +36 -0
- package/swf2js/__tests__/graphics-gradient-matrix.test.js +53 -0
- package/swf2js/__tests__/graphics-stroke-hit-test.test.js +457 -0
- package/swf2js/__tests__/hit-test-primitives.test.js +414 -0
- package/swf2js/__tests__/input-events.test.js +714 -0
- package/swf2js/__tests__/integration/corpus.test.js +41 -0
- package/swf2js/__tests__/loader-embedded-swf.test.js +210 -0
- package/swf2js/__tests__/loader-info.test.js +81 -0
- package/swf2js/__tests__/local-connection.test.js +122 -0
- package/swf2js/__tests__/morph-focal-gradient.test.js +51 -0
- package/swf2js/__tests__/morph-topology.test.js +267 -0
- package/swf2js/__tests__/movie-data-codec.test.js +128 -0
- package/swf2js/__tests__/nellymoser-audio.test.js +84 -0
- package/swf2js/__tests__/opaque-background-cache.test.js +352 -0
- package/swf2js/__tests__/path-stream.test.js +81 -0
- package/swf2js/__tests__/place-object-filters.test.js +88 -0
- package/swf2js/__tests__/place-object3-decoder.test.js +116 -0
- package/swf2js/__tests__/place-object3-image.test.js +85 -0
- package/swf2js/__tests__/player-version.test.js +46 -0
- package/swf2js/__tests__/root-textfield.test.js +287 -0
- package/swf2js/__tests__/scaling-grid.test.js +183 -0
- package/swf2js/__tests__/shape-decoder.test.js +361 -0
- package/swf2js/__tests__/shape-line-style2.test.js +138 -0
- package/swf2js/__tests__/shape-nonscaling-stroke.test.js +131 -0
- package/swf2js/__tests__/shape-pixel-hint.test.js +101 -0
- package/swf2js/__tests__/simplebutton-pointer.test.js +1477 -0
- package/swf2js/__tests__/socket-offline.test.js +67 -0
- package/swf2js/__tests__/sound-avm1-stop.test.js +99 -0
- package/swf2js/__tests__/sound-envelope.test.js +110 -0
- package/swf2js/__tests__/sound-extract.test.js +168 -0
- package/swf2js/__tests__/sound-id3.test.js +283 -0
- package/swf2js/__tests__/sound-load.test.js +259 -0
- package/swf2js/__tests__/sound-mixer-spectrum.test.js +261 -0
- package/swf2js/__tests__/sound-stream-sprite.test.js +624 -0
- package/swf2js/__tests__/sound-transform.test.js +104 -0
- package/swf2js/__tests__/speex-audio.test.js +77 -0
- package/swf2js/__tests__/stage-noscale.test.js +45 -0
- package/swf2js/__tests__/swf-encoder.test.js +134 -0
- package/swf2js/__tests__/swflib-assemble.test.js +20 -0
- package/swf2js/__tests__/textfield-html-text.test.js +368 -0
- package/swf2js/__tests__/textfield-line-layout.test.js +339 -0
- package/swf2js/__tests__/textfield-programmatic-overlay.test.js +2506 -0
- package/swf2js/__tests__/textfield-scroll.test.js +79 -0
- package/swf2js/__tests__/textfield-selection.test.js +383 -0
- package/swf2js/__tests__/timeline-effect-surfaces.test.js +295 -0
- package/swf2js/__tests__/timeline-named-anchor.test.js +139 -0
- package/swf2js/__tests__/timeline-scenes.test.js +1723 -0
- package/swf2js/__tests__/urlloader-http-status.test.js +236 -0
- package/{src → swf2js}/cli.js +43 -11
- package/swf2js/compiler/as2-classes.js +156 -0
- package/swf2js/compiler/as2-parser.js +598 -0
- package/swf2js/compiler/avm1-codegen.js +897 -0
- package/swf2js/compiler/index.js +28 -0
- package/{src → swf2js}/decoder/button-decoder.js +3 -1
- package/swf2js/decoder/png.js +114 -0
- package/{src → swf2js}/decoder/shape-decoder.js +20 -10
- package/{src → swf2js}/decoder/tag-decoder.js +5 -3
- package/{src → swf2js}/decoder/tag-types.js +4 -0
- package/swf2js/decompiler/avm1-decompiler.js +1138 -0
- package/{src → swf2js}/emitter/asset-encoder.js +66 -113
- package/{src → swf2js}/emitter/bundle-emitter.js +209 -78
- package/swf2js/emitter/external-resources.js +39 -0
- package/swf2js/emitter/movie-data-codec.js +91 -0
- package/swf2js/encoder/bit-writer.js +182 -0
- package/swf2js/encoder/shape-encoder.js +310 -0
- package/swf2js/encoder/swf-builder.js +639 -0
- package/swf2js/encoder/swf-writer.js +55 -0
- package/{src/runtime/swflib/assemble.js → swf2js/runtime/assemble-swooflib.js} +4 -3
- package/{src → swf2js}/runtime/avm1-runtime.js +102 -63
- package/{src → swf2js}/runtime/index.js +1 -1
- package/{src → swf2js}/runtime/movie-runtime.js +28 -2
- package/{src → swf2js}/transpiler/actionscript.js +82 -19
- package/{src → swf2js}/transpiler/avm1/avm1-opcodes.js +5 -3
- package/{src → swf2js}/transpiler/avm1/avm1-transpiler.js +69 -6
- package/{src → swf2js}/transpiler/avm2/avm2-transpiler.js +1 -1
- package/{src → swf2js}/transpiler/timeline/display-list.js +41 -22
- package/{src → swf2js}/transpiler/timeline/timeline-codegen.js +97 -36
- package/swooflib/README.md +569 -0
- package/swooflib/adpcm.js +147 -0
- package/{src/runtime/swflib → swooflib}/builtins.js +6 -0
- package/{src/runtime/swflib → swooflib}/context-menu.js +7 -1
- package/swooflib/control-definitions.js +42 -0
- package/swooflib/control-widget.js +763 -0
- package/swooflib/controls.js +300 -0
- package/{src/runtime/swflib → swooflib}/display.js +16 -10
- package/{src/runtime/swflib → swooflib}/events.js +11 -0
- package/{src/runtime/swflib → swooflib}/flash.js +6 -5
- package/{src/runtime/swflib → swooflib}/graphics.js +81 -19
- package/{src/runtime/swflib → swooflib}/input.js +12 -14
- package/{src/runtime/swflib → swooflib}/loader.js +52 -22
- package/swooflib/movie-network.js +86 -0
- package/swooflib/path-stream.js +169 -0
- package/{src/runtime/swflib → swooflib}/render.js +3 -13
- package/{src/runtime/swflib → swooflib}/sound.js +25 -2
- package/{src/runtime/swflib → swooflib}/stage.js +3 -3
- package/swooflib/stream-time.js +21 -0
- package/{src/runtime/swflib → swooflib}/system.js +88 -37
- package/{src/runtime/swflib → swooflib}/text-paint.js +14 -3
- package/{src/runtime/swflib → swooflib}/text.js +8 -0
- package/swooflib/xml-node.js +53 -0
- package/src/emitter/timeline-data-codec.js +0 -58
- /package/{src → swf2js}/decoder/symbol-table.js +0 -0
- /package/{src → swf2js}/emitter/embedded-swf.js +0 -0
- /package/{src → swf2js}/emitter/font-encoder.js +0 -0
- /package/{src → swf2js}/model/swf-document.js +0 -0
- /package/{src → swf2js}/model/transpile-result.js +0 -0
- /package/{src → swf2js}/parser/bit-reader.js +0 -0
- /package/{src → swf2js}/parser/decompressor.js +0 -0
- /package/{src → swf2js}/parser/swf-parser.js +0 -0
- /package/{src → swf2js}/pretty-printer/pretty-printer.js +0 -0
- /package/{src → swf2js}/runtime/avm2-runtime.js +0 -0
- /package/{src → swf2js}/runtime/embedded-movie-runtime.js +0 -0
- /package/{src → swf2js}/transpiler/avm1/avm1-ir.js +0 -0
- /package/{src → swf2js}/transpiler/avm1/avm1-rewrite.js +0 -0
- /package/{src → swf2js}/transpiler/avm2/abc-reader.js +0 -0
- /package/{src → swf2js}/transpiler/cfg-structurer.js +0 -0
- /package/{src → swf2js}/util/diagnostics.js +0 -0
- /package/{src → swf2js}/util/logger.js +0 -0
- /package/{src/runtime/swflib → swooflib}/bitmap-image.js +0 -0
- /package/{src/runtime/swflib → swooflib}/bitmap.js +0 -0
- /package/{src/runtime/swflib → swooflib}/bytearray.js +0 -0
- /package/{src/runtime/swflib → swooflib}/compiled-swf.js +0 -0
- /package/{src/runtime/swflib → swooflib}/cursor-flag.js +0 -0
- /package/{src/runtime/swflib → swooflib}/dictionary.js +0 -0
- /package/{src/runtime/swflib → swooflib}/filters.js +0 -0
- /package/{src/runtime/swflib → swooflib}/geom.js +0 -0
- /package/{src/runtime/swflib → swooflib}/glyph-metrics.js +0 -0
- /package/{src/runtime/swflib → swooflib}/host.js +0 -0
- /package/{src/runtime/swflib → swooflib}/inherit.js +0 -0
- /package/{src/runtime/swflib → swooflib}/marks.js +0 -0
- /package/{src/runtime/swflib → swooflib}/matrix3d.js +0 -0
- /package/{src/runtime/swflib → swooflib}/pointer-bridge.js +0 -0
- /package/{src/runtime/swflib → swooflib}/projection.js +0 -0
- /package/{src/runtime/swflib → swooflib}/sprite-drag.js +0 -0
- /package/{src/runtime/swflib → swooflib}/stage-ref.js +0 -0
- /package/{src/runtime/swflib → swooflib}/text-field.js +0 -0
- /package/{src/runtime/swflib → swooflib}/transform.js +0 -0
- /package/{src/runtime/swflib → swooflib}/xml.js +0 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
// Canvas artwork and value API for author-created components. Imported Flash components
|
|
2
|
+
// keep their own skins and implementation.
|
|
3
|
+
import { controlDefinitions } from './control-definitions.js';
|
|
4
|
+
import { choiceItems, controlValue, controlValueChange, createControlWidget } from './control-widget.js';
|
|
5
|
+
import { Event } from './events.js';
|
|
6
|
+
import { Sprite } from './graphics.js';
|
|
7
|
+
import { Matrix } from './geom.js';
|
|
8
|
+
import { TextField } from './text-field.js';
|
|
9
|
+
import { TextFormat } from './text.js';
|
|
10
|
+
|
|
11
|
+
const optionLabel = item =>
|
|
12
|
+
String(item && typeof item === 'object' ? item.label ?? item.name ?? Object.values(item)[0] ?? '' : item ?? '');
|
|
13
|
+
const ink = 0x20252a, border = 0x90979d, face = 0xe8ecef, paper = 0xffffff, accent = 0x447fc0;
|
|
14
|
+
|
|
15
|
+
export class Control extends Sprite {
|
|
16
|
+
constructor(
|
|
17
|
+
kind, parameters = {}, width = controlDefinitions[kind].width, height = controlDefinitions[kind].height,
|
|
18
|
+
resolveBitmap) {
|
|
19
|
+
super();
|
|
20
|
+
this.kind = kind;
|
|
21
|
+
this.parameters = { ...controlDefinitions[kind].parameters, ...parameters };
|
|
22
|
+
this.controlWidth = width;
|
|
23
|
+
this.controlHeight = height;
|
|
24
|
+
this.resolveBitmap = resolveBitmap;
|
|
25
|
+
this.redraw();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getValue() {
|
|
29
|
+
if (this.widget) return this.widget.getValue();
|
|
30
|
+
return controlValue(this.kind, this.parameters);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
setValue(value) {
|
|
34
|
+
this.setParameters(controlValueChange(this.kind, this.parameters, value));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
setParameters(fields) {
|
|
38
|
+
Object.assign(this.parameters, fields);
|
|
39
|
+
if (fields.selectedIndex !== undefined && fields.value === undefined) delete this.parameters.value;
|
|
40
|
+
if (this.widget) {
|
|
41
|
+
this.widget.setParameters(this.parameters);
|
|
42
|
+
Object.assign(this.parameters, this.widget.getProperties());
|
|
43
|
+
}
|
|
44
|
+
this.redraw();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Mount this instance's interactive surface. Property edits and native input now update
|
|
48
|
+
// the same component, including v2-style listeners registered on the display object.
|
|
49
|
+
createWidget(options = {}) {
|
|
50
|
+
if (!this.widget) {
|
|
51
|
+
this.widget = createControlWidget(this.kind, this.parameters, {
|
|
52
|
+
...options,
|
|
53
|
+
onEvent: (type, fields) => {
|
|
54
|
+
Object.assign(this.parameters, fields);
|
|
55
|
+
this.redraw();
|
|
56
|
+
this.dispatchEvent(new Event(type));
|
|
57
|
+
options.onEvent?.(type, fields);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return this.widget;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
redraw() {
|
|
65
|
+
const p = this.parameters, kind = this.kind, w = this.controlWidth, h = this.controlHeight;
|
|
66
|
+
const g = this.graphics;
|
|
67
|
+
g.clear();
|
|
68
|
+
this.removeChildren();
|
|
69
|
+
this.visible = p.visible !== false;
|
|
70
|
+
const rect = (x, y, width, height, color, outline = false) => {
|
|
71
|
+
if (width <= 0 || height <= 0) return;
|
|
72
|
+
if (outline)
|
|
73
|
+
g.lineStyle(1, border);
|
|
74
|
+
else
|
|
75
|
+
g.lineStyle();
|
|
76
|
+
g.beginFill(color);
|
|
77
|
+
g.drawRect(x - w / 2, y - h / 2, width, height);
|
|
78
|
+
g.endFill();
|
|
79
|
+
};
|
|
80
|
+
const line = (x, y, x2, y2, color = border, size = 1) => {
|
|
81
|
+
g.lineStyle(size, color);
|
|
82
|
+
g.moveTo(x - w / 2, y - h / 2);
|
|
83
|
+
g.lineTo(x2 - w / 2, y2 - h / 2);
|
|
84
|
+
};
|
|
85
|
+
const label = (value, x = 3, y = 0, width = w - x, height = h - y, align = 'left', bold = false) => {
|
|
86
|
+
if (!width || height < 5) return;
|
|
87
|
+
const text = new TextField();
|
|
88
|
+
text.defaultTextFormat = new TextFormat(
|
|
89
|
+
'Arial', Math.min(13, height), p.enabled === false ? border : ink, bold, false, false, null, null, align);
|
|
90
|
+
if (p.html && (kind === 'TextArea' || kind === 'Label')) text.htmlText = String(value ?? '');
|
|
91
|
+
else text.text = String(value ?? '');
|
|
92
|
+
text.wordWrap = kind === 'TextArea';
|
|
93
|
+
text.selectable = false;
|
|
94
|
+
text.width = Math.max(1, width);
|
|
95
|
+
text.height = Math.max(1, height);
|
|
96
|
+
text.x = x - w / 2;
|
|
97
|
+
text.y = y - h / 2;
|
|
98
|
+
this.addChild(text);
|
|
99
|
+
};
|
|
100
|
+
const centered = (value, x = 2, width = w - 4, align = 'center') =>
|
|
101
|
+
label(value, x, Math.max(0, (h - 18) / 2), width, 18, align);
|
|
102
|
+
const rows = choiceItems(p);
|
|
103
|
+
const selected = Number(p.selectedIndex ?? -1);
|
|
104
|
+
const rowH = Math.max(8, Number(p.rowHeight) || 19);
|
|
105
|
+
const fraction = (v, min, max) => Math.max(0, Math.min(1, (Number(v) - min) / (max - min || 1)));
|
|
106
|
+
const picture = (source, x, y, width, height, fit = true) => {
|
|
107
|
+
const image = source && this.resolveBitmap?.(source);
|
|
108
|
+
if (!image || width <= 0 || height <= 0) return false;
|
|
109
|
+
const scale = fit ? Math.min(width / image.naturalWidth, height / image.naturalHeight) : 1;
|
|
110
|
+
const drawWidth = Math.min(width, image.naturalWidth * scale);
|
|
111
|
+
const drawHeight = Math.min(height, image.naturalHeight * scale);
|
|
112
|
+
const left = x + (fit ? (width - drawWidth) / 2 : 0) - w / 2;
|
|
113
|
+
const top = y + (fit ? (height - drawHeight) / 2 : 0) - h / 2;
|
|
114
|
+
g.lineStyle();
|
|
115
|
+
g.beginBitmapFill(image, new Matrix(scale, 0, 0, scale, left, top), false, true);
|
|
116
|
+
g.drawRect(left, top, drawWidth, drawHeight);
|
|
117
|
+
g.endFill();
|
|
118
|
+
return true;
|
|
119
|
+
};
|
|
120
|
+
if (kind === 'Label') {
|
|
121
|
+
// A transparent face makes the whole label selectable.
|
|
122
|
+
g.beginFill(paper, 0);
|
|
123
|
+
g.drawRect(-w / 2, -h / 2, w, h);
|
|
124
|
+
g.endFill();
|
|
125
|
+
centered(p.text, 2, w - 4, 'left');
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
rect(
|
|
129
|
+
0, 0, w, h,
|
|
130
|
+
['Button', 'CheckBox', 'RadioButton', 'Slider', 'ScrollBar', 'ProgressBar', 'MenuBar'].includes(kind) ?
|
|
131
|
+
face :
|
|
132
|
+
paper,
|
|
133
|
+
true);
|
|
134
|
+
switch (kind) {
|
|
135
|
+
case 'Button': {
|
|
136
|
+
if (p.selected) rect(1, 1, w - 2, h - 2, 0xcbd9e9);
|
|
137
|
+
const vertical = p.labelPlacement === 'top' || p.labelPlacement === 'bottom';
|
|
138
|
+
const size = Math.max(1, vertical ? Math.min(w - 4, h - 19) : Math.min(h - 4, w / 3));
|
|
139
|
+
const x = vertical ? (w - size) / 2 : p.labelPlacement === 'left' ? w - size - 2 : 2;
|
|
140
|
+
const y = vertical ? (p.labelPlacement === 'top' ? 18 : 1) : (h - size) / 2;
|
|
141
|
+
if (!picture(p.icon, x, y, size, size)) centered(p.label);
|
|
142
|
+
else if (vertical) label(p.label, 1, p.labelPlacement === 'top' ? 0 : h - 18, w - 2, 18, 'center');
|
|
143
|
+
else centered(p.label, p.labelPlacement === 'left' ? 1 : size + 4, w - size - 5);
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
case 'CheckBox':
|
|
147
|
+
case 'RadioButton': {
|
|
148
|
+
const s = Math.min(15, h - 4), x = p.labelPlacement === 'left' ? w - s - 3 : 3, y = (h - s) / 2;
|
|
149
|
+
if (kind === 'RadioButton') {
|
|
150
|
+
g.lineStyle(1, border);
|
|
151
|
+
g.beginFill(paper);
|
|
152
|
+
g.drawCircle(x + s / 2 - w / 2, 0, s / 2);
|
|
153
|
+
g.endFill();
|
|
154
|
+
if (p.selected) {
|
|
155
|
+
g.beginFill(accent);
|
|
156
|
+
g.drawCircle(x + s / 2 - w / 2, 0, s / 4);
|
|
157
|
+
g.endFill();
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
rect(x, y, s, s, paper, true);
|
|
161
|
+
if (p.selected) {
|
|
162
|
+
line(x + 2, y + s / 2, x + s * .45, y + s - 3, accent, 2);
|
|
163
|
+
line(x + s * .45, y + s - 3, x + s - 2, y + 2, accent, 2);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
centered(p.label, p.labelPlacement === 'left' ? 2 : s + 6, w - s - 8, 'left');
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
case 'TextInput':
|
|
170
|
+
case 'TextArea':
|
|
171
|
+
label(
|
|
172
|
+
p.password ? '•'.repeat(String(p.text ?? '').length) : p.text, 3,
|
|
173
|
+
kind === 'TextInput' ? Math.max(0, (h - 18) / 2) : 2);
|
|
174
|
+
break;
|
|
175
|
+
case 'ComboBox':
|
|
176
|
+
case 'DateField':
|
|
177
|
+
case 'NumericStepper':
|
|
178
|
+
rect(w - 18, 1, 17, h - 2, face);
|
|
179
|
+
centered(
|
|
180
|
+
kind === 'DateField' ? p.selectedDate || 'mm/dd/yyyy' :
|
|
181
|
+
kind === 'NumericStepper' ? p.value :
|
|
182
|
+
optionLabel(rows[selected]),
|
|
183
|
+
3, w - 22, 'left');
|
|
184
|
+
centered(kind === 'NumericStepper' ? '↕' : '▾', w - 19, 17);
|
|
185
|
+
break;
|
|
186
|
+
case 'ProgressBar': {
|
|
187
|
+
const ratio = fraction(p.percentComplete, 0, 100), width = (w - 4) * ratio;
|
|
188
|
+
rect(p.direction === 'left' ? w - width - 2 : 2, 2, width, h - 4, accent);
|
|
189
|
+
centered(String(p.label || '').replace('%3', String(p.percentComplete || 0)).replace('%%', '%'));
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
case 'ScrollBar':
|
|
193
|
+
case 'Slider': {
|
|
194
|
+
const scroll = kind === 'ScrollBar', vertical = scroll ? !p.horizontal : p.direction === 'vertical';
|
|
195
|
+
const amount = fraction(
|
|
196
|
+
scroll ? p.scrollPosition : p.value, scroll ? p.minScrollPosition : p.minimum,
|
|
197
|
+
scroll ? p.maxScrollPosition : p.maximum);
|
|
198
|
+
if (vertical) {
|
|
199
|
+
rect(w / 2 - 2, 3, 4, h - 6, border);
|
|
200
|
+
rect(2, 2 + (h - 16) * (scroll ? amount : 1 - amount), w - 4, 12, accent);
|
|
201
|
+
} else {
|
|
202
|
+
rect(3, h / 2 - 2, w - 6, 4, border);
|
|
203
|
+
rect(2 + (w - 16) * amount, 2, 12, h - 4, accent);
|
|
204
|
+
}
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
case 'ColorPicker':
|
|
208
|
+
rect(
|
|
209
|
+
4, 4, w - 8, h - 8,
|
|
210
|
+
typeof p.selectedColor === 'number' ? p.selectedColor :
|
|
211
|
+
parseInt(String(p.selectedColor).replace('#', ''), 16));
|
|
212
|
+
break;
|
|
213
|
+
case 'Alert':
|
|
214
|
+
case 'Window':
|
|
215
|
+
rect(1, 1, w - 2, Math.min(24, h - 2), face);
|
|
216
|
+
label(p.title, 4, 3, w - 26, 18, 'left', true);
|
|
217
|
+
if (p.closeButton !== false) label('×', w - 22, 3, 20, 18, 'center');
|
|
218
|
+
if (!picture(p.contentPath, 2, 25, w - 4, h - 27)) label(p.text || p.contentPath, 4, 26);
|
|
219
|
+
if (kind === 'Alert' && h > 55) {
|
|
220
|
+
rect(w / 2 - 24, h - 25, 48, 22, face, true);
|
|
221
|
+
label('OK', w / 2 - 24, h - 23, 48, 18, 'center');
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
case 'ScrollPane':
|
|
225
|
+
case 'Loader':
|
|
226
|
+
if ((kind === 'Loader' && p.autoLoad === false) ||
|
|
227
|
+
!picture(p.contentPath, 2, 2, w - 4, h - 4, kind === 'Loader' && p.scaleContent !== false)) {
|
|
228
|
+
label(p.contentPath || controlDefinitions[kind].label, 4, 3);
|
|
229
|
+
}
|
|
230
|
+
break;
|
|
231
|
+
case 'DateChooser': {
|
|
232
|
+
const date = p.selectedDate ? new Date(String(p.selectedDate).slice(0, 10) + 'T12:00:00') : new Date();
|
|
233
|
+
if (Number.isNaN(date.getTime())) break;
|
|
234
|
+
const rh = h / 8, cw = w / 7;
|
|
235
|
+
rect(1, 1, w - 2, rh, face);
|
|
236
|
+
label(date.toLocaleString(undefined, { month: 'long', year: 'numeric' }), 1, 1, w - 2, rh, 'center', true);
|
|
237
|
+
const first = Number(p.firstDayOfWeek) || 0;
|
|
238
|
+
for (let i = 0; i < 7; i++)
|
|
239
|
+
label(
|
|
240
|
+
(p.dayNames ?? ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'])[(i + first) % 7], cw * i, rh, cw, rh,
|
|
241
|
+
'center');
|
|
242
|
+
const offset = (new Date(date.getFullYear(), date.getMonth(), 1).getDay() - first + 7) % 7;
|
|
243
|
+
const days = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
|
|
244
|
+
for (let d = 1; d <= days; d++) {
|
|
245
|
+
const at = offset + d - 1;
|
|
246
|
+
label(d, cw * (at % 7), rh * (2 + Math.floor(at / 7)), cw, rh, 'center');
|
|
247
|
+
}
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
case 'MenuBar':
|
|
251
|
+
case 'TileList': {
|
|
252
|
+
const count = kind === 'MenuBar' ? Math.max(1, rows.length) : Math.max(1, Math.floor(w / 58));
|
|
253
|
+
const cell = w / count;
|
|
254
|
+
rows.slice(0, count * Math.ceil(h / rowH)).forEach((item, i) => {
|
|
255
|
+
const x = (i % count) * cell, y = Math.floor(i / count) * rowH;
|
|
256
|
+
rect(x + 1, y + 1, cell - 2, rowH - 1, i === selected ? 0xc5ddf6 : face, true);
|
|
257
|
+
label(optionLabel(item), x + 1, y + 1, cell - 2, rowH - 1, 'center');
|
|
258
|
+
});
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
case 'DataGrid': {
|
|
262
|
+
const cols = p.columns?.length ? p.columns : ['label'], cell = w / cols.length;
|
|
263
|
+
rect(1, 1, w - 2, rowH, face);
|
|
264
|
+
cols.forEach(
|
|
265
|
+
(c, i) => label(c?.headerText ?? c?.dataField ?? c, i * cell + 2, 1, cell - 3, rowH, 'left', true));
|
|
266
|
+
rows.slice(0, Math.ceil(h / rowH) - 1).forEach((item, i) => {
|
|
267
|
+
const y = (i + 1) * rowH;
|
|
268
|
+
if (i === selected) rect(1, y, w - 2, rowH, 0xc5ddf6);
|
|
269
|
+
cols.forEach(
|
|
270
|
+
(c, j) => label(item?.[c?.dataField ?? c] ?? optionLabel(item), cell * j + 2, y, cell - 3, rowH));
|
|
271
|
+
});
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
default:
|
|
275
|
+
if (Array.isArray(rows))
|
|
276
|
+
rows.slice(0, Math.ceil(h / rowH)).forEach((item, i) => {
|
|
277
|
+
if (i === selected || kind === 'Accordion')
|
|
278
|
+
rect(1, i * rowH + 1, w - 2, rowH - 1, i === selected ? 0xc5ddf6 : face);
|
|
279
|
+
label(
|
|
280
|
+
(kind === 'Tree' || kind === 'Accordion' ? '▸ ' : '') + optionLabel(item), 3, i * rowH + 1, w - 6,
|
|
281
|
+
rowH);
|
|
282
|
+
});
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// Flash accesses parameters as properties on the instance.
|
|
289
|
+
const fields = new Set(Object.values(controlDefinitions).flatMap(item => Object.keys(item.parameters)));
|
|
290
|
+
for (const name of [...fields, 'selectedIndices', 'selectedItem', 'selectedData']) {
|
|
291
|
+
if (name in Control.prototype) continue;
|
|
292
|
+
Object.defineProperty(Control.prototype, name, {
|
|
293
|
+
get() {
|
|
294
|
+
return this.widget ? this.widget.getProperties()[name] : this.parameters[name];
|
|
295
|
+
},
|
|
296
|
+
set(value) {
|
|
297
|
+
this.setParameters({ [name]: value });
|
|
298
|
+
},
|
|
299
|
+
});
|
|
300
|
+
}
|
|
@@ -11,6 +11,7 @@ export var displayMaskOwners = new WeakMap();
|
|
|
11
11
|
export var detachedAuthoredMaskBases = new WeakMap();
|
|
12
12
|
export var authoredMaskSources = new WeakMap();
|
|
13
13
|
export var authoredSpriteSizing = new WeakSet();
|
|
14
|
+
export const buttonArtworkBounds = Symbol('buttonArtworkBounds');
|
|
14
15
|
|
|
15
16
|
export function isStageDescendant(stage, target) {
|
|
16
17
|
var node = target;
|
|
@@ -53,7 +54,7 @@ export class DisplayObject extends EventDispatcher {
|
|
|
53
54
|
|
|
54
55
|
hitTestObject(obj) {
|
|
55
56
|
if (!obj || this.visible === false || obj.visible === false) return false;
|
|
56
|
-
var a = displayTreePixelBounds(this), b = displayTreePixelBounds(obj);
|
|
57
|
+
var a = displayTreePixelBounds(this, 'shape'), b = displayTreePixelBounds(obj, 'shape');
|
|
57
58
|
return !!(a && b && a.intersects(b));
|
|
58
59
|
}
|
|
59
60
|
|
|
@@ -89,7 +90,7 @@ export class DisplayObject extends EventDispatcher {
|
|
|
89
90
|
}
|
|
90
91
|
if (graphicsMatrix) return this.graphics.containsPoint(p.x, p.y, graphicsMatrix);
|
|
91
92
|
}
|
|
92
|
-
var bounds = authoredSpriteSizing.has(this) ? displayBoundsInTarget(this, this, true) : localDisplayBounds(this);
|
|
93
|
+
var bounds = authoredSpriteSizing.has(this) ? displayBoundsInTarget(this, this, true, 'live') : localDisplayBounds(this);
|
|
93
94
|
if (!(p.x >= bounds.x && p.y >= bounds.y && p.x < bounds.right && p.y < bounds.bottom)) {
|
|
94
95
|
if (shapeFlag || !isSprite(this)) return false;
|
|
95
96
|
// Unnamed timeline artwork may have no native child or Graphics commands.
|
|
@@ -641,13 +642,13 @@ export function mapBounds(bounds, mapPoint) {
|
|
|
641
642
|
mapPoint(new Point(x, bottom)), mapPoint(new Point(right, bottom))]);
|
|
642
643
|
}
|
|
643
644
|
|
|
644
|
-
export function displayBoundsInTarget(object, target, includeStrokes) {
|
|
645
|
+
export function displayBoundsInTarget(object, target, includeStrokes, mode = includeStrokes === false ? 'edges' : 'shape') {
|
|
645
646
|
materializeIndexedAuthoredChildren(object);
|
|
646
647
|
function subtreeBounds(node) {
|
|
647
648
|
if (node._scrollRect) return scrollViewportBounds(node);
|
|
648
|
-
var bounds = localDisplayBounds(node, includeStrokes);
|
|
649
|
+
var bounds = localDisplayBounds(node, includeStrokes, mode);
|
|
649
650
|
if (!(bounds.width || bounds.height)) bounds = null;
|
|
650
|
-
var authored = !node._swoofAuthoredText && authoredMaskSources.get(node)?.bounds?.(node);
|
|
651
|
+
var authored = !node._swoofAuthoredText && authoredMaskSources.get(node)?.bounds?.(node, mode);
|
|
651
652
|
if (authored) {
|
|
652
653
|
var placed = new Rectangle(authored.x, authored.y, authored.w, authored.h);
|
|
653
654
|
bounds = bounds ? bounds.union(placed) : placed;
|
|
@@ -668,7 +669,7 @@ export function displayBoundsInTarget(object, target, includeStrokes) {
|
|
|
668
669
|
return mapBounds(bounds, function (point) { return target.globalToLocal(object.localToGlobal(point)); });
|
|
669
670
|
}
|
|
670
671
|
|
|
671
|
-
export function displayTreePixelBounds(object) {
|
|
672
|
+
export function displayTreePixelBounds(object, mode = 'live') {
|
|
672
673
|
if (!object) return null;
|
|
673
674
|
var scroll = object._scrollRect;
|
|
674
675
|
if (scroll) {
|
|
@@ -682,14 +683,14 @@ export function displayTreePixelBounds(object) {
|
|
|
682
683
|
return object.localToGlobal(point);
|
|
683
684
|
});
|
|
684
685
|
}
|
|
685
|
-
var bounds = globalBounds(object);
|
|
686
|
-
var authored = !object._swoofAuthoredText && authoredMaskSources.get(object)?.bounds?.(object);
|
|
686
|
+
var bounds = globalBounds(object, object._swoofMorphLeaf ? localDisplayBounds(object, true, mode) : undefined);
|
|
687
|
+
var authored = !object._swoofAuthoredText && authoredMaskSources.get(object)?.bounds?.(object, mode);
|
|
687
688
|
if (authored) {
|
|
688
689
|
var placed = globalBounds(object, new Rectangle(authored.x, authored.y, authored.w, authored.h));
|
|
689
690
|
if (placed) bounds = bounds ? bounds.union(placed) : placed;
|
|
690
691
|
}
|
|
691
692
|
for (var child of object._children || []) {
|
|
692
|
-
var childBounds = displayTreePixelBounds(child);
|
|
693
|
+
var childBounds = displayTreePixelBounds(child, mode);
|
|
693
694
|
if (childBounds) bounds = bounds ? bounds.union(childBounds) : childBounds;
|
|
694
695
|
}
|
|
695
696
|
return bounds;
|
|
@@ -706,7 +707,12 @@ export function authoredTextLocalBounds(field) {
|
|
|
706
707
|
return field._swoofAuthoredText && authoredMaskSources.get(field)?.bounds?.(field);
|
|
707
708
|
}
|
|
708
709
|
|
|
709
|
-
export function localDisplayBounds(object, includeStrokes) {
|
|
710
|
+
export function localDisplayBounds(object, includeStrokes, mode = 'live') {
|
|
711
|
+
if (object._swoofMorphLeaf) {
|
|
712
|
+
var morphBounds = authoredMaskSources.get(object)?.bounds?.(object, mode);
|
|
713
|
+
if (morphBounds) return new Rectangle(morphBounds.x, morphBounds.y, morphBounds.w, morphBounds.h);
|
|
714
|
+
}
|
|
715
|
+
if (object[buttonArtworkBounds]) return object[buttonArtworkBounds](includeStrokes);
|
|
710
716
|
if (isTextLine(object)) return new Rectangle(0, -object.ascent, object.width, object.height);
|
|
711
717
|
var textBounds = authoredTextLocalBounds(object);
|
|
712
718
|
if (textBounds) return new Rectangle(textBounds.x, textBounds.y, textBounds.w, textBounds.h);
|
|
@@ -73,6 +73,17 @@ export class TextEvent extends Event {
|
|
|
73
73
|
clone() { return new TextEvent(this.type, this.bubbles, this.cancelable, this.text); }
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
export class DataEvent extends TextEvent {
|
|
77
|
+
static DATA = 'data';
|
|
78
|
+
static UPLOAD_COMPLETE_DATA = 'uploadCompleteData';
|
|
79
|
+
constructor(type, bubbles = false, cancelable = false, data = '') {
|
|
80
|
+
super(type, bubbles, cancelable, data);
|
|
81
|
+
}
|
|
82
|
+
get data() { return this.text; }
|
|
83
|
+
set data(value) { this.text = value; }
|
|
84
|
+
clone() { return new DataEvent(this.type, this.bubbles, this.cancelable, this.data); }
|
|
85
|
+
}
|
|
86
|
+
|
|
76
87
|
export class IOErrorEvent extends Event {
|
|
77
88
|
static IO_ERROR = 'ioError';
|
|
78
89
|
constructor(type, bubbles, cancelable, text, id) {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { ByteArray, Endian, FlashProxy } from './bytearray.js';
|
|
9
9
|
import { Dictionary } from './dictionary.js';
|
|
10
|
-
import { AntiAliasType, AsyncErrorEvent, BlendMode, ContextMenuEvent, Event, EventDispatcher, FocusEvent, GestureEvent, GesturePhase, GridFitType, HTTPStatusEvent, IEventDispatcher, IOErrorEvent, KeyboardEvent, MouseEvent, PressAndTapGestureEvent, ProgressEvent, SecurityErrorEvent, StageAlign, StageQuality, StageScaleMode, StatusEvent, TextEvent, TextFieldAutoSize, TextFieldType, Timer, TimerEvent, TouchEvent, TouchEventIntent, TransformGestureEvent, rootTimers } from './events.js';
|
|
10
|
+
import { AntiAliasType, AsyncErrorEvent, BlendMode, ContextMenuEvent, DataEvent, Event, EventDispatcher, FocusEvent, GestureEvent, GesturePhase, GridFitType, HTTPStatusEvent, IEventDispatcher, IOErrorEvent, KeyboardEvent, MouseEvent, PressAndTapGestureEvent, ProgressEvent, SecurityErrorEvent, StageAlign, StageQuality, StageScaleMode, StatusEvent, TextEvent, TextFieldAutoSize, TextFieldType, Timer, TimerEvent, TouchEvent, TouchEventIntent, TransformGestureEvent, rootTimers } from './events.js';
|
|
11
11
|
import { ColorTransform, Matrix, Matrix3D, Point, Rectangle, Vector, Vector3D } from './geom.js';
|
|
12
12
|
import { DisplayObject, DisplayObjectContainer, InteractiveObject } from './display.js';
|
|
13
13
|
import { Graphics, GraphicsPathCommand, GraphicsPathWinding, Shape, Sprite } from './graphics.js';
|
|
@@ -19,11 +19,12 @@ import { FrameLabel, Loader, LoaderInfo, MovieClip, Scene, SimpleButton } from '
|
|
|
19
19
|
import { PerspectiveProjection } from './projection.js';
|
|
20
20
|
import { ID3Info, Sound, SoundChannel, SoundLoaderContext, SoundMixer, SoundTransform } from './sound.js';
|
|
21
21
|
import { Key, Keyboard, Mouse, MouseCursorData, StageClass } from './stage.js';
|
|
22
|
-
import { ApplicationDomain, Capabilities, ExternalInterface, LoaderContext, LocalConnection, Security, SharedObject, Socket, System, URLLoader, URLLoaderDataFormat, URLRequest, URLRequestHeader, URLRequestMethod, URLVariables, asInt, asUint, describeType, getDefinitionByName, getQualifiedClassName, getTimer, navigateToURL, qualifiedBuiltinNames } from './system.js';
|
|
22
|
+
import { ApplicationDomain, Capabilities, ExternalInterface, LoaderContext, LocalConnection, Security, SharedObject, Socket, XMLSocket, System, URLLoader, URLLoaderDataFormat, URLRequest, URLRequestHeader, URLRequestMethod, URLVariables, asInt, asUint, describeType, getDefinitionByName, getQualifiedClassName, getTimer, navigateToURL, qualifiedBuiltinNames } from './system.js';
|
|
23
23
|
import { TextField, TextLineMetrics } from './text-field.js';
|
|
24
24
|
import { Font, StyleSheet, TextFormat, TextFormatAlign, textEngine } from './text.js';
|
|
25
25
|
import { Transform } from './transform.js';
|
|
26
26
|
import { XML, XMLDocument, XMLList } from './xml.js';
|
|
27
|
+
import { XMLNode } from './xml-node.js';
|
|
27
28
|
|
|
28
29
|
export const asPackages = {};
|
|
29
30
|
export const builtins = {};
|
|
@@ -34,7 +35,7 @@ export function flashPackageTree() {
|
|
|
34
35
|
packageTree = {
|
|
35
36
|
geom: { ColorTransform, Matrix, Matrix3D, Point, Rectangle, Transform, Vector3D },
|
|
36
37
|
events: {
|
|
37
|
-
Event, EventDispatcher, IEventDispatcher, TextEvent, MouseEvent, TouchEvent, TouchEventIntent,
|
|
38
|
+
Event, EventDispatcher, IEventDispatcher, DataEvent, TextEvent, MouseEvent, TouchEvent, TouchEventIntent,
|
|
38
39
|
GestureEvent, GesturePhase, PressAndTapGestureEvent, TransformGestureEvent, KeyboardEvent, FocusEvent,
|
|
39
40
|
ContextMenuEvent, IOErrorEvent, ProgressEvent, HTTPStatusEvent, StatusEvent, AsyncErrorEvent,
|
|
40
41
|
TimerEvent, SecurityErrorEvent,
|
|
@@ -65,11 +66,11 @@ export function flashPackageTree() {
|
|
|
65
66
|
AntiAliasType, GridFitType, engine: textEngine,
|
|
66
67
|
},
|
|
67
68
|
net: {
|
|
68
|
-
SharedObject, URLLoader, URLLoaderDataFormat, Socket, LocalConnection,
|
|
69
|
+
SharedObject, URLLoader, URLLoaderDataFormat, Socket, XMLSocket, LocalConnection,
|
|
69
70
|
URLRequest, URLRequestHeader, URLVariables, URLRequestMethod, navigateToURL,
|
|
70
71
|
},
|
|
71
72
|
external: { ExternalInterface },
|
|
72
|
-
xml: { XMLDocument },
|
|
73
|
+
xml: { XMLDocument, XMLNode },
|
|
73
74
|
Vector,
|
|
74
75
|
};
|
|
75
76
|
return packageTree;
|
|
@@ -22,6 +22,42 @@ export class GraphicsPathWinding {
|
|
|
22
22
|
static NON_ZERO = 'nonZero';
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
function gradientFill(type, colors, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPointRatio) {
|
|
26
|
+
return { gradientType: type || 'linear', colors: colors || [], alphas: alphas || [], ratios: ratios || [], matrix: matrix || null,
|
|
27
|
+
spreadMethod: spreadMethod || 'pad', interpolationMethod: interpolationMethod || 'rgb', focalPointRatio: +focalPointRatio || 0 };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function strokeGradient(ctx, fill) {
|
|
31
|
+
const m = fill.matrix || new Matrix();
|
|
32
|
+
const repeat = fill.spreadMethod === 'repeat' || fill.spreadMethod === 'reflect';
|
|
33
|
+
let gradient, first = 0, last = repeat ? 7 : 0;
|
|
34
|
+
if (fill.gradientType === 'radial') {
|
|
35
|
+
const focus = fill.focalPointRatio * 819.2;
|
|
36
|
+
const x = m.tx + m.a * focus, y = m.ty + m.b * focus;
|
|
37
|
+
gradient = ctx.createRadialGradient(x, y, 0, m.tx + (m.tx - x) * last, m.ty + (m.ty - y) * last,
|
|
38
|
+
Math.max(0.01, Math.hypot(m.a, m.b) * 819.2 * (last + 1)));
|
|
39
|
+
} else {
|
|
40
|
+
// Gradient colors are constant along its transformed Y axis, including under shear.
|
|
41
|
+
const length = m.c * m.c + m.d * m.d;
|
|
42
|
+
const projection = length && (m.a * m.d - m.b * m.c) / length;
|
|
43
|
+
const x = length ? m.d * projection : m.a, y = length ? -m.c * projection : m.b;
|
|
44
|
+
first = repeat ? -4 : 0;
|
|
45
|
+
last = repeat ? 4 : 0;
|
|
46
|
+
const from = (first * 2 - 1) * 819.2, to = (last * 2 + 1) * 819.2;
|
|
47
|
+
gradient = ctx.createLinearGradient(m.tx + x * from, m.ty + y * from, m.tx + x * to, m.ty + y * to);
|
|
48
|
+
}
|
|
49
|
+
const stops = gradientStops({ ...fill, spreadMethod: 'pad' });
|
|
50
|
+
for (let tile = first; tile <= last; tile++) {
|
|
51
|
+
const reverse = fill.spreadMethod === 'reflect' && Math.abs(tile % 2) === 1;
|
|
52
|
+
for (let i = 0; i < stops.length; i++) {
|
|
53
|
+
const stop = stops[reverse ? stops.length - 1 - i : i];
|
|
54
|
+
const ratio = (tile - first + (reverse ? 1 - stop.ratio : stop.ratio)) / (last - first + 1);
|
|
55
|
+
gradient.addColorStop(ratio, cssColor(stop.color, stop.alpha));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return gradient;
|
|
59
|
+
}
|
|
60
|
+
|
|
25
61
|
/** Canvas-backed AS3/AS2 Graphics — records commands, replayed in renderTree. */
|
|
26
62
|
|
|
27
63
|
export class Graphics {
|
|
@@ -44,19 +80,30 @@ export class Graphics {
|
|
|
44
80
|
this._cmds.push({ op: 'fill', fill: this._fill });
|
|
45
81
|
}
|
|
46
82
|
beginGradientFill(type, colors, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPointRatio) {
|
|
47
|
-
this._fill =
|
|
48
|
-
gradientType: type || 'linear', colors: colors || [], alphas: alphas || [], ratios: ratios || [], matrix: matrix || null,
|
|
49
|
-
spreadMethod: spreadMethod || 'pad', interpolationMethod: interpolationMethod || 'rgb', focalPointRatio: +focalPointRatio || 0,
|
|
50
|
-
}
|
|
83
|
+
this._fill = gradientFill(type, colors, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPointRatio);
|
|
51
84
|
this._cmds.push({ op: 'fill', fill: this._fill });
|
|
52
85
|
}
|
|
86
|
+
lineBitmapStyle(bitmap, matrix, repeat, smooth) {
|
|
87
|
+
if (!this._line) return;
|
|
88
|
+
this._line = { ...this._line, fill: { bitmap, matrix, repeat: repeat !== false, smooth: !!smooth } };
|
|
89
|
+
this._cmds.push({ op: 'lineStyle', line: this._line });
|
|
90
|
+
}
|
|
91
|
+
lineGradientStyle(type, colors, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPointRatio) {
|
|
92
|
+
if (!this._line) return;
|
|
93
|
+
const fill = gradientFill(type, colors, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPointRatio);
|
|
94
|
+
this._line = { ...this._line, fill };
|
|
95
|
+
this._cmds.push({ op: 'lineStyle', line: this._line });
|
|
96
|
+
}
|
|
53
97
|
endFill() {
|
|
54
98
|
this._cmds.push({ op: 'endFill' });
|
|
55
99
|
this._fill = null;
|
|
56
100
|
}
|
|
57
101
|
lineStyle(thickness, color, alpha, pixelHinting, scaleMode, caps, joints, miterLimit) {
|
|
102
|
+
this._setLineStyle(thickness == null ? NaN : Math.min(255, Math.max(0, +thickness)), color, alpha, pixelHinting, scaleMode, caps, joints, miterLimit);
|
|
103
|
+
}
|
|
104
|
+
_setLineStyle(width, color, alpha, pixelHinting, scaleMode, caps, joints, miterLimit) {
|
|
58
105
|
this._line = {
|
|
59
|
-
width
|
|
106
|
+
width,
|
|
60
107
|
color: cssColor(color == null ? 0 : color, alpha),
|
|
61
108
|
pixelHinting: !!pixelHinting,
|
|
62
109
|
scaleMode: scaleMode || 'normal',
|
|
@@ -66,6 +113,14 @@ export class Graphics {
|
|
|
66
113
|
}
|
|
67
114
|
this._cmds.push({ op: 'lineStyle', line: this._line });
|
|
68
115
|
}
|
|
116
|
+
// Dashes for the current line style (Studio's strokeDash; Flash has none): on/off lengths in
|
|
117
|
+
// the shape's own units, as canvas setLineDash.
|
|
118
|
+
lineDashStyle(dash, offset) {
|
|
119
|
+
if (!this._line) return;
|
|
120
|
+
var lengths = Array.isArray(dash) ? dash.map(Number).filter(function (n) { return isFinite(n) && n >= 0; }) : [];
|
|
121
|
+
this._line.dash = lengths.some(function (n) { return n > 0; }) ? lengths : null;
|
|
122
|
+
this._line.dashOffset = +offset || 0;
|
|
123
|
+
}
|
|
69
124
|
moveTo(x, y) { this._cmds.push({ op: 'M', x: +x || 0, y: +y || 0 }); };
|
|
70
125
|
lineTo(x, y) { this._cmds.push({ op: 'L', x: +x || 0, y: +y || 0 }); };
|
|
71
126
|
curveTo(cx, cy, x, y) {
|
|
@@ -306,6 +361,15 @@ export class Graphics {
|
|
|
306
361
|
var activeFill = null;
|
|
307
362
|
var strokes = graphicsStrokeRuns();
|
|
308
363
|
var fillRule = 'nonzero';
|
|
364
|
+
function bitmapPattern(ctx, fill) {
|
|
365
|
+
const image = bitmapDisplayImage(fill.bitmap.bitmapData || fill.bitmap) || fill.bitmap;
|
|
366
|
+
try {
|
|
367
|
+
const pattern = ctx.createPattern(image, fill.repeat ? 'repeat' : 'no-repeat');
|
|
368
|
+
const m = fill.matrix;
|
|
369
|
+
if (m && typeof pattern?.setTransform === 'function') pattern.setTransform({ a: m.a, b: m.b, c: m.c, d: m.d, e: m.tx, f: m.ty });
|
|
370
|
+
return pattern || '#888';
|
|
371
|
+
} catch (_) { return '#888'; }
|
|
372
|
+
}
|
|
309
373
|
function paintStroke(run) {
|
|
310
374
|
var matrix = null;
|
|
311
375
|
if ((run.line.width === 0 || run.line.pixelHinting || run.line.scaleMode !== 'normal') && typeof ctx.getTransform === 'function') {
|
|
@@ -315,7 +379,12 @@ export class Graphics {
|
|
|
315
379
|
var plan = graphicsStrokePlan(run.line, matrix);
|
|
316
380
|
var strokePath = buildGraphicsStrokePath(run, plan);
|
|
317
381
|
applyGraphicsLineStyle(ctx, run.line, plan.width);
|
|
318
|
-
|
|
382
|
+
const bitmap = run.line.fill?.bitmap;
|
|
383
|
+
if (bitmap) {
|
|
384
|
+
ctx.save();
|
|
385
|
+
ctx.imageSmoothingEnabled = run.line.fill.smooth;
|
|
386
|
+
}
|
|
387
|
+
ctx.strokeStyle = bitmap ? bitmapPattern(ctx, run.line.fill) : run.line.fill?.gradientType ? strokeGradient(ctx, run.line.fill) : run.line.color;
|
|
319
388
|
if (plan.pen && typeof ctx.getTransform === 'function') {
|
|
320
389
|
var pen = plan.pen;
|
|
321
390
|
ctx.save();
|
|
@@ -323,6 +392,7 @@ export class Graphics {
|
|
|
323
392
|
ctx.stroke(strokePath);
|
|
324
393
|
ctx.restore();
|
|
325
394
|
} else ctx.stroke(strokePath);
|
|
395
|
+
if (bitmap) ctx.restore();
|
|
326
396
|
}
|
|
327
397
|
function paintFill(path, rule) {
|
|
328
398
|
ctx.fillStyle = fillStyle;
|
|
@@ -446,19 +516,7 @@ export class Graphics {
|
|
|
446
516
|
}
|
|
447
517
|
fillStyle = grad;
|
|
448
518
|
} else if (c.fill && c.fill.bitmap) {
|
|
449
|
-
|
|
450
|
-
var img = bmp && (bitmapDisplayImage(bmp.bitmapData || bmp) || bmp);
|
|
451
|
-
if (img && typeof document !== 'undefined') {
|
|
452
|
-
try {
|
|
453
|
-
fillStyle = ctx.createPattern(img, c.fill.repeat ? 'repeat' : 'no-repeat') || '#888';
|
|
454
|
-
if (fillStyle && c.fill.matrix && typeof fillStyle.setTransform === 'function') {
|
|
455
|
-
var bm = c.fill.matrix;
|
|
456
|
-
fillStyle.setTransform(typeof DOMMatrix !== 'undefined'
|
|
457
|
-
? new DOMMatrix([bm.a, bm.b, bm.c, bm.d, bm.tx, bm.ty])
|
|
458
|
-
: { a: bm.a, b: bm.b, c: bm.c, d: bm.d, e: bm.tx, f: bm.ty });
|
|
459
|
-
}
|
|
460
|
-
} catch (_) { fillStyle = '#888'; }
|
|
461
|
-
} else fillStyle = '#888';
|
|
519
|
+
fillStyle = bitmapPattern(ctx, c.fill);
|
|
462
520
|
} else {
|
|
463
521
|
fillStyle = (c.fill && c.fill.color) || '#000';
|
|
464
522
|
}
|
|
@@ -650,6 +708,10 @@ export function applyGraphicsLineStyle(ctx, line, width) {
|
|
|
650
708
|
ctx.lineCap = line.cap;
|
|
651
709
|
ctx.lineJoin = line.join;
|
|
652
710
|
ctx.miterLimit = line.miterLimit;
|
|
711
|
+
if (ctx.setLineDash) {
|
|
712
|
+
ctx.setLineDash(line.dash || []);
|
|
713
|
+
ctx.lineDashOffset = line.dash ? line.dashOffset || 0 : 0;
|
|
714
|
+
}
|
|
653
715
|
}
|
|
654
716
|
|
|
655
717
|
// Split stroke paths at lineStyle changes without splitting the fill path.
|
|
@@ -63,21 +63,19 @@ export function primaryClickType(button, e) {
|
|
|
63
63
|
if (!inSequence) lastPrimaryClick = { button: button, time: now, x: e.clientX, y: e.clientY };
|
|
64
64
|
return MouseEvent.CLICK;
|
|
65
65
|
}
|
|
66
|
-
export function
|
|
67
|
-
if (!button
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (!(local.x >= bounds.x && local.y >= bounds.y && local.x <= bounds.x + bounds.width && local.y <= bounds.y + bounds.height)) return false;
|
|
73
|
-
if (target.graphics.containsPoint && typeof document !== 'undefined' && typeof Path2D !== 'undefined') {
|
|
74
|
-
return target.graphics.containsPoint(local.x, local.y);
|
|
75
|
-
}
|
|
76
|
-
return true;
|
|
66
|
+
export function simpleButtonState(button) {
|
|
67
|
+
if (!button.enabled) return button.upState;
|
|
68
|
+
var over = _hoveredButton === button;
|
|
69
|
+
if ((Mouse._isDown && _buttonCapture === button && over) ||
|
|
70
|
+
(_keyboardButtonCapture && _keyboardButtonCapture.button === button)) {
|
|
71
|
+
return button.downState || button.overState || button.upState;
|
|
77
72
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
if (!over) return button.upState;
|
|
74
|
+
return button.overState || button.upState;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function buttonHitTest(button, x, y) {
|
|
78
|
+
return !!button?.enabled && SimpleButton.prototype.hitTestPoint.call(button, x, y, true);
|
|
81
79
|
}
|
|
82
80
|
export var bitmapMaskBase64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
83
81
|
export function bitmapStencilHasPixel(image, x, y, width) {
|