gdcore-tools 2.0.0-gd-v5.5.223-autobuild → 2.0.0-gd-v5.5.225-autobuild

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.
Files changed (202) hide show
  1. package/dist/Runtime/CustomRuntimeObject.js +1 -1
  2. package/dist/Runtime/CustomRuntimeObject.js.map +2 -2
  3. package/dist/Runtime/CustomRuntimeObject2D.js.map +2 -2
  4. package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js.map +2 -2
  5. package/dist/Runtime/Extensions/3D/Base3DBehavior.js.map +2 -2
  6. package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js +1 -1
  7. package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js.map +2 -2
  8. package/dist/Runtime/Extensions/3D/Cube3DRuntimeObjectPixiRenderer.js +1 -1
  9. package/dist/Runtime/Extensions/3D/Cube3DRuntimeObjectPixiRenderer.js.map +2 -2
  10. package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js.map +2 -2
  11. package/dist/Runtime/Extensions/3D/CustomRuntimeObject3DRenderer.js.map +2 -2
  12. package/dist/Runtime/Extensions/3D/JsExtension.js +219 -108
  13. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js +1 -1
  14. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js.map +2 -2
  15. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js +1 -1
  16. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js.map +2 -2
  17. package/dist/Runtime/Extensions/AdMob/JsExtension.js +63 -1
  18. package/dist/Runtime/Extensions/AdMob/admobtools.js +1 -1
  19. package/dist/Runtime/Extensions/AdMob/admobtools.js.map +2 -2
  20. package/dist/Runtime/Extensions/AdvancedWindow/electron-advancedwindowtools.js.map +2 -2
  21. package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js +1 -1
  22. package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js.map +2 -2
  23. package/dist/Runtime/Extensions/BBText/JsExtension.js +10 -9
  24. package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js.map +2 -2
  25. package/dist/Runtime/Extensions/BitmapText/JsExtension.js +4 -6
  26. package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject-pixi-renderer.js.map +2 -2
  27. package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js.map +2 -2
  28. package/dist/Runtime/Extensions/DialogueTree/dialoguetools.js.map +2 -2
  29. package/dist/Runtime/Extensions/DraggableBehavior/draggableruntimebehavior.js.map +2 -2
  30. package/dist/Runtime/Extensions/Effects/adjustment-pixi-filter.js.map +2 -2
  31. package/dist/Runtime/Extensions/Effects/advanced-bloom-pixi-filter.js.map +2 -2
  32. package/dist/Runtime/Extensions/Effects/ascii-pixi-filter.js.map +2 -2
  33. package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js.map +2 -2
  34. package/dist/Runtime/Extensions/Effects/black-and-white-pixi-filter.js.map +2 -2
  35. package/dist/Runtime/Extensions/Effects/blending-mode-pixi-filter.js.map +2 -2
  36. package/dist/Runtime/Extensions/Effects/brightness-pixi-filter.js.map +2 -2
  37. package/dist/Runtime/Extensions/Effects/bulge-pinch-pixi-filter.js.map +2 -2
  38. package/dist/Runtime/Extensions/Effects/color-map-pixi-filter.js.map +2 -2
  39. package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js.map +2 -2
  40. package/dist/Runtime/Extensions/Effects/crt-pixi-filter.js.map +2 -2
  41. package/dist/Runtime/Extensions/Effects/displacement-pixi-filter.js.map +2 -2
  42. package/dist/Runtime/Extensions/Effects/dot-pixi-filter.js.map +2 -2
  43. package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js.map +2 -2
  44. package/dist/Runtime/Extensions/Effects/glitch-pixi-filter.js.map +2 -2
  45. package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js.map +2 -2
  46. package/dist/Runtime/Extensions/Effects/godray-pixi-filter.js.map +2 -2
  47. package/dist/Runtime/Extensions/Effects/kawase-blur-pixi-filter.js.map +2 -2
  48. package/dist/Runtime/Extensions/Effects/noise-pixi-filter.js.map +2 -2
  49. package/dist/Runtime/Extensions/Effects/old-film-pixi-filter.js.map +2 -2
  50. package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js.map +2 -2
  51. package/dist/Runtime/Extensions/Effects/pixelate-pixi-filter.js.map +2 -2
  52. package/dist/Runtime/Extensions/Effects/pixi-filters/types/drop-shadow/types.d.ts +10 -4
  53. package/dist/Runtime/Extensions/Effects/radial-blur-pixi-filter.js.map +2 -2
  54. package/dist/Runtime/Extensions/Effects/reflection-pixi-filter.js.map +2 -2
  55. package/dist/Runtime/Extensions/Effects/rgb-split-pixi-filter.js.map +2 -2
  56. package/dist/Runtime/Extensions/Effects/sepia-pixi-filter.js.map +2 -2
  57. package/dist/Runtime/Extensions/Effects/shockwave-pixi-filter.js.map +2 -2
  58. package/dist/Runtime/Extensions/Effects/tilt-shift-pixi-filter.js.map +2 -2
  59. package/dist/Runtime/Extensions/Effects/twist-pixi-filter.js.map +2 -2
  60. package/dist/Runtime/Extensions/Effects/zoom-blur-pixi-filter.js.map +2 -2
  61. package/dist/Runtime/Extensions/ExampleJsExtension/dummyeffect.js.map +2 -2
  62. package/dist/Runtime/Extensions/FacebookInstantGames/facebookinstantgamestools.js.map +2 -2
  63. package/dist/Runtime/Extensions/Firebase/A_firebasejs/firebase.d.ts +5 -4
  64. package/dist/Runtime/Extensions/Firebase/B_firebasetools/D_cloudfirestoretools.js.map +2 -2
  65. package/dist/Runtime/Extensions/Firebase/B_firebasetools/D_remoteconfigtools.js.map +2 -2
  66. package/dist/Runtime/Extensions/Firebase/JsExtension.js +21 -21
  67. package/dist/Runtime/Extensions/JsExtensionTypes.d.ts +1 -0
  68. package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js.map +2 -2
  69. package/dist/Runtime/Extensions/Lighting/JsExtension.js +2 -2
  70. package/dist/Runtime/Extensions/Lighting/lightobstacleruntimebehavior.js.map +2 -2
  71. package/dist/Runtime/Extensions/Lighting/lightruntimeobject-pixi-renderer.js.map +2 -2
  72. package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js.map +2 -2
  73. package/dist/Runtime/Extensions/LinkedObjects/linkedobjects.js.map +2 -2
  74. package/dist/Runtime/Extensions/Multiplayer/JsExtension.js +122 -0
  75. package/dist/Runtime/Extensions/Multiplayer/messageManager.js.map +2 -2
  76. package/dist/Runtime/Extensions/Multiplayer/multiplayerVariablesManager.js.map +2 -2
  77. package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js +1 -1
  78. package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js.map +2 -2
  79. package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js.map +2 -2
  80. package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js +1 -1
  81. package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js.map +2 -2
  82. package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js +1 -1
  83. package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js.map +2 -2
  84. package/dist/Runtime/Extensions/Multiplayer/peerjs.d.ts +8 -10
  85. package/dist/Runtime/Extensions/P2P/peerjs.d.ts +8 -10
  86. package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject-pixi-renderer.js.map +2 -2
  87. package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js.map +2 -2
  88. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js.map +2 -2
  89. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js.map +2 -2
  90. package/dist/Runtime/Extensions/ParticleSystem/pixi-particles-pixi-renderer.d.ts +2 -1
  91. package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingobstacleruntimebehavior.js.map +2 -2
  92. package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js.map +2 -2
  93. package/dist/Runtime/Extensions/Physics2Behavior/JsExtension.js +106 -106
  94. package/dist/Runtime/Extensions/Physics2Behavior/box2d.d.ts +13 -7
  95. package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
  96. package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js +1 -1
  97. package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js.map +2 -2
  98. package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js +1 -1
  99. package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js.map +2 -2
  100. package/dist/Runtime/Extensions/PhysicsBehavior/physicsruntimebehavior.js.map +2 -2
  101. package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js.map +2 -2
  102. package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js.map +2 -2
  103. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationcomponents.js.map +1 -1
  104. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js +1 -1
  105. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js.map +2 -2
  106. package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject-pixi-renderer.js.map +2 -2
  107. package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js.map +2 -2
  108. package/dist/Runtime/Extensions/SpatialSound/spatialsoundtools.js +1 -1
  109. package/dist/Runtime/Extensions/SpatialSound/spatialsoundtools.js.map +2 -2
  110. package/dist/Runtime/Extensions/Spine/JsExtension.js +5 -4
  111. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-atlas-manager.js +1 -1
  112. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-atlas-manager.js.map +2 -2
  113. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-manager.js +1 -1
  114. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-manager.js.map +2 -2
  115. package/dist/Runtime/Extensions/Spine/spineruntimeobject-pixi-renderer.js.map +2 -2
  116. package/dist/Runtime/Extensions/Spine/spineruntimeobject.js.map +2 -2
  117. package/dist/Runtime/Extensions/Steamworks/JsExtension.js +12 -12
  118. package/dist/Runtime/Extensions/Steamworks/Z_steamworksinputtools.js.map +2 -2
  119. package/dist/Runtime/Extensions/Steamworks/steamworkstools.js.map +2 -2
  120. package/dist/Runtime/Extensions/TextEntryObject/textentryruntimeobject-pixi-renderer.js.map +2 -2
  121. package/dist/Runtime/Extensions/TextInput/JsExtension.js +2 -2
  122. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js +1 -1
  123. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js.map +2 -2
  124. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js.map +2 -2
  125. package/dist/Runtime/Extensions/TextObject/textruntimeobject-pixi-renderer.js.map +2 -2
  126. package/dist/Runtime/Extensions/TextObject/textruntimeobject.js.map +2 -2
  127. package/dist/Runtime/Extensions/TileMap/JsExtension.js +20 -18
  128. package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js.map +2 -2
  129. package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js.map +2 -2
  130. package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts +1 -3
  131. package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js.map +2 -2
  132. package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js.map +2 -2
  133. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js.map +1 -1
  134. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js.map +2 -2
  135. package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject-pixi-renderer.js.map +2 -2
  136. package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js.map +2 -2
  137. package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js.map +2 -2
  138. package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js.map +1 -1
  139. package/dist/Runtime/Extensions/Video/JsExtension.js +2 -1
  140. package/dist/Runtime/Extensions/Video/videoruntimeobject-pixi-renderer.js.map +2 -2
  141. package/dist/Runtime/Extensions/Video/videoruntimeobject.js.map +2 -2
  142. package/dist/Runtime/InAppTutorialMessage.js +6 -0
  143. package/dist/Runtime/InAppTutorialMessage.js.map +7 -0
  144. package/dist/Runtime/Model3DManager.js.map +2 -2
  145. package/dist/Runtime/ResourceLoader.js.map +2 -2
  146. package/dist/Runtime/RuntimeCustomObjectLayer.js +1 -1
  147. package/dist/Runtime/RuntimeCustomObjectLayer.js.map +2 -2
  148. package/dist/Runtime/RuntimeInstanceContainer.js.map +1 -1
  149. package/dist/Runtime/RuntimeLayer.js.map +2 -2
  150. package/dist/Runtime/SpriteAnimator.js.map +2 -2
  151. package/dist/Runtime/affinetransformation.js.map +1 -1
  152. package/dist/Runtime/debugger-client/abstract-debugger-client.js.map +2 -2
  153. package/dist/Runtime/debugger-client/hot-reloader.js +2 -2
  154. package/dist/Runtime/debugger-client/hot-reloader.js.map +2 -2
  155. package/dist/Runtime/debugger-client/websocket-debugger-client.js +1 -1
  156. package/dist/Runtime/debugger-client/websocket-debugger-client.js.map +2 -2
  157. package/dist/Runtime/events-tools/networktools.js +1 -1
  158. package/dist/Runtime/events-tools/networktools.js.map +2 -2
  159. package/dist/Runtime/fontfaceobserver-font-manager/fontfaceobserver-font-manager.js.map +2 -2
  160. package/dist/Runtime/gd.js.map +2 -2
  161. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js +1 -1
  162. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js.map +2 -2
  163. package/dist/Runtime/inputmanager.js.map +2 -2
  164. package/dist/Runtime/jsonmanager.js.map +2 -2
  165. package/dist/Runtime/layer.js.map +2 -2
  166. package/dist/Runtime/libs/nanomarkdown.js +5 -0
  167. package/dist/Runtime/libs/nanomarkdown.js.map +7 -0
  168. package/dist/Runtime/object-capabilities/AnimatableBehavior.js.map +2 -2
  169. package/dist/Runtime/object-capabilities/EffectBehavior.js.map +2 -2
  170. package/dist/Runtime/object-capabilities/FlippableBehavior.js.map +2 -2
  171. package/dist/Runtime/object-capabilities/OpacityBehavior.js.map +2 -2
  172. package/dist/Runtime/object-capabilities/ResizableBehavior.js.map +2 -2
  173. package/dist/Runtime/object-capabilities/ScalableBehavior.js.map +2 -2
  174. package/dist/Runtime/object-capabilities/TextContainerBehavior.js.map +2 -2
  175. package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js.map +2 -2
  176. package/dist/Runtime/pixi-renderers/DebuggerPixiRenderer.js.map +2 -2
  177. package/dist/Runtime/pixi-renderers/layer-pixi-renderer.js.map +2 -2
  178. package/dist/Runtime/pixi-renderers/loadingscreen-pixi-renderer.js.map +2 -2
  179. package/dist/Runtime/pixi-renderers/pixi-bitmapfont-manager.js.map +2 -2
  180. package/dist/Runtime/pixi-renderers/pixi-filters-tools.js.map +2 -2
  181. package/dist/Runtime/pixi-renderers/pixi-image-manager.js +1 -1
  182. package/dist/Runtime/pixi-renderers/pixi-image-manager.js.map +2 -2
  183. package/dist/Runtime/pixi-renderers/pixi.js +123 -177
  184. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js +1 -1
  185. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js.map +2 -2
  186. package/dist/Runtime/pixi-renderers/runtimescene-pixi-renderer.js.map +2 -2
  187. package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js.map +2 -2
  188. package/dist/Runtime/profiler.js.map +2 -2
  189. package/dist/Runtime/runtimegame.js +1 -1
  190. package/dist/Runtime/runtimegame.js.map +2 -2
  191. package/dist/Runtime/runtimeobject.js +1 -1
  192. package/dist/Runtime/runtimeobject.js.map +2 -2
  193. package/dist/Runtime/runtimescene.js.map +2 -2
  194. package/dist/Runtime/runtimewatermark.js.map +2 -2
  195. package/dist/Runtime/scenestack.js.map +2 -2
  196. package/dist/Runtime/spriteruntimeobject.js.map +2 -2
  197. package/dist/Runtime/variable.js.map +2 -2
  198. package/dist/Runtime/variablescontainer.js.map +2 -2
  199. package/dist/lib/libGD.cjs +1 -1
  200. package/dist/lib/libGD.wasm +0 -0
  201. package/gd.d.ts +6 -0
  202. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/PrimitiveDrawing/shapepainterruntimeobject-pixi-renderer.ts"],
4
- "sourcesContent": ["namespace gdjs {\n class ShapePainterRuntimeObjectPixiRenderer {\n _object: gdjs.ShapePainterRuntimeObject;\n _graphics: PIXI.Graphics;\n /**\n * Graphics positions can need updates when shapes are added,\n * this avoids to do it each time.\n */\n _positionXIsUpToDate = false;\n /**\n * Graphics positions can need updates when shapes are added,\n * this avoids to do it each time.\n */\n _positionYIsUpToDate = false;\n /**\n * This allows to use the transformation of the renderer\n * and compute it only when necessary.\n */\n _transformationIsUpToDate = false;\n\n _antialiasingFilter: null | PIXI.Filter = null;\n\n private static readonly _positionForTransformation: PIXI.IPointData = {\n x: 0,\n y: 0,\n };\n\n constructor(\n runtimeObject: gdjs.ShapePainterRuntimeObject,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ) {\n this._object = runtimeObject;\n this._graphics = new PIXI.Graphics();\n instanceContainer\n .getLayer('')\n .getRenderer()\n .addRendererObject(this._graphics, runtimeObject.getZOrder());\n this.updateAntialiasing();\n }\n\n getRendererObject() {\n return this._graphics;\n }\n\n clear() {\n this._graphics.clear();\n this.invalidateBounds();\n }\n\n drawRectangle(x1: float, y1: float, x2: float, y2: float) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n this._graphics.drawRect(x1, y1, x2 - x1, y2 - y1);\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawCircle(x: float, y: float, radius: float) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n this._graphics.drawCircle(x, y, radius);\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawLine(x1: float, y1: float, x2: float, y2: float, thickness: float) {\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n if (y2 === y1) {\n this._graphics.drawRect(x1, y1 - thickness / 2, x2 - x1, thickness);\n } else {\n const angle = Math.atan2(y2 - y1, x2 - x1);\n const xIncrement = Math.sin(angle) * thickness;\n const yIncrement = Math.cos(angle) * thickness;\n this._graphics.drawPolygon(\n x1 + xIncrement,\n y1 - yIncrement,\n x1 - xIncrement,\n y1 + yIncrement,\n x2 - xIncrement,\n y2 + yIncrement,\n x2 + xIncrement,\n y2 - yIncrement\n );\n }\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawLineV2(x1: float, y1: float, x2: float, y2: float, thickness: float) {\n this._graphics.lineStyle(\n thickness,\n this._object._outlineColor,\n this._object._outlineOpacity / 255\n );\n this._graphics.moveTo(x1, y1);\n this._graphics.lineTo(x2, y2);\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawEllipse(x1: float, y1: float, width: float, height: float) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n this._graphics.drawEllipse(x1, y1, width / 2, height / 2);\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawRoundedRectangle(\n x1: float,\n y1: float,\n x2: float,\n y2: float,\n radius: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n this._graphics.drawRoundedRect(x1, y1, x2 - x1, y2 - y1, radius);\n this._graphics.closePath();\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawFilletRectangle(\n x1: float,\n y1: float,\n x2: float,\n y2: float,\n fillet: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n //@ts-ignore from @pixi/graphics-extras\n this._graphics.drawFilletRect(x1, y1, x2 - x1, y2 - y1, fillet);\n this._graphics.closePath();\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawChamferRectangle(\n x1: float,\n y1: float,\n x2: float,\n y2: float,\n chamfer: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n //@ts-ignore from @pixi/graphics-extras\n this._graphics.drawChamferRect(x1, y1, x2 - x1, y2 - y1, chamfer);\n this._graphics.closePath();\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawTorus(\n x1: float,\n y1: float,\n innerRadius: float,\n outerRadius: float,\n startArc: float,\n endArc: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n //@ts-ignore from @pixi/graphics-extras\n this._graphics.drawTorus(\n x1,\n y1,\n innerRadius,\n outerRadius,\n startArc ? gdjs.toRad(startArc) : 0,\n endArc ? gdjs.toRad(endArc) : 0\n );\n this._graphics.closePath();\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawRegularPolygon(\n x1: float,\n y1: float,\n sides: float,\n radius: float,\n rotation: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n //@ts-ignore from @pixi/graphics-extras\n this._graphics.drawRegularPolygon(\n x1,\n y1,\n radius,\n sides,\n rotation ? gdjs.toRad(rotation) : 0\n );\n this._graphics.closePath();\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawStar(\n x1: float,\n y1: float,\n points: float,\n radius: float,\n innerRadius: float,\n rotation: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n //@ts-ignore from @pixi/graphics-extras\n this._graphics.drawStar(\n x1,\n y1,\n points,\n radius,\n innerRadius ? innerRadius : radius / 2,\n rotation ? gdjs.toRad(rotation) : 0\n );\n this._graphics.closePath();\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawArc(\n x1: float,\n y1: float,\n radius: float,\n startAngle: float,\n endAngle: float,\n anticlockwise: boolean,\n closePath: boolean\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n this._graphics.moveTo(\n x1 + radius * Math.cos(gdjs.toRad(startAngle)),\n y1 + radius * Math.sin(gdjs.toRad(startAngle))\n );\n this._graphics.arc(\n x1,\n y1,\n radius,\n gdjs.toRad(startAngle),\n gdjs.toRad(endAngle),\n anticlockwise ? true : false\n );\n if (closePath) {\n this._graphics.closePath();\n }\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawBezierCurve(\n x1: float,\n y1: float,\n cpX: float,\n cpY: float,\n cpX2: float,\n cpY2: float,\n x2: float,\n y2: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n this._graphics.moveTo(x1, y1);\n this._graphics.bezierCurveTo(cpX, cpY, cpX2, cpY2, x2, y2);\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawQuadraticCurve(\n x1: float,\n y1: float,\n cpX: float,\n cpY: float,\n x2: float,\n y2: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n this._graphics.moveTo(x1, y1);\n this._graphics.quadraticCurveTo(cpX, cpY, x2, y2);\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n beginFillPath() {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n }\n\n endFillPath() {\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawPathMoveTo(x1: float, y1: float) {\n this._graphics.moveTo(x1, y1);\n }\n\n drawPathLineTo(x1: float, y1: float) {\n this._graphics.lineTo(x1, y1);\n this.invalidateBounds();\n }\n\n drawPathBezierCurveTo(\n cpX: float,\n cpY: float,\n cpX2: float,\n cpY2: float,\n toX: float,\n toY: float\n ) {\n this._graphics.bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY);\n this.invalidateBounds();\n }\n\n drawPathArc(\n x1: float,\n y1: float,\n radius: float,\n startAngle: float,\n endAngle: float,\n anticlockwise: boolean\n ) {\n this._graphics.arc(\n x1,\n y1,\n radius,\n gdjs.toRad(startAngle),\n gdjs.toRad(endAngle),\n anticlockwise ? true : false\n );\n this.invalidateBounds();\n }\n\n drawPathQuadraticCurveTo(cpX: float, cpY: float, toX: float, toY: float) {\n this._graphics.quadraticCurveTo(cpX, cpY, toX, toY);\n this.invalidateBounds();\n }\n\n closePath() {\n this._graphics.closePath();\n this.invalidateBounds();\n }\n\n updateOutline(): void {\n this._graphics.lineStyle(\n this._object._outlineSize,\n this._object._outlineColor,\n this._object._outlineOpacity / 255\n );\n }\n\n invalidateBounds() {\n this._object.invalidateBounds();\n this._positionXIsUpToDate = false;\n this._positionYIsUpToDate = false;\n }\n\n updatePreRender(): void {\n this.updatePositionIfNeeded();\n }\n\n updatePositionX(): void {\n if (this._object._useAbsoluteCoordinates) {\n this._graphics.pivot.x = 0;\n this._graphics.position.x = 0;\n } else {\n // Make the drawing rotate around the rotation center.\n this._graphics.pivot.x = this._object.getRotationCenterX();\n // Multiply by the scale to have the scale anchor\n // at the object position instead of the center.\n this._graphics.position.x =\n this._object.x +\n this._graphics.pivot.x * Math.abs(this._graphics.scale.x);\n }\n this._transformationIsUpToDate = false;\n }\n\n updatePositionY(): void {\n if (this._object._useAbsoluteCoordinates) {\n this._graphics.pivot.y = 0;\n this._graphics.position.y = 0;\n } else {\n this._graphics.pivot.y = this._object.getRotationCenterY();\n this._graphics.position.y =\n this._object.y +\n this._graphics.pivot.y * Math.abs(this._graphics.scale.y);\n }\n this._transformationIsUpToDate = false;\n }\n\n updatePositionIfNeeded() {\n if (!this._positionXIsUpToDate) {\n this.updatePositionX();\n this._positionXIsUpToDate = true;\n }\n if (!this._positionYIsUpToDate) {\n this.updatePositionY();\n this._positionYIsUpToDate = true;\n }\n }\n\n updateTransformationIfNeeded() {\n if (!this._transformationIsUpToDate) {\n this.updatePositionIfNeeded();\n this._graphics.updateTransform();\n }\n this._transformationIsUpToDate = true;\n }\n\n updateRotationCenter(): void {\n // The pivot and position depends on the rotation center point.\n this._positionXIsUpToDate = false;\n this._positionYIsUpToDate = false;\n // The whole transformation changes based on the rotation center point.\n this._transformationIsUpToDate = false;\n }\n\n updateAngle(): void {\n if (this._object._useAbsoluteCoordinates) {\n this._graphics.angle = 0;\n } else {\n this._graphics.angle = this._object.angle;\n }\n this._transformationIsUpToDate = false;\n }\n\n updateScaleX(): void {\n if (this._object._useAbsoluteCoordinates) {\n this._graphics.scale.x = 1;\n } else {\n this._graphics.scale.x = this._object._scaleX;\n }\n // updatePositionX() uses scale.x\n this._positionXIsUpToDate = false;\n this._transformationIsUpToDate = false;\n }\n\n updateScaleY(): void {\n if (this._object._useAbsoluteCoordinates) {\n this._graphics.scale.y = 1;\n } else {\n this._graphics.scale.y = this._object._scaleY;\n }\n // updatePositionY() uses scale.y\n this._positionYIsUpToDate = false;\n this._transformationIsUpToDate = false;\n }\n\n getDrawableX(): float {\n if (this._object._useAbsoluteCoordinates) {\n return this._graphics.getLocalBounds().left;\n }\n let localBound = this._graphics.getLocalBounds().left;\n if (this._object._flippedX) {\n const rotationCenterX = this._object.getRotationCenterX();\n localBound = 2 * rotationCenterX - localBound;\n }\n // When new shape are drawn, the bounds of the object can extend.\n // The object position stays the same but (drawableX; drawableY) can change.\n return (\n this._object.getX() + localBound * Math.abs(this._graphics.scale.x)\n );\n }\n\n getDrawableY(): float {\n if (this._object._useAbsoluteCoordinates) {\n return this._graphics.getLocalBounds().top;\n }\n let localBound = this._graphics.getLocalBounds().top;\n if (this._object._flippedY) {\n const rotationCenterY = this._object.getRotationCenterY();\n localBound = 2 * rotationCenterY - localBound;\n }\n return (\n this._object.getY() + localBound * Math.abs(this._graphics.scale.y)\n );\n }\n\n getWidth(): float {\n return this._graphics.width;\n }\n\n getHeight(): float {\n return this._graphics.height;\n }\n\n getUnscaledWidth(): float {\n return this._graphics.getLocalBounds().width;\n }\n\n getUnscaledHeight(): float {\n return this._graphics.getLocalBounds().height;\n }\n\n /**\n * @returns The drawing origin relatively to the drawable top left corner.\n */\n getFrameRelativeOriginX() {\n return -this._graphics.getLocalBounds().left;\n }\n\n /**\n * @returns The drawing origin relatively to the drawable top left corner.\n */\n getFrameRelativeOriginY() {\n return -this._graphics.getLocalBounds().top;\n }\n\n transformToDrawing(point: FloatPoint): FloatPoint {\n this.updateTransformationIfNeeded();\n const position =\n ShapePainterRuntimeObjectPixiRenderer._positionForTransformation;\n position.x = point[0];\n position.y = point[1];\n this._graphics.localTransform.applyInverse(position, position);\n point[0] = position.x;\n point[1] = position.y;\n return point;\n }\n\n transformToScene(point: FloatPoint): FloatPoint {\n this.updateTransformationIfNeeded();\n const position =\n ShapePainterRuntimeObjectPixiRenderer._positionForTransformation;\n position.x = point[0];\n position.y = point[1];\n this._graphics.localTransform.apply(position, position);\n point[0] = position.x;\n point[1] = position.y;\n return point;\n }\n\n updateAntialiasing(): void {\n if (this._object.getAntialiasing() !== 'none') {\n if (!this._antialiasingFilter) {\n this._antialiasingFilter = new PIXI.FXAAFilter();\n }\n\n const antialiasingFilter = this._antialiasingFilter;\n antialiasingFilter.enabled = true;\n antialiasingFilter.multisample =\n PIXI.MSAA_QUALITY[this._object.getAntialiasing().toUpperCase()] ||\n PIXI.MSAA_QUALITY.LOW;\n\n if (!this._graphics.filters) {\n this._graphics.filters = [];\n }\n // Do not apply the filter if it is already present on the object.\n if (this._graphics.filters.indexOf(antialiasingFilter) === -1) {\n this._graphics.filters.push(antialiasingFilter);\n }\n } else if (this._antialiasingFilter !== null) {\n if (!this._graphics.filters) {\n return;\n }\n const antialiasingFilterIndex = this._graphics.filters.indexOf(\n this._antialiasingFilter\n );\n\n if (antialiasingFilterIndex !== -1) {\n this._graphics.filters.splice(antialiasingFilterIndex, 1);\n }\n }\n }\n\n destroy(): void {\n this._graphics.destroy();\n }\n }\n\n export const ShapePainterRuntimeObjectRenderer = ShapePainterRuntimeObjectPixiRenderer;\n export type ShapePainterRuntimeObjectRenderer = ShapePainterRuntimeObjectPixiRenderer;\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CACE,aAA4C,CA0B1C,YACE,EACA,EACA,CAtBF,0BAAuB,GAKvB,0BAAuB,GAKvB,+BAA4B,GAE5B,yBAA0C,KAWxC,KAAK,QAAU,EACf,KAAK,UAAY,GAAI,MAAK,SAC1B,EACG,SAAS,IACT,cACA,kBAAkB,KAAK,UAAW,EAAc,aACnD,KAAK,qBAGP,mBAAoB,CAClB,MAAO,MAAK,UAGd,OAAQ,CACN,KAAK,UAAU,QACf,KAAK,mBAGP,cAAc,EAAW,EAAW,EAAW,EAAW,CACxD,KAAK,gBACL,KAAK,UAAU,UACb,KAAK,QAAQ,WACb,KAAK,QAAQ,aAAe,KAE9B,KAAK,UAAU,SAAS,EAAI,EAAI,EAAK,EAAI,EAAK,GAC9C,KAAK,UAAU,UACf,KAAK,mBAGP,WAAW,EAAU,EAAU,EAAe,CAC5C,KAAK,gBACL,KAAK,UAAU,UACb,KAAK,QAAQ,WACb,KAAK,QAAQ,aAAe,KAE9B,KAAK,UAAU,WAAW,EAAG,EAAG,GAChC,KAAK,UAAU,UACf,KAAK,mBAGP,SAAS,EAAW,EAAW,EAAW,EAAW,EAAkB,CAKrE,GAJA,KAAK,UAAU,UACb,KAAK,QAAQ,WACb,KAAK,QAAQ,aAAe,KAE1B,IAAO,EACT,KAAK,UAAU,SAAS,EAAI,EAAK,EAAY,EAAG,EAAK,EAAI,OACpD,CACL,KAAM,GAAQ,KAAK,MAAM,EAAK,EAAI,EAAK,GACjC,EAAa,KAAK,IAAI,GAAS,EAC/B,EAAa,KAAK,IAAI,GAAS,EACrC,KAAK,UAAU,YACb,EAAK,EACL,EAAK,EAC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KAAK,QAAQ,kBAAkB,gBACjD,KAAK,aAAa,IAEf,KAAK,UAAU,SAClB,MAAK,UAAU,QAAU,IAGvB,KAAK,UAAU,QAAQ,QAAQ,KAAwB,IACzD,KAAK,UAAU,QAAQ,KAAK,WAErB,KAAK,sBAAwB,KAAM,CAC5C,GAAI,CAAC,KAAK,UAAU,QAClB,OAEF,KAAM,GAA0B,KAAK,UAAU,QAAQ,QACrD,KAAK,qBAGP,AAAI,IAA4B,IAC9B,KAAK,UAAU,QAAQ,OAAO,EAAyB,IAK7D,SAAgB,CACd,KAAK,UAAU,YArmBnB,QAqB0B,AArB1B,EAqB0B,2BAA8C,CACpE,EAAG,EACH,EAAG,GAklBM,oCAAoC,IA1mBzC",
4
+ "sourcesContent": ["namespace gdjs {\n class ShapePainterRuntimeObjectPixiRenderer {\n _object: gdjs.ShapePainterRuntimeObject;\n _graphics: PIXI.Graphics;\n /**\n * Graphics positions can need updates when shapes are added,\n * this avoids to do it each time.\n */\n _positionXIsUpToDate = false;\n /**\n * Graphics positions can need updates when shapes are added,\n * this avoids to do it each time.\n */\n _positionYIsUpToDate = false;\n /**\n * This allows to use the transformation of the renderer\n * and compute it only when necessary.\n */\n _transformationIsUpToDate = false;\n\n _antialiasingFilter: null | PIXI.Filter = null;\n\n private static readonly _positionForTransformation: PIXI.IPointData = {\n x: 0,\n y: 0,\n };\n\n constructor(\n runtimeObject: gdjs.ShapePainterRuntimeObject,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ) {\n this._object = runtimeObject;\n this._graphics = new PIXI.Graphics();\n instanceContainer\n .getLayer('')\n .getRenderer()\n .addRendererObject(this._graphics, runtimeObject.getZOrder());\n this.updateAntialiasing();\n }\n\n getRendererObject() {\n return this._graphics;\n }\n\n clear() {\n this._graphics.clear();\n this.invalidateBounds();\n }\n\n drawRectangle(x1: float, y1: float, x2: float, y2: float) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n this._graphics.drawRect(x1, y1, x2 - x1, y2 - y1);\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawCircle(x: float, y: float, radius: float) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n this._graphics.drawCircle(x, y, radius);\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawLine(x1: float, y1: float, x2: float, y2: float, thickness: float) {\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n if (y2 === y1) {\n this._graphics.drawRect(x1, y1 - thickness / 2, x2 - x1, thickness);\n } else {\n const angle = Math.atan2(y2 - y1, x2 - x1);\n const xIncrement = Math.sin(angle) * thickness;\n const yIncrement = Math.cos(angle) * thickness;\n this._graphics.drawPolygon(\n x1 + xIncrement,\n y1 - yIncrement,\n x1 - xIncrement,\n y1 + yIncrement,\n x2 - xIncrement,\n y2 + yIncrement,\n x2 + xIncrement,\n y2 - yIncrement\n );\n }\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawLineV2(x1: float, y1: float, x2: float, y2: float, thickness: float) {\n this._graphics.lineStyle(\n thickness,\n this._object._outlineColor,\n this._object._outlineOpacity / 255\n );\n this._graphics.moveTo(x1, y1);\n this._graphics.lineTo(x2, y2);\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawEllipse(x1: float, y1: float, width: float, height: float) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n this._graphics.drawEllipse(x1, y1, width / 2, height / 2);\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawRoundedRectangle(\n x1: float,\n y1: float,\n x2: float,\n y2: float,\n radius: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n this._graphics.drawRoundedRect(x1, y1, x2 - x1, y2 - y1, radius);\n this._graphics.closePath();\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawFilletRectangle(\n x1: float,\n y1: float,\n x2: float,\n y2: float,\n fillet: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n //@ts-ignore from @pixi/graphics-extras\n this._graphics.drawFilletRect(x1, y1, x2 - x1, y2 - y1, fillet);\n this._graphics.closePath();\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawChamferRectangle(\n x1: float,\n y1: float,\n x2: float,\n y2: float,\n chamfer: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n //@ts-ignore from @pixi/graphics-extras\n this._graphics.drawChamferRect(x1, y1, x2 - x1, y2 - y1, chamfer);\n this._graphics.closePath();\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawTorus(\n x1: float,\n y1: float,\n innerRadius: float,\n outerRadius: float,\n startArc: float,\n endArc: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n //@ts-ignore from @pixi/graphics-extras\n this._graphics.drawTorus(\n x1,\n y1,\n innerRadius,\n outerRadius,\n startArc ? gdjs.toRad(startArc) : 0,\n endArc ? gdjs.toRad(endArc) : 0\n );\n this._graphics.closePath();\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawRegularPolygon(\n x1: float,\n y1: float,\n sides: float,\n radius: float,\n rotation: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n //@ts-ignore from @pixi/graphics-extras\n this._graphics.drawRegularPolygon(\n x1,\n y1,\n radius,\n sides,\n rotation ? gdjs.toRad(rotation) : 0\n );\n this._graphics.closePath();\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawStar(\n x1: float,\n y1: float,\n points: float,\n radius: float,\n innerRadius: float,\n rotation: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n //@ts-ignore from @pixi/graphics-extras\n this._graphics.drawStar(\n x1,\n y1,\n points,\n radius,\n innerRadius ? innerRadius : radius / 2,\n rotation ? gdjs.toRad(rotation) : 0\n );\n this._graphics.closePath();\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawArc(\n x1: float,\n y1: float,\n radius: float,\n startAngle: float,\n endAngle: float,\n anticlockwise: boolean,\n closePath: boolean\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n this._graphics.moveTo(\n x1 + radius * Math.cos(gdjs.toRad(startAngle)),\n y1 + radius * Math.sin(gdjs.toRad(startAngle))\n );\n this._graphics.arc(\n x1,\n y1,\n radius,\n gdjs.toRad(startAngle),\n gdjs.toRad(endAngle),\n anticlockwise ? true : false\n );\n if (closePath) {\n this._graphics.closePath();\n }\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawBezierCurve(\n x1: float,\n y1: float,\n cpX: float,\n cpY: float,\n cpX2: float,\n cpY2: float,\n x2: float,\n y2: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n this._graphics.moveTo(x1, y1);\n this._graphics.bezierCurveTo(cpX, cpY, cpX2, cpY2, x2, y2);\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawQuadraticCurve(\n x1: float,\n y1: float,\n cpX: float,\n cpY: float,\n x2: float,\n y2: float\n ) {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n this._graphics.moveTo(x1, y1);\n this._graphics.quadraticCurveTo(cpX, cpY, x2, y2);\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n beginFillPath() {\n this.updateOutline();\n this._graphics.beginFill(\n this._object._fillColor,\n this._object._fillOpacity / 255\n );\n }\n\n endFillPath() {\n this._graphics.endFill();\n this.invalidateBounds();\n }\n\n drawPathMoveTo(x1: float, y1: float) {\n this._graphics.moveTo(x1, y1);\n }\n\n drawPathLineTo(x1: float, y1: float) {\n this._graphics.lineTo(x1, y1);\n this.invalidateBounds();\n }\n\n drawPathBezierCurveTo(\n cpX: float,\n cpY: float,\n cpX2: float,\n cpY2: float,\n toX: float,\n toY: float\n ) {\n this._graphics.bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY);\n this.invalidateBounds();\n }\n\n drawPathArc(\n x1: float,\n y1: float,\n radius: float,\n startAngle: float,\n endAngle: float,\n anticlockwise: boolean\n ) {\n this._graphics.arc(\n x1,\n y1,\n radius,\n gdjs.toRad(startAngle),\n gdjs.toRad(endAngle),\n anticlockwise ? true : false\n );\n this.invalidateBounds();\n }\n\n drawPathQuadraticCurveTo(cpX: float, cpY: float, toX: float, toY: float) {\n this._graphics.quadraticCurveTo(cpX, cpY, toX, toY);\n this.invalidateBounds();\n }\n\n closePath() {\n this._graphics.closePath();\n this.invalidateBounds();\n }\n\n updateOutline(): void {\n this._graphics.lineStyle(\n this._object._outlineSize,\n this._object._outlineColor,\n this._object._outlineOpacity / 255\n );\n }\n\n invalidateBounds() {\n this._object.invalidateBounds();\n this._positionXIsUpToDate = false;\n this._positionYIsUpToDate = false;\n }\n\n updatePreRender(): void {\n this.updatePositionIfNeeded();\n }\n\n updatePositionX(): void {\n if (this._object._useAbsoluteCoordinates) {\n this._graphics.pivot.x = 0;\n this._graphics.position.x = 0;\n } else {\n // Make the drawing rotate around the rotation center.\n this._graphics.pivot.x = this._object.getRotationCenterX();\n // Multiply by the scale to have the scale anchor\n // at the object position instead of the center.\n this._graphics.position.x =\n this._object.x +\n this._graphics.pivot.x * Math.abs(this._graphics.scale.x);\n }\n this._transformationIsUpToDate = false;\n }\n\n updatePositionY(): void {\n if (this._object._useAbsoluteCoordinates) {\n this._graphics.pivot.y = 0;\n this._graphics.position.y = 0;\n } else {\n this._graphics.pivot.y = this._object.getRotationCenterY();\n this._graphics.position.y =\n this._object.y +\n this._graphics.pivot.y * Math.abs(this._graphics.scale.y);\n }\n this._transformationIsUpToDate = false;\n }\n\n updatePositionIfNeeded() {\n if (!this._positionXIsUpToDate) {\n this.updatePositionX();\n this._positionXIsUpToDate = true;\n }\n if (!this._positionYIsUpToDate) {\n this.updatePositionY();\n this._positionYIsUpToDate = true;\n }\n }\n\n updateTransformationIfNeeded() {\n if (!this._transformationIsUpToDate) {\n this.updatePositionIfNeeded();\n this._graphics.updateTransform();\n }\n this._transformationIsUpToDate = true;\n }\n\n updateRotationCenter(): void {\n // The pivot and position depends on the rotation center point.\n this._positionXIsUpToDate = false;\n this._positionYIsUpToDate = false;\n // The whole transformation changes based on the rotation center point.\n this._transformationIsUpToDate = false;\n }\n\n updateAngle(): void {\n if (this._object._useAbsoluteCoordinates) {\n this._graphics.angle = 0;\n } else {\n this._graphics.angle = this._object.angle;\n }\n this._transformationIsUpToDate = false;\n }\n\n updateScaleX(): void {\n if (this._object._useAbsoluteCoordinates) {\n this._graphics.scale.x = 1;\n } else {\n this._graphics.scale.x = this._object._scaleX;\n }\n // updatePositionX() uses scale.x\n this._positionXIsUpToDate = false;\n this._transformationIsUpToDate = false;\n }\n\n updateScaleY(): void {\n if (this._object._useAbsoluteCoordinates) {\n this._graphics.scale.y = 1;\n } else {\n this._graphics.scale.y = this._object._scaleY;\n }\n // updatePositionY() uses scale.y\n this._positionYIsUpToDate = false;\n this._transformationIsUpToDate = false;\n }\n\n getDrawableX(): float {\n if (this._object._useAbsoluteCoordinates) {\n return this._graphics.getLocalBounds().left;\n }\n let localBound = this._graphics.getLocalBounds().left;\n if (this._object._flippedX) {\n const rotationCenterX = this._object.getRotationCenterX();\n localBound = 2 * rotationCenterX - localBound;\n }\n // When new shape are drawn, the bounds of the object can extend.\n // The object position stays the same but (drawableX; drawableY) can change.\n return (\n this._object.getX() + localBound * Math.abs(this._graphics.scale.x)\n );\n }\n\n getDrawableY(): float {\n if (this._object._useAbsoluteCoordinates) {\n return this._graphics.getLocalBounds().top;\n }\n let localBound = this._graphics.getLocalBounds().top;\n if (this._object._flippedY) {\n const rotationCenterY = this._object.getRotationCenterY();\n localBound = 2 * rotationCenterY - localBound;\n }\n return (\n this._object.getY() + localBound * Math.abs(this._graphics.scale.y)\n );\n }\n\n getWidth(): float {\n return this._graphics.width;\n }\n\n getHeight(): float {\n return this._graphics.height;\n }\n\n getUnscaledWidth(): float {\n return this._graphics.getLocalBounds().width;\n }\n\n getUnscaledHeight(): float {\n return this._graphics.getLocalBounds().height;\n }\n\n /**\n * @returns The drawing origin relatively to the drawable top left corner.\n */\n getFrameRelativeOriginX() {\n return -this._graphics.getLocalBounds().left;\n }\n\n /**\n * @returns The drawing origin relatively to the drawable top left corner.\n */\n getFrameRelativeOriginY() {\n return -this._graphics.getLocalBounds().top;\n }\n\n transformToDrawing(point: FloatPoint): FloatPoint {\n this.updateTransformationIfNeeded();\n const position =\n ShapePainterRuntimeObjectPixiRenderer._positionForTransformation;\n position.x = point[0];\n position.y = point[1];\n this._graphics.localTransform.applyInverse(position, position);\n point[0] = position.x;\n point[1] = position.y;\n return point;\n }\n\n transformToScene(point: FloatPoint): FloatPoint {\n this.updateTransformationIfNeeded();\n const position =\n ShapePainterRuntimeObjectPixiRenderer._positionForTransformation;\n position.x = point[0];\n position.y = point[1];\n this._graphics.localTransform.apply(position, position);\n point[0] = position.x;\n point[1] = position.y;\n return point;\n }\n\n updateAntialiasing(): void {\n if (this._object.getAntialiasing() !== 'none') {\n if (!this._antialiasingFilter) {\n this._antialiasingFilter = new PIXI.FXAAFilter();\n }\n\n const antialiasingFilter = this._antialiasingFilter;\n antialiasingFilter.enabled = true;\n antialiasingFilter.multisample =\n PIXI.MSAA_QUALITY[this._object.getAntialiasing().toUpperCase()] ||\n PIXI.MSAA_QUALITY.LOW;\n\n if (!this._graphics.filters) {\n this._graphics.filters = [];\n }\n // Do not apply the filter if it is already present on the object.\n if (this._graphics.filters.indexOf(antialiasingFilter) === -1) {\n this._graphics.filters.push(antialiasingFilter);\n }\n } else if (this._antialiasingFilter !== null) {\n if (!this._graphics.filters) {\n return;\n }\n const antialiasingFilterIndex = this._graphics.filters.indexOf(\n this._antialiasingFilter\n );\n\n if (antialiasingFilterIndex !== -1) {\n this._graphics.filters.splice(antialiasingFilterIndex, 1);\n }\n }\n }\n\n destroy(): void {\n this._graphics.destroy();\n }\n }\n\n export const ShapePainterRuntimeObjectRenderer =\n ShapePainterRuntimeObjectPixiRenderer;\n export type ShapePainterRuntimeObjectRenderer =\n ShapePainterRuntimeObjectPixiRenderer;\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CACE,aAA4C,CA0B1C,YACE,EACA,EACA,CAtBF,0BAAuB,GAKvB,0BAAuB,GAKvB,+BAA4B,GAE5B,yBAA0C,KAWxC,KAAK,QAAU,EACf,KAAK,UAAY,GAAI,MAAK,SAC1B,EACG,SAAS,IACT,cACA,kBAAkB,KAAK,UAAW,EAAc,aACnD,KAAK,qBAGP,mBAAoB,CAClB,MAAO,MAAK,UAGd,OAAQ,CACN,KAAK,UAAU,QACf,KAAK,mBAGP,cAAc,EAAW,EAAW,EAAW,EAAW,CACxD,KAAK,gBACL,KAAK,UAAU,UACb,KAAK,QAAQ,WACb,KAAK,QAAQ,aAAe,KAE9B,KAAK,UAAU,SAAS,EAAI,EAAI,EAAK,EAAI,EAAK,GAC9C,KAAK,UAAU,UACf,KAAK,mBAGP,WAAW,EAAU,EAAU,EAAe,CAC5C,KAAK,gBACL,KAAK,UAAU,UACb,KAAK,QAAQ,WACb,KAAK,QAAQ,aAAe,KAE9B,KAAK,UAAU,WAAW,EAAG,EAAG,GAChC,KAAK,UAAU,UACf,KAAK,mBAGP,SAAS,EAAW,EAAW,EAAW,EAAW,EAAkB,CAKrE,GAJA,KAAK,UAAU,UACb,KAAK,QAAQ,WACb,KAAK,QAAQ,aAAe,KAE1B,IAAO,EACT,KAAK,UAAU,SAAS,EAAI,EAAK,EAAY,EAAG,EAAK,EAAI,OACpD,CACL,KAAM,GAAQ,KAAK,MAAM,EAAK,EAAI,EAAK,GACjC,EAAa,KAAK,IAAI,GAAS,E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KAAM,GAAqB,KAAK,oBAChC,EAAmB,QAAU,GAC7B,EAAmB,YACjB,KAAK,aAAa,KAAK,QAAQ,kBAAkB,gBACjD,KAAK,aAAa,IAEf,KAAK,UAAU,SAClB,MAAK,UAAU,QAAU,IAGvB,KAAK,UAAU,QAAQ,QAAQ,KAAwB,IACzD,KAAK,UAAU,QAAQ,KAAK,WAErB,KAAK,sBAAwB,KAAM,CAC5C,GAAI,CAAC,KAAK,UAAU,QAClB,OAEF,KAAM,GAA0B,KAAK,UAAU,QAAQ,QACrD,KAAK,qBAGP,AAAI,IAA4B,IAC9B,KAAK,UAAU,QAAQ,OAAO,EAAyB,IAK7D,SAAgB,CACd,KAAK,UAAU,YArmBnB,QAqB0B,AArB1B,EAqB0B,2BAA8C,CACpE,EAAG,EACH,EAAG,GAklBM,oCACX,IA3mBM",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/PrimitiveDrawing/shapepainterruntimeobject.ts"],
4
- "sourcesContent": ["/*\n * GDevelop JS Platform\n * 2013 Florian Rival (Florian.Rival@gmail.com)\n */\nnamespace gdjs {\n /** Represents a color in RGB Format */\n export type RGBColor = {\n /** The Red component of the color, from 0 to 255. */\n r: integer;\n /** The Green component of the color, from 0 to 255. */\n g: integer;\n /** The Blue component of the color, from 0 to 255. */\n b: integer;\n };\n\n export type Antialiasing = 'none' | 'low' | 'medium' | 'high';\n\n /** Initial properties for a for {@link gdjs.ShapePainterRuntimeObject}. */\n export type ShapePainterObjectDataType = {\n /** The color of the inner part of the painted shape */\n fillColor: RGBColor | string;\n /** The color of the outline of the painted shape */\n outlineColor: RGBColor | string;\n /** The opacity of the inner part of the painted shape, from 0 to 255 */\n fillOpacity: float;\n /** The opacity of the outline of the painted shape, from 0 to 255 */\n outlineOpacity: float;\n /** The size of the outline of the painted shape, in pixels. */\n outlineSize: float;\n /** Use absolute coordinates? */\n absoluteCoordinates: boolean;\n /** Clear the previous render before the next draw? */\n clearBetweenFrames: boolean;\n /** The type of anti-aliasing to apply at rendering. */\n antialiasing: Antialiasing;\n };\n\n export type ShapePainterObjectData = ObjectData & ShapePainterObjectDataType;\n\n /**\n * The ShapePainterRuntimeObject allows to draw graphics shapes on screen.\n */\n export class ShapePainterRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.Scalable, gdjs.Flippable {\n _scaleX: number = 1;\n _scaleY: number = 1;\n _blendMode: number = 0;\n _flippedX: boolean = false;\n _flippedY: boolean = false;\n _customCenter: FloatPoint | null = null;\n _customCollisionMask: Polygon[] | null = null;\n\n _fillColor: integer;\n _outlineColor: integer;\n _fillOpacity: float;\n _outlineOpacity: float;\n _outlineSize: float;\n _useAbsoluteCoordinates: boolean;\n _clearBetweenFrames: boolean;\n _antialiasing: Antialiasing;\n _renderer: gdjs.ShapePainterRuntimeObjectRenderer;\n\n private static readonly _pointForTransformation: FloatPoint = [0, 0];\n\n /**\n * @param instanceContainer The container the object belongs to.\n * @param shapePainterObjectData The initial properties of the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n shapePainterObjectData: ShapePainterObjectData\n ) {\n super(instanceContainer, shapePainterObjectData);\n this._fillColor =\n typeof shapePainterObjectData.fillColor === 'string'\n ? gdjs.rgbOrHexStringToNumber(shapePainterObjectData.fillColor)\n : parseInt(\n gdjs.rgbToHex(\n shapePainterObjectData.fillColor.r,\n shapePainterObjectData.fillColor.g,\n shapePainterObjectData.fillColor.b\n ),\n 16\n );\n this._outlineColor =\n typeof shapePainterObjectData.outlineColor === 'string'\n ? gdjs.rgbOrHexStringToNumber(shapePainterObjectData.outlineColor)\n : parseInt(\n gdjs.rgbToHex(\n shapePainterObjectData.outlineColor.r,\n shapePainterObjectData.outlineColor.g,\n shapePainterObjectData.outlineColor.b\n ),\n 16\n );\n this._fillOpacity = shapePainterObjectData.fillOpacity;\n this._outlineOpacity = shapePainterObjectData.outlineOpacity;\n this._outlineSize = shapePainterObjectData.outlineSize;\n this._useAbsoluteCoordinates = shapePainterObjectData.absoluteCoordinates;\n this._clearBetweenFrames = shapePainterObjectData.clearBetweenFrames;\n this._antialiasing = shapePainterObjectData.antialiasing;\n this._renderer = new gdjs.ShapePainterRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n updateFromObjectData(\n oldObjectData: ShapePainterObjectData,\n newObjectData: ShapePainterObjectData\n ): boolean {\n if (typeof newObjectData.fillColor === 'string') {\n if (oldObjectData.fillColor !== newObjectData.fillColor) {\n this.setFillColor(newObjectData.fillColor);\n }\n }\n if (\n typeof oldObjectData.fillColor !== 'string' &&\n typeof newObjectData.fillColor !== 'string' &&\n (oldObjectData.fillColor.r !== newObjectData.fillColor.r ||\n oldObjectData.fillColor.g !== newObjectData.fillColor.g ||\n oldObjectData.fillColor.b !== newObjectData.fillColor.b)\n ) {\n this.setFillColor(\n '' +\n newObjectData.fillColor.r +\n ';' +\n newObjectData.fillColor.g +\n ';' +\n newObjectData.fillColor.b\n );\n }\n if (typeof newObjectData.outlineColor === 'string') {\n if (oldObjectData.outlineColor !== newObjectData.outlineColor) {\n this.setOutlineColor(newObjectData.outlineColor);\n }\n }\n if (\n typeof oldObjectData.outlineColor !== 'string' &&\n typeof newObjectData.outlineColor !== 'string' &&\n (oldObjectData.outlineColor.r !== newObjectData.outlineColor.r ||\n oldObjectData.outlineColor.g !== newObjectData.outlineColor.g ||\n oldObjectData.outlineColor.b !== newObjectData.outlineColor.b)\n ) {\n this.setOutlineColor(\n '' +\n newObjectData.outlineColor.r +\n ';' +\n newObjectData.outlineColor.g +\n ';' +\n newObjectData.outlineColor.b\n );\n }\n if (oldObjectData.fillOpacity !== newObjectData.fillOpacity) {\n this.setFillOpacity(newObjectData.fillOpacity);\n }\n if (oldObjectData.outlineOpacity !== newObjectData.outlineOpacity) {\n this.setOutlineOpacity(newObjectData.outlineOpacity);\n }\n if (oldObjectData.outlineSize !== newObjectData.outlineSize) {\n this.setOutlineSize(newObjectData.outlineSize);\n }\n if (\n oldObjectData.absoluteCoordinates !== newObjectData.absoluteCoordinates\n ) {\n this._useAbsoluteCoordinates = newObjectData.absoluteCoordinates;\n this._renderer.updatePositionX();\n this._renderer.updatePositionY();\n this._renderer.updateAngle();\n this._renderer.updateScaleX();\n this._renderer.updateScaleY();\n }\n if (\n oldObjectData.clearBetweenFrames !== newObjectData.clearBetweenFrames\n ) {\n this._clearBetweenFrames = newObjectData.clearBetweenFrames;\n }\n if (oldObjectData.antialiasing !== newObjectData.antialiasing) {\n this.setAntialiasing(newObjectData.antialiasing);\n }\n\n return true;\n }\n\n /**\n * Initialize the extra parameters that could be set for an instance.\n * @param initialInstanceData The extra parameters\n */\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n if (initialInstanceData.flippedX) {\n this.flipX(initialInstanceData.flippedX);\n }\n if (initialInstanceData.flippedY) {\n this.flipY(initialInstanceData.flippedY);\n }\n }\n\n stepBehaviorsPreEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {\n //We redefine stepBehaviorsPreEvents just to clear the graphics before running events.\n if (this._clearBetweenFrames) {\n this.clear();\n }\n super.stepBehaviorsPreEvents(instanceContainer);\n }\n\n onDestroyed(): void {\n super.onDestroyed();\n this._renderer.destroy();\n }\n\n /**\n * Clear the graphics.\n */\n clear() {\n this._renderer.clear();\n }\n\n getVisibilityAABB() {\n return this._useAbsoluteCoordinates ? null : this.getAABB();\n }\n\n drawRectangle(x1: float, y1: float, x2: float, y2: float) {\n this._renderer.drawRectangle(x1, y1, x2, y2);\n }\n\n drawCircle(x: float, y: float, radius: float) {\n this._renderer.drawCircle(x, y, radius);\n }\n\n drawLine(x1: float, y1: float, x2: float, y2: float, thickness: float) {\n this._renderer.drawLine(x1, y1, x2, y2, thickness);\n }\n\n drawLineV2(x1: float, y1: float, x2: float, y2: float, thickness: float) {\n this._renderer.drawLineV2(x1, y1, x2, y2, thickness);\n }\n\n drawEllipse(centerX: float, centerY: float, width: float, height: float) {\n this._renderer.drawEllipse(centerX, centerY, width, height);\n }\n\n drawFilletRectangle(\n startX1: float,\n startY1: float,\n endX2: float,\n endY2: float,\n fillet: float\n ) {\n this._renderer.drawFilletRectangle(\n startX1,\n startY1,\n endX2,\n endY2,\n fillet\n );\n }\n\n drawRoundedRectangle(\n startX1: float,\n startY1: float,\n endX2: float,\n endY2: float,\n radius: float\n ) {\n this._renderer.drawRoundedRectangle(\n startX1,\n startY1,\n endX2,\n endY2,\n radius\n );\n }\n\n drawChamferRectangle(\n startX1: float,\n startY1: float,\n endX2: float,\n endY2: float,\n chamfer: float\n ) {\n this._renderer.drawChamferRectangle(\n startX1,\n startY1,\n endX2,\n endY2,\n chamfer\n );\n }\n\n drawTorus(\n centerX: float,\n centerY: float,\n innerRadius: float,\n outerRadius: float,\n startArc: float,\n endArc: float\n ) {\n this._renderer.drawTorus(\n centerX,\n centerY,\n innerRadius,\n outerRadius,\n startArc,\n endArc\n );\n }\n\n drawRegularPolygon(\n centerX: float,\n centerY: float,\n sides: float,\n radius: float,\n rotation: float\n ) {\n this._renderer.drawRegularPolygon(\n centerX,\n centerY,\n sides,\n radius,\n rotation\n );\n }\n\n drawStar(\n centerX: float,\n centerY: float,\n points: float,\n radius: float,\n innerRadius: float,\n rotation: float\n ) {\n this._renderer.drawStar(\n centerX,\n centerY,\n points,\n radius,\n innerRadius,\n rotation\n );\n }\n\n drawArc(\n centerX: float,\n centerY: float,\n radius: float,\n startAngle: float,\n endAngle: float,\n anticlockwise: boolean,\n closePath: boolean\n ) {\n this._renderer.drawArc(\n centerX,\n centerY,\n radius,\n startAngle,\n endAngle,\n anticlockwise,\n closePath\n );\n }\n\n drawBezierCurve(\n x1: float,\n y1: float,\n cpX: float,\n cpY: float,\n cpX2: float,\n cpY2: float,\n x2: float,\n y2: float\n ) {\n this._renderer.drawBezierCurve(x1, y1, cpX, cpY, cpX2, cpY2, x2, y2);\n }\n\n drawQuadraticCurve(\n x1: float,\n y1: float,\n cpX: float,\n cpY: float,\n x2: float,\n y2: float\n ) {\n this._renderer.drawQuadraticCurve(x1, y1, cpX, cpY, x2, y2);\n }\n\n beginFillPath(x1: float, y1: float) {\n this._renderer.beginFillPath();\n this._renderer.drawPathMoveTo(x1, y1);\n }\n\n endFillPath() {\n this._renderer.endFillPath();\n }\n\n drawPathMoveTo(x1: float, y1: float) {\n this._renderer.drawPathMoveTo(x1, y1);\n }\n\n drawPathLineTo(x1: float, y1: float) {\n this._renderer.drawPathLineTo(x1, y1);\n }\n\n drawPathBezierCurveTo(\n cpX: float,\n cpY: float,\n cpX2: float,\n cpY2: float,\n toX: float,\n toY: float\n ) {\n this._renderer.drawPathBezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY);\n }\n\n drawPathArc(\n cx: float,\n cy: float,\n radius: float,\n startAngle: float,\n endAngle: float,\n anticlockwise: boolean\n ) {\n this._renderer.drawPathArc(\n cx,\n cy,\n radius,\n startAngle,\n endAngle,\n anticlockwise\n );\n }\n\n drawPathQuadraticCurveTo(cpX: float, cpY: float, toX: float, toY: float) {\n this._renderer.drawPathQuadraticCurveTo(cpX, cpY, toX, toY);\n }\n\n closePath() {\n this._renderer.closePath();\n }\n\n setClearBetweenFrames(value: boolean): void {\n this._clearBetweenFrames = value;\n }\n\n isClearedBetweenFrames(): boolean {\n return this._clearBetweenFrames;\n }\n\n setAntialiasing(value: Antialiasing): void {\n this._antialiasing = value;\n this._renderer.updateAntialiasing();\n }\n\n getAntialiasing(): Antialiasing {\n return this._antialiasing;\n }\n\n checkAntialiasing(valueToCompare: Antialiasing): boolean {\n return this._antialiasing === valueToCompare;\n }\n\n setCoordinatesRelative(value: boolean): void {\n this._useAbsoluteCoordinates = !value;\n }\n\n areCoordinatesRelative(): boolean {\n return !this._useAbsoluteCoordinates;\n }\n\n setFillColor(color: string): void {\n this._fillColor = gdjs.rgbOrHexStringToNumber(color);\n }\n\n getFillColorR(): integer {\n return gdjs.hexNumberToRGB(this._fillColor).r;\n }\n getFillColorG(): integer {\n return gdjs.hexNumberToRGB(this._fillColor).g;\n }\n getFillColorB(): integer {\n return gdjs.hexNumberToRGB(this._fillColor).b;\n }\n\n setOutlineColor(rgbColor: string): void {\n this._outlineColor = gdjs.rgbOrHexStringToNumber(rgbColor);\n this._renderer.updateOutline();\n }\n\n getOutlineColorR(): integer {\n return gdjs.hexNumberToRGB(this._outlineColor).r;\n }\n getOutlineColorG(): integer {\n return gdjs.hexNumberToRGB(this._outlineColor).g;\n }\n getOutlineColorB(): integer {\n return gdjs.hexNumberToRGB(this._outlineColor).b;\n }\n\n setOutlineSize(size: float): void {\n this._outlineSize = size;\n this._renderer.updateOutline();\n }\n\n getOutlineSize() {\n return this._outlineSize;\n }\n\n /**\n *\n * @param opacity from 0 to 255\n */\n setFillOpacity(opacity: float): void {\n this._fillOpacity = opacity;\n }\n\n /**\n *\n * @returns an opacity value from 0 to 255.\n */\n getFillOpacity() {\n return this._fillOpacity;\n }\n\n /**\n *\n * @param opacity from 0 to 255\n */\n setOutlineOpacity(opacity: float): void {\n this._outlineOpacity = opacity;\n this._renderer.updateOutline();\n }\n\n /**\n *\n * @returns an opacity value from 0 to 255.\n */\n getOutlineOpacity() {\n return this._outlineOpacity;\n }\n\n setX(x: float): void {\n if (x === this.x) {\n return;\n }\n super.setX(x);\n this._renderer.updatePositionX();\n }\n\n setY(y: float): void {\n if (y === this.y) {\n return;\n }\n super.setY(y);\n this._renderer.updatePositionY();\n }\n\n setAngle(angle: float): void {\n if (angle === this.angle) {\n return;\n }\n super.setAngle(angle);\n this._renderer.updateAngle();\n this.invalidateHitboxes();\n }\n\n /**\n * The center of rotation is defined relatively\n * to the drawing origin (the object position).\n * This avoids the center to move on the drawing\n * when new shapes push the bounds.\n *\n * When no custom center is defined, it will move\n * to stay at the center of the drawable bounds.\n *\n * @param x coordinate of the custom center\n * @param y coordinate of the custom center\n */\n setRotationCenter(x: float, y: float): void {\n if (!this._customCenter) {\n this._customCenter = [0, 0];\n }\n this._customCenter[0] = x;\n this._customCenter[1] = y;\n this._renderer.updateRotationCenter();\n }\n\n /**\n * @returns The center X relatively to the drawing origin\n * (whereas `getCenterX()` is relative to the top left drawable bound and scaled).\n */\n getRotationCenterX(): float {\n return this._customCenter\n ? this._customCenter[0]\n : this._renderer.getUnscaledWidth() / 2 -\n this._renderer.getFrameRelativeOriginX();\n }\n\n /**\n * @returns The center Y relatively to the drawing origin\n * (whereas `getCenterY()` is relative to the top left drawable bound and scaled).\n */\n getRotationCenterY(): float {\n return this._customCenter\n ? this._customCenter[1]\n : this._renderer.getUnscaledHeight() / 2 -\n this._renderer.getFrameRelativeOriginY();\n }\n\n getCenterX(): float {\n if (!this._customCenter) {\n return super.getCenterX();\n }\n return (\n this._customCenter[0] * Math.abs(this._scaleX) +\n this.getX() -\n this.getDrawableX()\n );\n }\n\n getCenterY(): float {\n if (!this._customCenter) {\n return super.getCenterY();\n }\n return (\n this._customCenter[1] * Math.abs(this._scaleY) +\n this.getY() -\n this.getDrawableY()\n );\n }\n\n setWidth(newWidth: float): void {\n const unscaledWidth = this._renderer.getUnscaledWidth();\n if (unscaledWidth !== 0) {\n this.setScaleX(newWidth / unscaledWidth);\n }\n }\n\n setHeight(newHeight: float): void {\n const unscaledHeight = this._renderer.getUnscaledHeight();\n if (unscaledHeight !== 0) {\n this.setScaleY(newHeight / unscaledHeight);\n }\n }\n\n setSize(newWidth: float, newHeight: float): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n }\n\n /**\n * Change the scale on X and Y axis of the object.\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScale(newScale: float): void {\n this.setScaleX(newScale);\n this.setScaleY(newScale);\n }\n\n /**\n * Change the scale on X axis of the object (changing its width).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleX(newScale: float): void {\n if (newScale < 0) {\n newScale = 0;\n }\n if (newScale === Math.abs(this._scaleX)) {\n return;\n }\n this._scaleX = newScale * (this._flippedX ? -1 : 1);\n this._renderer.updateScaleX();\n this.invalidateHitboxes();\n }\n\n /**\n * Change the scale on Y axis of the object (changing its width).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleY(newScale: float): void {\n if (newScale < 0) {\n newScale = 0;\n }\n if (newScale === Math.abs(this._scaleY)) {\n return;\n }\n this._scaleY = newScale * (this._flippedY ? -1 : 1);\n this._renderer.updateScaleY();\n this.invalidateHitboxes();\n }\n\n flipX(enable: boolean): void {\n if (enable !== this._flippedX) {\n this._scaleX *= -1;\n this._flippedX = enable;\n this._renderer.updateScaleX();\n this.invalidateHitboxes();\n }\n }\n\n flipY(enable: boolean): void {\n if (enable !== this._flippedY) {\n this._scaleY *= -1;\n this._flippedY = enable;\n this._renderer.updateScaleY();\n this.invalidateHitboxes();\n }\n }\n\n isFlippedX(): boolean {\n return this._flippedX;\n }\n\n isFlippedY(): boolean {\n return this._flippedY;\n }\n\n /**\n * Get the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n */\n getScale(): number {\n const scaleX = Math.abs(this._scaleX);\n const scaleY = Math.abs(this._scaleY);\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Get the scale of the object on Y axis.\n *\n * @return the scale of the object on Y axis\n */\n getScaleY(): float {\n return Math.abs(this._scaleY);\n }\n\n /**\n * Get the scale of the object on X axis.\n *\n * @return the scale of the object on X axis\n */\n getScaleX(): float {\n return Math.abs(this._scaleX);\n }\n\n invalidateBounds() {\n this.invalidateHitboxes();\n }\n\n getDrawableX(): float {\n return this._renderer.getDrawableX();\n }\n\n getDrawableY(): float {\n return this._renderer.getDrawableY();\n }\n\n getWidth(): float {\n return this._renderer.getWidth();\n }\n\n getHeight(): float {\n return this._renderer.getHeight();\n }\n\n updatePreRender(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n this._renderer.updatePreRender();\n }\n\n transformToDrawing(x: float, y: float) {\n const point = ShapePainterRuntimeObject._pointForTransformation;\n point[0] = x;\n point[1] = y;\n return this._renderer.transformToDrawing(point);\n }\n\n transformToScene(x: float, y: float) {\n const point = ShapePainterRuntimeObject._pointForTransformation;\n point[0] = x;\n point[1] = y;\n return this._renderer.transformToScene(point);\n }\n\n transformToDrawingX(x: float, y: float) {\n return this.transformToDrawing(x, y)[0];\n }\n\n transformToDrawingY(x: float, y: float) {\n return this.transformToDrawing(x, y)[1];\n }\n\n transformToSceneX(x: float, y: float) {\n return this.transformToScene(x, y)[0];\n }\n\n transformToSceneY(x: float, y: float) {\n return this.transformToScene(x, y)[1];\n }\n\n setRectangularCollisionMask(\n left: float,\n top: float,\n right: float,\n bottom: float\n ) {\n if (!this._customCollisionMask) {\n const rectangle = new gdjs.Polygon();\n rectangle.vertices.push([0, 0]);\n rectangle.vertices.push([0, 0]);\n rectangle.vertices.push([0, 0]);\n rectangle.vertices.push([0, 0]);\n this._customCollisionMask = [rectangle];\n }\n const rectangle = this._customCollisionMask[0].vertices;\n\n rectangle[0][0] = left;\n rectangle[0][1] = top;\n\n rectangle[1][0] = right;\n rectangle[1][1] = top;\n\n rectangle[2][0] = right;\n rectangle[2][1] = bottom;\n\n rectangle[3][0] = left;\n rectangle[3][1] = bottom;\n\n this.invalidateHitboxes();\n }\n\n updateHitBoxes(): void {\n this.hitBoxes = this._defaultHitBoxes;\n const width = this.getWidth();\n const height = this.getHeight();\n const centerX = this.getCenterX();\n const centerY = this.getCenterY();\n const vertices = this.hitBoxes[0].vertices;\n if (this._customCollisionMask) {\n const customCollisionMaskVertices = this._customCollisionMask[0]\n .vertices;\n for (let i = 0; i < 4; i++) {\n const point = this.transformToScene(\n customCollisionMaskVertices[i][0],\n customCollisionMaskVertices[i][1]\n );\n vertices[i][0] = point[0];\n vertices[i][1] = point[1];\n }\n } else {\n if (centerX === width / 2 && centerY === height / 2) {\n vertices[0][0] = -centerX;\n vertices[0][1] = -centerY;\n vertices[1][0] = +centerX;\n vertices[1][1] = -centerY;\n vertices[2][0] = +centerX;\n vertices[2][1] = +centerY;\n vertices[3][0] = -centerX;\n vertices[3][1] = +centerY;\n } else {\n vertices[0][0] = 0 - centerX;\n vertices[0][1] = 0 - centerY;\n vertices[1][0] = width - centerX;\n vertices[1][1] = 0 - centerY;\n vertices[2][0] = width - centerX;\n vertices[2][1] = height - centerY;\n vertices[3][0] = 0 - centerX;\n vertices[3][1] = height - centerY;\n }\n if (!this._useAbsoluteCoordinates) {\n this.hitBoxes[0].rotate(gdjs.toRad(this.getAngle()));\n }\n this.hitBoxes[0].move(\n this.getDrawableX() + centerX,\n this.getDrawableY() + centerY\n );\n }\n }\n }\n gdjs.registerObject(\n 'PrimitiveDrawing::Drawer',\n gdjs.ShapePainterRuntimeObject\n );\n ShapePainterRuntimeObject.supportsReinitialization = false;\n}\n"],
5
- "mappings": "AAIA,GAAU,MAAV,UAAU,EAAV,CAsCS,qBACG,GAAK,aAC4C,CAyBzD,YACE,EACA,EACA,CACA,MAAM,EAAmB,GA5B3B,aAAkB,EAClB,aAAkB,EAClB,gBAAqB,EACrB,eAAqB,GACrB,eAAqB,GACrB,mBAAmC,KACnC,0BAAyC,KAuBvC,KAAK,WACH,MAAO,GAAuB,WAAc,SACxC,EAAK,uBAAuB,EAAuB,WACnD,SACE,EAAK,SACH,EAAuB,UAAU,EACjC,EAAuB,UAAU,EACjC,EAAuB,UAAU,GAEnC,IAER,KAAK,cACH,MAAO,GAAuB,cAAiB,SAC3C,EAAK,uBAAuB,EAAuB,cACnD,SACE,EAAK,SACH,EAAuB,aAAa,EACpC,EAAuB,aAAa,EACpC,EAAuB,aAAa,GAEtC,IAER,KAAK,aAAe,EAAuB,YAC3C,KAAK,gBAAkB,EAAuB,eAC9C,KAAK,aAAe,EAAuB,YAC3C,KAAK,wBAA0B,EAAuB,oBACtD,KAAK,oBAAsB,EAAuB,mBAClD,KAAK,cAAgB,EAAuB,aAC5C,KAAK,UAAY,G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*/\nnamespace gdjs {\n /** Represents a color in RGB Format */\n export type RGBColor = {\n /** The Red component of the color, from 0 to 255. */\n r: integer;\n /** The Green component of the color, from 0 to 255. */\n g: integer;\n /** The Blue component of the color, from 0 to 255. */\n b: integer;\n };\n\n export type Antialiasing = 'none' | 'low' | 'medium' | 'high';\n\n /** Initial properties for a for {@link gdjs.ShapePainterRuntimeObject}. */\n export type ShapePainterObjectDataType = {\n /** The color of the inner part of the painted shape */\n fillColor: RGBColor | string;\n /** The color of the outline of the painted shape */\n outlineColor: RGBColor | string;\n /** The opacity of the inner part of the painted shape, from 0 to 255 */\n fillOpacity: float;\n /** The opacity of the outline of the painted shape, from 0 to 255 */\n outlineOpacity: float;\n /** The size of the outline of the painted shape, in pixels. */\n outlineSize: float;\n /** Use absolute coordinates? */\n absoluteCoordinates: boolean;\n /** Clear the previous render before the next draw? */\n clearBetweenFrames: boolean;\n /** The type of anti-aliasing to apply at rendering. */\n antialiasing: Antialiasing;\n };\n\n export type ShapePainterObjectData = ObjectData & ShapePainterObjectDataType;\n\n /**\n * The ShapePainterRuntimeObject allows to draw graphics shapes on screen.\n */\n export class ShapePainterRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.Scalable, gdjs.Flippable\n {\n _scaleX: number = 1;\n _scaleY: number = 1;\n _blendMode: number = 0;\n _flippedX: boolean = false;\n _flippedY: boolean = false;\n _customCenter: FloatPoint | null = null;\n _customCollisionMask: Polygon[] | null = null;\n\n _fillColor: integer;\n _outlineColor: integer;\n _fillOpacity: float;\n _outlineOpacity: float;\n _outlineSize: float;\n _useAbsoluteCoordinates: boolean;\n _clearBetweenFrames: boolean;\n _antialiasing: Antialiasing;\n _renderer: gdjs.ShapePainterRuntimeObjectRenderer;\n\n private static readonly _pointForTransformation: FloatPoint = [0, 0];\n\n /**\n * @param instanceContainer The container the object belongs to.\n * @param shapePainterObjectData The initial properties of the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n shapePainterObjectData: ShapePainterObjectData\n ) {\n super(instanceContainer, shapePainterObjectData);\n this._fillColor =\n typeof shapePainterObjectData.fillColor === 'string'\n ? gdjs.rgbOrHexStringToNumber(shapePainterObjectData.fillColor)\n : parseInt(\n gdjs.rgbToHex(\n shapePainterObjectData.fillColor.r,\n shapePainterObjectData.fillColor.g,\n shapePainterObjectData.fillColor.b\n ),\n 16\n );\n this._outlineColor =\n typeof shapePainterObjectData.outlineColor === 'string'\n ? gdjs.rgbOrHexStringToNumber(shapePainterObjectData.outlineColor)\n : parseInt(\n gdjs.rgbToHex(\n shapePainterObjectData.outlineColor.r,\n shapePainterObjectData.outlineColor.g,\n shapePainterObjectData.outlineColor.b\n ),\n 16\n );\n this._fillOpacity = shapePainterObjectData.fillOpacity;\n this._outlineOpacity = shapePainterObjectData.outlineOpacity;\n this._outlineSize = shapePainterObjectData.outlineSize;\n this._useAbsoluteCoordinates = shapePainterObjectData.absoluteCoordinates;\n this._clearBetweenFrames = shapePainterObjectData.clearBetweenFrames;\n this._antialiasing = shapePainterObjectData.antialiasing;\n this._renderer = new gdjs.ShapePainterRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n updateFromObjectData(\n oldObjectData: ShapePainterObjectData,\n newObjectData: ShapePainterObjectData\n ): boolean {\n if (typeof newObjectData.fillColor === 'string') {\n if (oldObjectData.fillColor !== newObjectData.fillColor) {\n this.setFillColor(newObjectData.fillColor);\n }\n }\n if (\n typeof oldObjectData.fillColor !== 'string' &&\n typeof newObjectData.fillColor !== 'string' &&\n (oldObjectData.fillColor.r !== newObjectData.fillColor.r ||\n oldObjectData.fillColor.g !== newObjectData.fillColor.g ||\n oldObjectData.fillColor.b !== newObjectData.fillColor.b)\n ) {\n this.setFillColor(\n '' +\n newObjectData.fillColor.r +\n ';' +\n newObjectData.fillColor.g +\n ';' +\n newObjectData.fillColor.b\n );\n }\n if (typeof newObjectData.outlineColor === 'string') {\n if (oldObjectData.outlineColor !== newObjectData.outlineColor) {\n this.setOutlineColor(newObjectData.outlineColor);\n }\n }\n if (\n typeof oldObjectData.outlineColor !== 'string' &&\n typeof newObjectData.outlineColor !== 'string' &&\n (oldObjectData.outlineColor.r !== newObjectData.outlineColor.r ||\n oldObjectData.outlineColor.g !== newObjectData.outlineColor.g ||\n oldObjectData.outlineColor.b !== newObjectData.outlineColor.b)\n ) {\n this.setOutlineColor(\n '' +\n newObjectData.outlineColor.r +\n ';' +\n newObjectData.outlineColor.g +\n ';' +\n newObjectData.outlineColor.b\n );\n }\n if (oldObjectData.fillOpacity !== newObjectData.fillOpacity) {\n this.setFillOpacity(newObjectData.fillOpacity);\n }\n if (oldObjectData.outlineOpacity !== newObjectData.outlineOpacity) {\n this.setOutlineOpacity(newObjectData.outlineOpacity);\n }\n if (oldObjectData.outlineSize !== newObjectData.outlineSize) {\n this.setOutlineSize(newObjectData.outlineSize);\n }\n if (\n oldObjectData.absoluteCoordinates !== newObjectData.absoluteCoordinates\n ) {\n this._useAbsoluteCoordinates = newObjectData.absoluteCoordinates;\n this._renderer.updatePositionX();\n this._renderer.updatePositionY();\n this._renderer.updateAngle();\n this._renderer.updateScaleX();\n this._renderer.updateScaleY();\n }\n if (\n oldObjectData.clearBetweenFrames !== newObjectData.clearBetweenFrames\n ) {\n this._clearBetweenFrames = newObjectData.clearBetweenFrames;\n }\n if (oldObjectData.antialiasing !== newObjectData.antialiasing) {\n this.setAntialiasing(newObjectData.antialiasing);\n }\n\n return true;\n }\n\n /**\n * Initialize the extra parameters that could be set for an instance.\n * @param initialInstanceData The extra parameters\n */\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n if (initialInstanceData.flippedX) {\n this.flipX(initialInstanceData.flippedX);\n }\n if (initialInstanceData.flippedY) {\n this.flipY(initialInstanceData.flippedY);\n }\n }\n\n stepBehaviorsPreEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {\n //We redefine stepBehaviorsPreEvents just to clear the graphics before running events.\n if (this._clearBetweenFrames) {\n this.clear();\n }\n super.stepBehaviorsPreEvents(instanceContainer);\n }\n\n onDestroyed(): void {\n super.onDestroyed();\n this._renderer.destroy();\n }\n\n /**\n * Clear the graphics.\n */\n clear() {\n this._renderer.clear();\n }\n\n getVisibilityAABB() {\n return this._useAbsoluteCoordinates ? null : this.getAABB();\n }\n\n drawRectangle(x1: float, y1: float, x2: float, y2: float) {\n this._renderer.drawRectangle(x1, y1, x2, y2);\n }\n\n drawCircle(x: float, y: float, radius: float) {\n this._renderer.drawCircle(x, y, radius);\n }\n\n drawLine(x1: float, y1: float, x2: float, y2: float, thickness: float) {\n this._renderer.drawLine(x1, y1, x2, y2, thickness);\n }\n\n drawLineV2(x1: float, y1: float, x2: float, y2: float, thickness: float) {\n this._renderer.drawLineV2(x1, y1, x2, y2, thickness);\n }\n\n drawEllipse(centerX: float, centerY: float, width: float, height: float) {\n this._renderer.drawEllipse(centerX, centerY, width, height);\n }\n\n drawFilletRectangle(\n startX1: float,\n startY1: float,\n endX2: float,\n endY2: float,\n fillet: float\n ) {\n this._renderer.drawFilletRectangle(\n startX1,\n startY1,\n endX2,\n endY2,\n fillet\n );\n }\n\n drawRoundedRectangle(\n startX1: float,\n startY1: float,\n endX2: float,\n endY2: float,\n radius: float\n ) {\n this._renderer.drawRoundedRectangle(\n startX1,\n startY1,\n endX2,\n endY2,\n radius\n );\n }\n\n drawChamferRectangle(\n startX1: float,\n startY1: float,\n endX2: float,\n endY2: float,\n chamfer: float\n ) {\n this._renderer.drawChamferRectangle(\n startX1,\n startY1,\n endX2,\n endY2,\n chamfer\n );\n }\n\n drawTorus(\n centerX: float,\n centerY: float,\n innerRadius: float,\n outerRadius: float,\n startArc: float,\n endArc: float\n ) {\n this._renderer.drawTorus(\n centerX,\n centerY,\n innerRadius,\n outerRadius,\n startArc,\n endArc\n );\n }\n\n drawRegularPolygon(\n centerX: float,\n centerY: float,\n sides: float,\n radius: float,\n rotation: float\n ) {\n this._renderer.drawRegularPolygon(\n centerX,\n centerY,\n sides,\n radius,\n rotation\n );\n }\n\n drawStar(\n centerX: float,\n centerY: float,\n points: float,\n radius: float,\n innerRadius: float,\n rotation: float\n ) {\n this._renderer.drawStar(\n centerX,\n centerY,\n points,\n radius,\n innerRadius,\n rotation\n );\n }\n\n drawArc(\n centerX: float,\n centerY: float,\n radius: float,\n startAngle: float,\n endAngle: float,\n anticlockwise: boolean,\n closePath: boolean\n ) {\n this._renderer.drawArc(\n centerX,\n centerY,\n radius,\n startAngle,\n endAngle,\n anticlockwise,\n closePath\n );\n }\n\n drawBezierCurve(\n x1: float,\n y1: float,\n cpX: float,\n cpY: float,\n cpX2: float,\n cpY2: float,\n x2: float,\n y2: float\n ) {\n this._renderer.drawBezierCurve(x1, y1, cpX, cpY, cpX2, cpY2, x2, y2);\n }\n\n drawQuadraticCurve(\n x1: float,\n y1: float,\n cpX: float,\n cpY: float,\n x2: float,\n y2: float\n ) {\n this._renderer.drawQuadraticCurve(x1, y1, cpX, cpY, x2, y2);\n }\n\n beginFillPath(x1: float, y1: float) {\n this._renderer.beginFillPath();\n this._renderer.drawPathMoveTo(x1, y1);\n }\n\n endFillPath() {\n this._renderer.endFillPath();\n }\n\n drawPathMoveTo(x1: float, y1: float) {\n this._renderer.drawPathMoveTo(x1, y1);\n }\n\n drawPathLineTo(x1: float, y1: float) {\n this._renderer.drawPathLineTo(x1, y1);\n }\n\n drawPathBezierCurveTo(\n cpX: float,\n cpY: float,\n cpX2: float,\n cpY2: float,\n toX: float,\n toY: float\n ) {\n this._renderer.drawPathBezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY);\n }\n\n drawPathArc(\n cx: float,\n cy: float,\n radius: float,\n startAngle: float,\n endAngle: float,\n anticlockwise: boolean\n ) {\n this._renderer.drawPathArc(\n cx,\n cy,\n radius,\n startAngle,\n endAngle,\n anticlockwise\n );\n }\n\n drawPathQuadraticCurveTo(cpX: float, cpY: float, toX: float, toY: float) {\n this._renderer.drawPathQuadraticCurveTo(cpX, cpY, toX, toY);\n }\n\n closePath() {\n this._renderer.closePath();\n }\n\n setClearBetweenFrames(value: boolean): void {\n this._clearBetweenFrames = value;\n }\n\n isClearedBetweenFrames(): boolean {\n return this._clearBetweenFrames;\n }\n\n setAntialiasing(value: Antialiasing): void {\n this._antialiasing = value;\n this._renderer.updateAntialiasing();\n }\n\n getAntialiasing(): Antialiasing {\n return this._antialiasing;\n }\n\n checkAntialiasing(valueToCompare: Antialiasing): boolean {\n return this._antialiasing === valueToCompare;\n }\n\n setCoordinatesRelative(value: boolean): void {\n this._useAbsoluteCoordinates = !value;\n }\n\n areCoordinatesRelative(): boolean {\n return !this._useAbsoluteCoordinates;\n }\n\n setFillColor(color: string): void {\n this._fillColor = gdjs.rgbOrHexStringToNumber(color);\n }\n\n getFillColorR(): integer {\n return gdjs.hexNumberToRGB(this._fillColor).r;\n }\n getFillColorG(): integer {\n return gdjs.hexNumberToRGB(this._fillColor).g;\n }\n getFillColorB(): integer {\n return gdjs.hexNumberToRGB(this._fillColor).b;\n }\n\n setOutlineColor(rgbColor: string): void {\n this._outlineColor = gdjs.rgbOrHexStringToNumber(rgbColor);\n this._renderer.updateOutline();\n }\n\n getOutlineColorR(): integer {\n return gdjs.hexNumberToRGB(this._outlineColor).r;\n }\n getOutlineColorG(): integer {\n return gdjs.hexNumberToRGB(this._outlineColor).g;\n }\n getOutlineColorB(): integer {\n return gdjs.hexNumberToRGB(this._outlineColor).b;\n }\n\n setOutlineSize(size: float): void {\n this._outlineSize = size;\n this._renderer.updateOutline();\n }\n\n getOutlineSize() {\n return this._outlineSize;\n }\n\n /**\n *\n * @param opacity from 0 to 255\n */\n setFillOpacity(opacity: float): void {\n this._fillOpacity = opacity;\n }\n\n /**\n *\n * @returns an opacity value from 0 to 255.\n */\n getFillOpacity() {\n return this._fillOpacity;\n }\n\n /**\n *\n * @param opacity from 0 to 255\n */\n setOutlineOpacity(opacity: float): void {\n this._outlineOpacity = opacity;\n this._renderer.updateOutline();\n }\n\n /**\n *\n * @returns an opacity value from 0 to 255.\n */\n getOutlineOpacity() {\n return this._outlineOpacity;\n }\n\n setX(x: float): void {\n if (x === this.x) {\n return;\n }\n super.setX(x);\n this._renderer.updatePositionX();\n }\n\n setY(y: float): void {\n if (y === this.y) {\n return;\n }\n super.setY(y);\n this._renderer.updatePositionY();\n }\n\n setAngle(angle: float): void {\n if (angle === this.angle) {\n return;\n }\n super.setAngle(angle);\n this._renderer.updateAngle();\n this.invalidateHitboxes();\n }\n\n /**\n * The center of rotation is defined relatively\n * to the drawing origin (the object position).\n * This avoids the center to move on the drawing\n * when new shapes push the bounds.\n *\n * When no custom center is defined, it will move\n * to stay at the center of the drawable bounds.\n *\n * @param x coordinate of the custom center\n * @param y coordinate of the custom center\n */\n setRotationCenter(x: float, y: float): void {\n if (!this._customCenter) {\n this._customCenter = [0, 0];\n }\n this._customCenter[0] = x;\n this._customCenter[1] = y;\n this._renderer.updateRotationCenter();\n }\n\n /**\n * @returns The center X relatively to the drawing origin\n * (whereas `getCenterX()` is relative to the top left drawable bound and scaled).\n */\n getRotationCenterX(): float {\n return this._customCenter\n ? this._customCenter[0]\n : this._renderer.getUnscaledWidth() / 2 -\n this._renderer.getFrameRelativeOriginX();\n }\n\n /**\n * @returns The center Y relatively to the drawing origin\n * (whereas `getCenterY()` is relative to the top left drawable bound and scaled).\n */\n getRotationCenterY(): float {\n return this._customCenter\n ? this._customCenter[1]\n : this._renderer.getUnscaledHeight() / 2 -\n this._renderer.getFrameRelativeOriginY();\n }\n\n getCenterX(): float {\n if (!this._customCenter) {\n return super.getCenterX();\n }\n return (\n this._customCenter[0] * Math.abs(this._scaleX) +\n this.getX() -\n this.getDrawableX()\n );\n }\n\n getCenterY(): float {\n if (!this._customCenter) {\n return super.getCenterY();\n }\n return (\n this._customCenter[1] * Math.abs(this._scaleY) +\n this.getY() -\n this.getDrawableY()\n );\n }\n\n setWidth(newWidth: float): void {\n const unscaledWidth = this._renderer.getUnscaledWidth();\n if (unscaledWidth !== 0) {\n this.setScaleX(newWidth / unscaledWidth);\n }\n }\n\n setHeight(newHeight: float): void {\n const unscaledHeight = this._renderer.getUnscaledHeight();\n if (unscaledHeight !== 0) {\n this.setScaleY(newHeight / unscaledHeight);\n }\n }\n\n setSize(newWidth: float, newHeight: float): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n }\n\n /**\n * Change the scale on X and Y axis of the object.\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScale(newScale: float): void {\n this.setScaleX(newScale);\n this.setScaleY(newScale);\n }\n\n /**\n * Change the scale on X axis of the object (changing its width).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleX(newScale: float): void {\n if (newScale < 0) {\n newScale = 0;\n }\n if (newScale === Math.abs(this._scaleX)) {\n return;\n }\n this._scaleX = newScale * (this._flippedX ? -1 : 1);\n this._renderer.updateScaleX();\n this.invalidateHitboxes();\n }\n\n /**\n * Change the scale on Y axis of the object (changing its width).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleY(newScale: float): void {\n if (newScale < 0) {\n newScale = 0;\n }\n if (newScale === Math.abs(this._scaleY)) {\n return;\n }\n this._scaleY = newScale * (this._flippedY ? -1 : 1);\n this._renderer.updateScaleY();\n this.invalidateHitboxes();\n }\n\n flipX(enable: boolean): void {\n if (enable !== this._flippedX) {\n this._scaleX *= -1;\n this._flippedX = enable;\n this._renderer.updateScaleX();\n this.invalidateHitboxes();\n }\n }\n\n flipY(enable: boolean): void {\n if (enable !== this._flippedY) {\n this._scaleY *= -1;\n this._flippedY = enable;\n this._renderer.updateScaleY();\n this.invalidateHitboxes();\n }\n }\n\n isFlippedX(): boolean {\n return this._flippedX;\n }\n\n isFlippedY(): boolean {\n return this._flippedY;\n }\n\n /**\n * Get the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n */\n getScale(): number {\n const scaleX = Math.abs(this._scaleX);\n const scaleY = Math.abs(this._scaleY);\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Get the scale of the object on Y axis.\n *\n * @return the scale of the object on Y axis\n */\n getScaleY(): float {\n return Math.abs(this._scaleY);\n }\n\n /**\n * Get the scale of the object on X axis.\n *\n * @return the scale of the object on X axis\n */\n getScaleX(): float {\n return Math.abs(this._scaleX);\n }\n\n invalidateBounds() {\n this.invalidateHitboxes();\n }\n\n getDrawableX(): float {\n return this._renderer.getDrawableX();\n }\n\n getDrawableY(): float {\n return this._renderer.getDrawableY();\n }\n\n getWidth(): float {\n return this._renderer.getWidth();\n }\n\n getHeight(): float {\n return this._renderer.getHeight();\n }\n\n updatePreRender(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n this._renderer.updatePreRender();\n }\n\n transformToDrawing(x: float, y: float) {\n const point = ShapePainterRuntimeObject._pointForTransformation;\n point[0] = x;\n point[1] = y;\n return this._renderer.transformToDrawing(point);\n }\n\n transformToScene(x: float, y: float) {\n const point = ShapePainterRuntimeObject._pointForTransformation;\n point[0] = x;\n point[1] = y;\n return this._renderer.transformToScene(point);\n }\n\n transformToDrawingX(x: float, y: float) {\n return this.transformToDrawing(x, y)[0];\n }\n\n transformToDrawingY(x: float, y: float) {\n return this.transformToDrawing(x, y)[1];\n }\n\n transformToSceneX(x: float, y: float) {\n return this.transformToScene(x, y)[0];\n }\n\n transformToSceneY(x: float, y: float) {\n return this.transformToScene(x, y)[1];\n }\n\n setRectangularCollisionMask(\n left: float,\n top: float,\n right: float,\n bottom: float\n ) {\n if (!this._customCollisionMask) {\n const rectangle = new gdjs.Polygon();\n rectangle.vertices.push([0, 0]);\n rectangle.vertices.push([0, 0]);\n rectangle.vertices.push([0, 0]);\n rectangle.vertices.push([0, 0]);\n this._customCollisionMask = [rectangle];\n }\n const rectangle = this._customCollisionMask[0].vertices;\n\n rectangle[0][0] = left;\n rectangle[0][1] = top;\n\n rectangle[1][0] = right;\n rectangle[1][1] = top;\n\n rectangle[2][0] = right;\n rectangle[2][1] = bottom;\n\n rectangle[3][0] = left;\n rectangle[3][1] = bottom;\n\n this.invalidateHitboxes();\n }\n\n updateHitBoxes(): void {\n this.hitBoxes = this._defaultHitBoxes;\n const width = this.getWidth();\n const height = this.getHeight();\n const centerX = this.getCenterX();\n const centerY = this.getCenterY();\n const vertices = this.hitBoxes[0].vertices;\n if (this._customCollisionMask) {\n const customCollisionMaskVertices =\n this._customCollisionMask[0].vertices;\n for (let i = 0; i < 4; i++) {\n const point = this.transformToScene(\n customCollisionMaskVertices[i][0],\n customCollisionMaskVertices[i][1]\n );\n vertices[i][0] = point[0];\n vertices[i][1] = point[1];\n }\n } else {\n if (centerX === width / 2 && centerY === height / 2) {\n vertices[0][0] = -centerX;\n vertices[0][1] = -centerY;\n vertices[1][0] = +centerX;\n vertices[1][1] = -centerY;\n vertices[2][0] = +centerX;\n vertices[2][1] = +centerY;\n vertices[3][0] = -centerX;\n vertices[3][1] = +centerY;\n } else {\n vertices[0][0] = 0 - centerX;\n vertices[0][1] = 0 - centerY;\n vertices[1][0] = width - centerX;\n vertices[1][1] = 0 - centerY;\n vertices[2][0] = width - centerX;\n vertices[2][1] = height - centerY;\n vertices[3][0] = 0 - centerX;\n vertices[3][1] = height - centerY;\n }\n if (!this._useAbsoluteCoordinates) {\n this.hitBoxes[0].rotate(gdjs.toRad(this.getAngle()));\n }\n this.hitBoxes[0].move(\n this.getDrawableX() + centerX,\n this.getDrawableY() + centerY\n );\n }\n }\n }\n gdjs.registerObject(\n 'PrimitiveDrawing::Drawer',\n gdjs.ShapePainterRuntimeObject\n );\n ShapePainterRuntimeObject.supportsReinitialization = false;\n}\n"],
5
+ "mappings": "AAIA,GAAU,MAAV,UAAU,EAAV,CAsCS,qBACG,GAAK,aAEf,CAyBE,YACE,EACA,EACA,CACA,MAAM,EAAmB,GA5B3B,aAAkB,EAClB,aAAkB,EAClB,gBAAqB,EACrB,eAAqB,GACrB,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A,EACA,EACA,EACA,GAIJ,qBACE,EACA,EACA,EACA,EACA,EACA,CACA,KAAK,UAAU,qBACb,EACA,EACA,EACA,EACA,GAIJ,qBACE,EACA,EACA,EACA,EACA,EACA,CACA,KAAK,UAAU,qBACb,EACA,EACA,EACA,EACA,GAIJ,UACE,EACA,EACA,EACA,EACA,EACA,EACA,CACA,KAAK,UAAU,UACb,EACA,EACA,EACA,EACA,EACA,GAIJ,mBACE,EACA,EACA,EACA,EACA,EACA,CACA,KAAK,UAAU,mBACb,EACA,EACA,EACA,EACA,GAIJ,SACE,EACA,EACA,EACA,EACA,EACA,EACA,CACA,KAAK,UAAU,SACb,EACA,EACA,EACA,EACA,EACA,GAIJ,QACE,EACA,EACA,EACA,EACA,EACA,EACA,EACA,CACA,KAAK,UAAU,QACb,EACA,EACA,EACA,EACA,EACA,EACA,GAIJ,gBACE,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,CACA,KAAK,UAAU,gBAAgB,EAAI,EAAI,EAAK,EAAK,EAAM,EAAM,EAAI,GAGnE,mBACE,EACA,EACA,EACA,EACA,EACA,EACA,CACA,KAAK,UAAU,mBAAmB,EAAI,EAAI,EAAK,EAAK,EAAI,GAG1D,cAAc,EAAW,EAAW,CAClC,KAAK,UAAU,gBACf,KAAK,UAAU,eAAe,EAAI,GAGpC,aAAc,CACZ,KAAK,UAAU,cAGjB,eAAe,EAAW,EAAW,CACnC,KAAK,UAAU,eAAe,EAAI,GAGpC,eAAe,EAAW,EAAW,CACnC,KAAK,UAAU,eAAe,EAAI,GAGpC,sBACE,EACA,EACA,EACA,EACA,EACA,EACA,CACA,KAAK,UAAU,sBAAsB,EAAK,EAAK,EAAM,EAAM,EAAK,GAGlE,YACE,EACA,EACA,EACA,EACA,EACA,EACA,CACA,KAAK,UAAU,YACb,EACA,EACA,EACA,EACA,EACA,GAIJ,yBAAyB,EAAY,EAAY,EAAY,EAAY,CACvE,KAAK,UAAU,yBAAyB,EAAK,EAAK,EAAK,GAGzD,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,EACrB,EAAS,GAAG,GAAK,EAAQ,EACzB,EAAS,GAAG,GAAK,EAAI,EACrB,EAAS,GAAG,GAAK,EAAQ,EACzB,EAAS,GAAG,GAAK,EAAS,EAC1B,EAAS,GAAG,GAAK,EAAI,EACrB,EAAS,GAAG,GAAK,EAAS,GAEvB,KAAK,yBACR,KAAK,SAAS,GAAG,OAAO,EAAK,MAAM,KAAK,aAE1C,KAAK,SAAS,GAAG,KACf,KAAK,eAAiB,EACtB,KAAK,eAAiB,KA10BvB,QAsBmB,AAtBnB,EAsBmB,wBAAsC,CAAC,EAAG,GAtB7D,EAAM,4BA+0Bb,EAAK,eACH,2BACA,EAAK,2BAEP,EAA0B,yBAA2B,KAz3B7C",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var gdjs;(function(n){let a;(function(e){let i;(function(r){const s=new n.Logger("Spatial Sound");r.setSoundPosition=(p,t,c,g,l)=>{const o=p.getScene().getSoundManager().getSoundOnChannel(t);o?o.setSpatialPosition(c,g,l):s.error(`Cannot set the spatial position of a non-existing sound on channel ${t}.`)}})(i=e.spatialSound||(e.spatialSound={}))})(a=n.evtTools||(n.evtTools={}))})(gdjs||(gdjs={}));
1
+ var gdjs;(function(n){let a;(function(e){let t;(function(o){o.setSoundPosition=(r,c,i,s,p)=>{r.getScene().getSoundManager().setSoundSpatialPositionOnChannel(c,i,s,p)}})(t=e.spatialSound||(e.spatialSound={}))})(a=n.evtTools||(n.evtTools={}))})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=spatialsoundtools.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/SpatialSound/spatialsoundtools.ts"],
4
- "sourcesContent": ["namespace gdjs {\n export namespace evtTools {\n export namespace spatialSound {\n const logger = new gdjs.Logger('Spatial Sound');\n export const setSoundPosition = (\n instanceContainer: gdjs.RuntimeInstanceContainer,\n channel: integer,\n x: float,\n y: float,\n z: float\n ) => {\n // TODO EBO The position must be transform to the scene position when it comes from a custom object.\n const sound = instanceContainer\n .getScene()\n .getSoundManager()\n .getSoundOnChannel(channel);\n if (sound) sound.setSpatialPosition(x, y, z);\n else\n logger.error(\n `Cannot set the spatial position of a non-existing sound on channel ${channel}.`\n );\n };\n }\n }\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CACS,GAAU,GAAV,UAAU,EAAV,CACE,GAAU,GAAV,UAAU,EAAV,CACL,KAAM,GAAS,GAAI,GAAK,OAAO,iBACxB,AAAM,mBAAmB,CAC9B,EACA,EACA,EACA,EACA,IACG,CAEH,KAAM,GAAQ,EACX,WACA,kBACA,kBAAkB,GACrB,AAAI,EAAO,EAAM,mBAAmB,EAAG,EAAG,GAExC,EAAO,MACL,sEAAsE,SAjB7D,yCADF,iCADT",
4
+ "sourcesContent": ["namespace gdjs {\n export namespace evtTools {\n export namespace spatialSound {\n export const setSoundPosition = (\n instanceContainer: gdjs.RuntimeInstanceContainer,\n channel: integer,\n x: float,\n y: float,\n z: float\n ) => {\n // TODO EBO The position must be transform to the scene position when it comes from a custom object.\n const soundManager = instanceContainer.getScene().getSoundManager();\n soundManager.setSoundSpatialPositionOnChannel(channel, x, y, z);\n };\n }\n }\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CACS,GAAU,GAAV,UAAU,EAAV,CACE,GAAU,GAAV,UAAU,EAAV,CACE,AAAM,mBAAmB,CAC9B,EACA,EACA,EACA,EACA,IACG,CAGH,AADqB,EAAkB,WAAW,kBACrC,iCAAiC,EAAS,EAAG,EAAG,MAVhD,yCADF,iCADT",
6
6
  "names": []
7
7
  }
@@ -137,10 +137,11 @@ module.exports = {
137
137
  const { PIXI, RenderedInstance, gd } = objectsRenderingService;
138
138
 
139
139
  class RenderedSpineInstance extends RenderedInstance {
140
+ /** @type {pixi_spine.Spine | null} */
140
141
  _spine = null;
141
142
  _rect = new PIXI.Graphics();
142
- _initialWidth = null;
143
- _initialHeight = null;
143
+ _initialWidth = 256;
144
+ _initialHeight = 256;
144
145
  _animationIndex = -1;
145
146
  _spineOriginOffsetX = 0;
146
147
  _spineOriginOffsetY = 0;
@@ -304,14 +305,14 @@ module.exports = {
304
305
  * @returns {number} default width
305
306
  */
306
307
  getDefaultWidth() {
307
- return this._initialWidth !== null ? this._initialWidth : 256;
308
+ return this._initialWidth;
308
309
  }
309
310
 
310
311
  /**
311
312
  * @returns {number} default height
312
313
  */
313
314
  getDefaultHeight() {
314
- return this._initialHeight !== null ? this._initialHeight : 256;
315
+ return this._initialHeight;
315
316
  }
316
317
 
317
318
  onRemovedFromScene() {
@@ -1,2 +1,2 @@
1
- var gdjs;(function(u){const c=["atlas"];class g{constructor(e,s){this._loadedSpineAtlases=new u.ResourceCache;this._loadingSpineAtlases=new u.ResourceCache;this._resourceLoader=e,this._imageManager=s}getResourceKinds(){return c}async processResource(e){}async loadResource(e){await this.getOrLoad(e)}getOrLoad(e){const s=this._getAtlasResource(e);if(!s)return Promise.reject(`Unable to find atlas for resource '${e}'.`);let t=this._loadingSpineAtlases.get(s);return t||(t=new Promise((n,a)=>{const o=(i,r)=>{if(i)return a(`Error while preloading a spine atlas resource: ${i}`);if(!r)return a(`Cannot reach texture atlas for resource '${e}'.`);n(r)};this.load(s,o)}),this._loadingSpineAtlases.set(s,t)),t}load(e,s){const t=this._resourceLoader.getRuntimeGame(),n=t.getEmbeddedResourcesNames(e.name);if(!n.length)return s(new Error(`${e.name} do not have image metadata!`));const a=n.reduce((r,l)=>{const d=t.resolveEmbeddedResource(e.name,l);return r[l]=this._imageManager.getOrLoadPIXITexture(d),r},{}),o=r=>{this._loadedSpineAtlases.set(e,r),s(null,r)},i=this._resourceLoader.getFullUrl(e.file);PIXI.Assets.setPreferences({preferWorkers:!1,crossOrigin:this._resourceLoader.checkIfCredentialsRequired(i)?"use-credentials":"anonymous"}),PIXI.Assets.add(e.name,i,{images:a}),PIXI.Assets.load(e.name).then(r=>{typeof r=="string"?new pixi_spine.TextureAtlas(r,(l,d)=>d(a[l].baseTexture),o):o(r)})}isLoaded(e){return!!this._loadedSpineAtlases.getFromName(e)}getAtlasTexture(e){return this._loadedSpineAtlases.getFromName(e)}_getAtlasResource(e){const s=this._resourceLoader.getResource(e);return s&&this.getResourceKinds().includes(s.kind)?s:null}dispose(){this._loadedSpineAtlases.clear(),this._loadingSpineAtlases.clear()}}u.SpineAtlasManager=g})(gdjs||(gdjs={}));
1
+ var gdjs;(function(u){const c=["atlas"];class g{constructor(e,s){this._loadedSpineAtlases=new u.ResourceCache;this._loadingSpineAtlases=new u.ResourceCache;this._resourceLoader=e,this._imageManager=s}getResourceKinds(){return c}async processResource(e){}async loadResource(e){await this.getOrLoad(e)}getOrLoad(e){const s=this._getAtlasResource(e);if(!s)return Promise.reject(`Unable to find atlas for resource '${e}'.`);let t=this._loadingSpineAtlases.get(s);return t||(t=new Promise((n,a)=>{const o=(i,r)=>{if(i)return a(`Error while preloading a spine atlas resource: ${i}`);if(!r)return a(`Cannot reach texture atlas for resource '${e}'.`);n(r)};this.load(s,o)}),this._loadingSpineAtlases.set(s,t)),t}load(e,s){const t=this._resourceLoader.getRuntimeGame(),n=t.getEmbeddedResourcesNames(e.name);if(!n.length)return s(new Error(`${e.name} do not have image metadata!`));const a=n.reduce((r,l)=>{const d=t.resolveEmbeddedResource(e.name,l);return r[l]=this._imageManager.getOrLoadPIXITexture(d),r},{}),o=r=>{this._loadedSpineAtlases.set(e,r),s(null,r)},i=this._resourceLoader.getFullUrl(e.file);PIXI.Assets.setPreferences({preferWorkers:!1,crossOrigin:this._resourceLoader.checkIfCredentialsRequired(i)?"use-credentials":"anonymous"}),PIXI.Assets.add({alias:e.name,src:i,data:{images:a}}),PIXI.Assets.load(e.name).then(r=>{typeof r=="string"?new pixi_spine.TextureAtlas(r,(l,d)=>d(a[l].baseTexture),o):o(r)})}isLoaded(e){return!!this._loadedSpineAtlases.getFromName(e)}getAtlasTexture(e){return this._loadedSpineAtlases.getFromName(e)}_getAtlasResource(e){const s=this._resourceLoader.getResource(e);return s&&this.getResourceKinds().includes(s.kind)?s:null}dispose(){this._loadedSpineAtlases.clear(),this._loadingSpineAtlases.clear()}}u.SpineAtlasManager=g})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=pixi-spine-atlas-manager.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../GDevelop/Extensions/Spine/managers/pixi-spine-atlas-manager.ts"],
4
- "sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-present Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n /** The callback called when a text that was requested is loaded (or an error occurred). */\n export type SpineAtlasManagerRequestCallback = (\n error: Error | null,\n content?: pixi_spine.TextureAtlas\n ) => void;\n\n const atlasKinds: ResourceKind[] = ['atlas'];\n\n /**\n * AtlasManager loads atlas files with pixi loader, using the \"atlas\" resources\n * registered in the game resources and process them to Pixi TextureAtlas.\n *\n * Contrary to audio/fonts, text files are loaded asynchronously, when requested.\n * You should properly handle errors, and give the developer/player a way to know\n * that loading failed.\n */\n export class SpineAtlasManager implements gdjs.ResourceManager {\n private _imageManager: ImageManager;\n private _resourceLoader: ResourceLoader;\n private _loadedSpineAtlases = new gdjs.ResourceCache<\n pixi_spine.TextureAtlas\n >();\n private _loadingSpineAtlases = new gdjs.ResourceCache<\n Promise<pixi_spine.TextureAtlas>\n >();\n\n /**\n * @param resources The resources data of the game.\n * @param resourcesLoader The resources loader of the game.\n */\n constructor(\n resourceLoader: gdjs.ResourceLoader,\n imageManager: ImageManager\n ) {\n this._resourceLoader = resourceLoader;\n this._imageManager = imageManager;\n }\n\n getResourceKinds(): ResourceKind[] {\n return atlasKinds;\n }\n\n async processResource(resourceName: string): Promise<void> {\n // Do nothing because pixi-spine parses resources by itself.\n }\n\n async loadResource(resourceName: string): Promise<void> {\n await this.getOrLoad(resourceName);\n }\n\n /**\n * Returns promisified loaded atlas resource if it is availble, loads it otherwise.\n *\n * @param resources The data of resource to load.\n */\n getOrLoad(resourceName: string): Promise<pixi_spine.TextureAtlas> {\n const resource = this._getAtlasResource(resourceName);\n\n if (!resource) {\n return Promise.reject(\n `Unable to find atlas for resource '${resourceName}'.`\n );\n }\n\n let loadingPromise = this._loadingSpineAtlases.get(resource);\n\n if (!loadingPromise) {\n loadingPromise = new Promise<pixi_spine.TextureAtlas>(\n (resolve, reject) => {\n const onLoad: SpineAtlasManagerRequestCallback = (\n error,\n content\n ) => {\n if (error) {\n return reject(\n `Error while preloading a spine atlas resource: ${error}`\n );\n }\n if (!content) {\n return reject(\n `Cannot reach texture atlas for resource '${resourceName}'.`\n );\n }\n\n resolve(content);\n };\n\n this.load(resource, onLoad);\n }\n );\n\n this._loadingSpineAtlases.set(resource, loadingPromise);\n }\n\n return loadingPromise;\n }\n\n /**\n * Load specified atlas resource and pass it to callback once it is loaded.\n *\n * @param resources The data of resource to load.\n * @param callback The callback to pass atlas to it once it is loaded.\n */\n load(\n resource: ResourceData,\n callback: SpineAtlasManagerRequestCallback\n ): void {\n const game = this._resourceLoader.getRuntimeGame();\n const embeddedResourcesNames = game.getEmbeddedResourcesNames(\n resource.name\n );\n\n if (!embeddedResourcesNames.length)\n return callback(\n new Error(`${resource.name} do not have image metadata!`)\n );\n\n const images = embeddedResourcesNames.reduce<{\n [key: string]: PIXI.Texture;\n }>((imagesMap, embeddedResourceName) => {\n const mappedResourceName = game.resolveEmbeddedResource(\n resource.name,\n embeddedResourceName\n );\n imagesMap[\n embeddedResourceName\n ] = this._imageManager.getOrLoadPIXITexture(mappedResourceName);\n\n return imagesMap;\n }, {});\n const onLoad = (atlas: pixi_spine.TextureAtlas) => {\n this._loadedSpineAtlases.set(resource, atlas);\n callback(null, atlas);\n };\n const url = this._resourceLoader.getFullUrl(resource.file);\n\n PIXI.Assets.setPreferences({\n preferWorkers: false,\n crossOrigin: this._resourceLoader.checkIfCredentialsRequired(url)\n ? 'use-credentials'\n : 'anonymous',\n });\n PIXI.Assets.add(resource.name, url, { images });\n PIXI.Assets.load<pixi_spine.TextureAtlas | string>(resource.name).then(\n (atlas) => {\n /**\n * Ideally atlas of TextureAtlas should be passed here\n * but there is known issue in case of preloaded images (see https://github.com/pixijs/spine/issues/537)\n *\n * Here covered all possible ways to make it work fine if issue is fixed in pixi-spine or after migration to spine-pixi\n */\n if (typeof atlas === 'string') {\n new pixi_spine.TextureAtlas(\n atlas,\n (textureName, textureCb) =>\n textureCb(images[textureName].baseTexture),\n onLoad\n );\n } else {\n onLoad(atlas);\n }\n }\n );\n }\n\n /**\n * Check if the given atlas resource was loaded (preloaded or loaded with `load`).\n * @param resourceName The name of the atlas resource.\n * @returns true if the content of the atlas resource is loaded, false otherwise.\n */\n isLoaded(resourceName: string): boolean {\n return !!this._loadedSpineAtlases.getFromName(resourceName);\n }\n\n /**\n * Get the Pixi TextureAtlas for the given resource that is already loaded (preloaded or loaded with `load`).\n * If the resource is not loaded, `null` will be returned.\n * @param resourceName The name of the atlas resource.\n * @returns the TextureAtlas of the atlas if loaded, `null` otherwise.\n */\n getAtlasTexture(resourceName: string): pixi_spine.TextureAtlas | null {\n return this._loadedSpineAtlases.getFromName(resourceName);\n }\n\n private _getAtlasResource(resourceName: string): ResourceData | null {\n const resource = this._resourceLoader.getResource(resourceName);\n return resource && this.getResourceKinds().includes(resource.kind)\n ? resource\n : null;\n }\n /**\n * To be called when the game is disposed.\n * Clear the Spine Atlases loaded in this manager.\n */\n dispose(): void {\n this._loadedSpineAtlases.clear();\n this._loadingSpineAtlases.clear();\n }\n }\n}\n"],
5
- "mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CAOE,KAAM,GAA6B,CAAC,SAU7B,OAAwD,CAc7D,YACE,EACA,EACA,CAdM,yBAAsB,GAAI,GAAK,cAG/B,0BAAuB,GAAI,GAAK,cAYtC,KAAK,gBAAkB,EACvB,KAAK,cAAgB,EAGvB,kBAAmC,CACjC,MAAO,QAGH,iBAAgB,EAA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E,MAAO,MAAK,oBAAoB,YAAY,GAGtC,kBAAkB,EAA2C,CACnE,KAAM,GAAW,KAAK,gBAAgB,YAAY,GAClD,MAAO,IAAY,KAAK,mBAAmB,SAAS,EAAS,MACzD,EACA,KAMN,SAAgB,CACd,KAAK,oBAAoB,QACzB,KAAK,qBAAqB,SApLvB,EAAM,sBAjBL",
4
+ "sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-present Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n /** The callback called when a text that was requested is loaded (or an error occurred). */\n export type SpineAtlasManagerRequestCallback = (\n error: Error | null,\n content?: pixi_spine.TextureAtlas\n ) => void;\n\n const atlasKinds: ResourceKind[] = ['atlas'];\n\n /**\n * AtlasManager loads atlas files with pixi loader, using the \"atlas\" resources\n * registered in the game resources and process them to Pixi TextureAtlas.\n *\n * Contrary to audio/fonts, text files are loaded asynchronously, when requested.\n * You should properly handle errors, and give the developer/player a way to know\n * that loading failed.\n */\n export class SpineAtlasManager implements gdjs.ResourceManager {\n private _imageManager: ImageManager;\n private _resourceLoader: ResourceLoader;\n private _loadedSpineAtlases =\n new gdjs.ResourceCache<pixi_spine.TextureAtlas>();\n private _loadingSpineAtlases = new gdjs.ResourceCache<\n Promise<pixi_spine.TextureAtlas>\n >();\n\n /**\n * @param resourceLoader The resources loader of the game.\n * @param imageManager The image manager of the game.\n */\n constructor(\n resourceLoader: gdjs.ResourceLoader,\n imageManager: ImageManager\n ) {\n this._resourceLoader = resourceLoader;\n this._imageManager = imageManager;\n }\n\n getResourceKinds(): ResourceKind[] {\n return atlasKinds;\n }\n\n async processResource(resourceName: string): Promise<void> {\n // Do nothing because pixi-spine parses resources by itself.\n }\n\n async loadResource(resourceName: string): Promise<void> {\n await this.getOrLoad(resourceName);\n }\n\n /**\n * Returns promisified loaded atlas resource if it is available, loads it otherwise.\n *\n * @param resourceName The name of resource to load.\n */\n getOrLoad(resourceName: string): Promise<pixi_spine.TextureAtlas> {\n const resource = this._getAtlasResource(resourceName);\n\n if (!resource) {\n return Promise.reject(\n `Unable to find atlas for resource '${resourceName}'.`\n );\n }\n\n let loadingPromise = this._loadingSpineAtlases.get(resource);\n\n if (!loadingPromise) {\n loadingPromise = new Promise<pixi_spine.TextureAtlas>(\n (resolve, reject) => {\n const onLoad: SpineAtlasManagerRequestCallback = (\n error,\n content\n ) => {\n if (error) {\n return reject(\n `Error while preloading a spine atlas resource: ${error}`\n );\n }\n if (!content) {\n return reject(\n `Cannot reach texture atlas for resource '${resourceName}'.`\n );\n }\n\n resolve(content);\n };\n\n this.load(resource, onLoad);\n }\n );\n\n this._loadingSpineAtlases.set(resource, loadingPromise);\n }\n\n return loadingPromise;\n }\n\n /**\n * Load specified atlas resource and pass it to callback once it is loaded.\n *\n * @param resource The data of resource to load.\n * @param callback The callback to pass atlas to it once it is loaded.\n */\n load(\n resource: ResourceData,\n callback: SpineAtlasManagerRequestCallback\n ): void {\n const game = this._resourceLoader.getRuntimeGame();\n const embeddedResourcesNames = game.getEmbeddedResourcesNames(\n resource.name\n );\n\n if (!embeddedResourcesNames.length)\n return callback(\n new Error(`${resource.name} do not have image metadata!`)\n );\n\n const images = embeddedResourcesNames.reduce<{\n [key: string]: PIXI.Texture;\n }>((imagesMap, embeddedResourceName) => {\n const mappedResourceName = game.resolveEmbeddedResource(\n resource.name,\n embeddedResourceName\n );\n imagesMap[embeddedResourceName] =\n this._imageManager.getOrLoadPIXITexture(mappedResourceName);\n\n return imagesMap;\n }, {});\n const onLoad = (atlas: pixi_spine.TextureAtlas) => {\n this._loadedSpineAtlases.set(resource, atlas);\n callback(null, atlas);\n };\n const url = this._resourceLoader.getFullUrl(resource.file);\n\n PIXI.Assets.setPreferences({\n preferWorkers: false,\n crossOrigin: this._resourceLoader.checkIfCredentialsRequired(url)\n ? 'use-credentials'\n : 'anonymous',\n });\n PIXI.Assets.add({ alias: resource.name, src: url, data: { images } });\n PIXI.Assets.load<pixi_spine.TextureAtlas | string>(resource.name).then(\n (atlas) => {\n /**\n * Ideally atlas of TextureAtlas should be passed here\n * but there is known issue in case of preloaded images (see https://github.com/pixijs/spine/issues/537)\n *\n * Here covered all possible ways to make it work fine if issue is fixed in pixi-spine or after migration to spine-pixi\n */\n if (typeof atlas === 'string') {\n new pixi_spine.TextureAtlas(\n atlas,\n (textureName, textureCb) =>\n //@ts-ignore\n textureCb(images[textureName].baseTexture),\n onLoad\n );\n } else {\n onLoad(atlas);\n }\n }\n );\n }\n\n /**\n * Check if the given atlas resource was loaded (preloaded or loaded with `load`).\n * @param resourceName The name of the atlas resource.\n * @returns true if the content of the atlas resource is loaded, false otherwise.\n */\n isLoaded(resourceName: string): boolean {\n return !!this._loadedSpineAtlases.getFromName(resourceName);\n }\n\n /**\n * Get the Pixi TextureAtlas for the given resource that is already loaded (preloaded or loaded with `load`).\n * If the resource is not loaded, `null` will be returned.\n * @param resourceName The name of the atlas resource.\n * @returns the TextureAtlas of the atlas if loaded, `null` otherwise.\n */\n getAtlasTexture(resourceName: string): pixi_spine.TextureAtlas | null {\n return this._loadedSpineAtlases.getFromName(resourceName);\n }\n\n private _getAtlasResource(resourceName: string): ResourceData | null {\n const resource = this._resourceLoader.getResource(resourceName);\n return resource && this.getResourceKinds().includes(resource.kind)\n ? resource\n : null;\n }\n /**\n * To be called when the game is disposed.\n * Clear the Spine Atlases loaded in this manager.\n */\n dispose(): void {\n this._loadedSpineAtlases.clear();\n this._loadingSpineAtlases.clear();\n }\n }\n}\n"],
5
+ "mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CAOE,KAAM,GAA6B,CAAC,SAU7B,OAAwD,CAa7D,YACE,EACA,EACA,CAbM,yBACN,GAAI,GAAK,cACH,0BAAuB,GAAI,GAAK,cAYtC,KAAK,gBAAkB,EACvB,KAAK,cAAgB,EAGvB,kBAAmC,CACjC,MAAO,QAGH,iBAAgB,EAAqC,OAIrD,cAAa,EAAqC,CACtD,KAAM,MAAK,UAAU,GAQvB,UA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GAGtC,kBAAkB,EAA2C,CACnE,KAAM,GAAW,KAAK,gBAAgB,YAAY,GAClD,MAAO,IAAY,KAAK,mBAAmB,SAAS,EAAS,MACzD,EACA,KAMN,SAAgB,CACd,KAAK,oBAAoB,QACzB,KAAK,qBAAqB,SAnLvB,EAAM,sBAjBL",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var gdjs;(function(o){const r=new o.Logger("Spine Manager"),c=["spine"];class l{constructor(s,e){this._loadedSpines=new o.ResourceCache;this._resourceLoader=s,this._spineAtlasManager=e}getResourceKinds(){return c}async processResource(s){}async loadResource(s){const e=this._getSpineResource(s);if(!e)return r.error(`Unable to find spine json for resource ${s}.`);try{const n=this._resourceLoader.getRuntimeGame(),a=n.getEmbeddedResourcesNames(e.name);if(a.length!==1)return r.error(`Unable to find atlas metadata for resource spine json ${s}.`);const d=n.resolveEmbeddedResource(e.name,a[0]),u=await this._spineAtlasManager.getOrLoad(d),t=this._resourceLoader.getFullUrl(e.file);PIXI.Assets.setPreferences({preferWorkers:!1,crossOrigin:this._resourceLoader.checkIfCredentialsRequired(t)?"use-credentials":"anonymous"}),PIXI.Assets.add(e.name,t,{spineAtlas:u});const i=await PIXI.Assets.load(e.name);i.spineData?this._loadedSpines.set(e,i.spineData):r.error(`Loader cannot process spine resource ${e.name} correctly.`)}catch(n){r.error(`Error while preloading spine resource ${e.name}: ${n}`)}}getSpine(s){return this._loadedSpines.getFromName(s)}isSpineLoaded(s){return!!this._loadedSpines.getFromName(s)}_getSpineResource(s){const e=this._resourceLoader.getResource(s);return e&&this.getResourceKinds().includes(e.kind)?e:null}dispose(){this._loadedSpines.clear()}}o.SpineManager=l})(gdjs||(gdjs={}));
1
+ var gdjs;(function(n){const r=new n.Logger("Spine Manager"),c=["spine"];class u{constructor(s,e){this._loadedSpines=new n.ResourceCache;this._resourceLoader=s,this._spineAtlasManager=e}getResourceKinds(){return c}async processResource(s){}async loadResource(s){const e=this._getSpineResource(s);if(!e)return r.error(`Unable to find spine json for resource ${s}.`);try{const a=this._resourceLoader.getRuntimeGame(),o=a.getEmbeddedResourcesNames(e.name);if(o.length!==1)return r.error(`Unable to find atlas metadata for resource spine json ${s}.`);const d=a.resolveEmbeddedResource(e.name,o[0]),l=await this._spineAtlasManager.getOrLoad(d),t=this._resourceLoader.getFullUrl(e.file);PIXI.Assets.setPreferences({preferWorkers:!1,crossOrigin:this._resourceLoader.checkIfCredentialsRequired(t)?"use-credentials":"anonymous"}),PIXI.Assets.add({alias:e.name,src:t,data:{spineAtlas:l}});const i=await PIXI.Assets.load(e.name);i.spineData?this._loadedSpines.set(e,i.spineData):r.error(`Loader cannot process spine resource ${e.name} correctly.`)}catch(a){r.error(`Error while preloading spine resource ${e.name}: ${a}`)}}getSpine(s){return this._loadedSpines.getFromName(s)}isSpineLoaded(s){return!!this._loadedSpines.getFromName(s)}_getSpineResource(s){const e=this._resourceLoader.getResource(s);return e&&this.getResourceKinds().includes(e.kind)?e:null}dispose(){this._loadedSpines.clear()}}n.SpineManager=u})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=pixi-spine-manager.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../GDevelop/Extensions/Spine/managers/pixi-spine-manager.ts"],
4
- "sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-present Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n const logger = new gdjs.Logger('Spine Manager');\n\n const resourceKinds: ResourceKind[] = ['spine'];\n\n /**\n * SpineManager manages pixi spine skeleton data.\n */\n export class SpineManager implements gdjs.ResourceManager {\n private _spineAtlasManager: SpineAtlasManager;\n private _resourceLoader: ResourceLoader;\n private _loadedSpines = new gdjs.ResourceCache<pixi_spine.ISkeletonData>();\n\n /**\n * @param resourceDataArray The resources data of the game.\n * @param resourcesLoader The resources loader of the game.\n */\n constructor(\n resourceLoader: gdjs.ResourceLoader,\n spineAtlasManager: SpineAtlasManager\n ) {\n this._resourceLoader = resourceLoader;\n this._spineAtlasManager = spineAtlasManager;\n }\n\n getResourceKinds(): ResourceKind[] {\n return resourceKinds;\n }\n\n async processResource(resourceName: string): Promise<void> {\n // Do nothing because pixi-spine parses resources by itself.\n }\n\n async loadResource(resourceName: string): Promise<void> {\n const resource = this._getSpineResource(resourceName);\n\n if (!resource) {\n return logger.error(\n `Unable to find spine json for resource ${resourceName}.`\n );\n }\n\n try {\n const game = this._resourceLoader.getRuntimeGame();\n const embeddedResourcesNames = game.getEmbeddedResourcesNames(\n resource.name\n );\n\n // there should be exactly one file which is pointing to atlas\n if (embeddedResourcesNames.length !== 1) {\n return logger.error(\n `Unable to find atlas metadata for resource spine json ${resourceName}.`\n );\n }\n\n const atlasResourceName = game.resolveEmbeddedResource(\n resource.name,\n embeddedResourcesNames[0]\n );\n const spineAtlas = await this._spineAtlasManager.getOrLoad(\n atlasResourceName\n );\n const url = this._resourceLoader.getFullUrl(resource.file);\n PIXI.Assets.setPreferences({\n preferWorkers: false,\n crossOrigin: this._resourceLoader.checkIfCredentialsRequired(url)\n ? 'use-credentials'\n : 'anonymous',\n });\n PIXI.Assets.add(resource.name, url, { spineAtlas });\n const loadedJson = await PIXI.Assets.load(resource.name);\n\n if (loadedJson.spineData) {\n this._loadedSpines.set(resource, loadedJson.spineData);\n } else {\n logger.error(\n `Loader cannot process spine resource ${resource.name} correctly.`\n );\n }\n } catch (error) {\n logger.error(\n `Error while preloading spine resource ${resource.name}: ${error}`\n );\n }\n }\n\n /**\n * Get the object for the given resource that is already loaded (preloaded or loaded with `loadJson`).\n * If the resource is not loaded, `null` will be returned.\n *\n * @param resourceName The name of the spine skeleton.\n * @returns the spine skeleton if loaded, `null` otherwise.\n */\n getSpine(resourceName: string): pixi_spine.ISkeletonData | null {\n return this._loadedSpines.getFromName(resourceName);\n }\n\n /**\n * Check if the given spine skeleton was loaded.\n * @param resourceName The name of the spine skeleton.\n * @returns true if the content of the spine skeleton is loaded, false otherwise.\n */\n isSpineLoaded(resourceName: string): boolean {\n return !!this._loadedSpines.getFromName(resourceName);\n }\n\n private _getSpineResource(resourceName: string): ResourceData | null {\n const resource = this._resourceLoader.getResource(resourceName);\n return resource && this.getResourceKinds().includes(resource.kind)\n ? resource\n : null;\n }\n\n /**\n * To be called when the game is disposed.\n * Clear the Spine skeleton data loaded in this manager.\n */\n dispose(): void {\n this._loadedSpines.clear();\n }\n }\n}\n"],
5
- "mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,iBAEzB,EAAgC,CAAC,SAKhC,OAAmD,CASxD,YACE,EACA,EACA,CATM,mBAAgB,GAAI,GAAK,cAU/B,KAAK,gBAAkB,EACvB,KAAK,mBAAqB,EAG5B,kBAAmC,CACjC,MAAO,QAGH,iBAAgB,EAAqC,OAIrD,cAAa,EAAqC,CACtD,KAAM,GAAW,KAAK,kBAAkB,GAExC,GAAI,CAAC,EACH,MAAO,GAAO,MACZ,0CAA0C,MAI9C,GAAI,CACF,KAAM,GAAO,KAAK,gBAAgB,iBAC5B,EAAyB,EAAK,0BAClC,EAAS,MAIX,GAAI,EAAuB,SAAW,EACpC,MAAO,GAAO,MACZ,yDAAyD,MAI7D,KAAM,GAAoB,EAAK,wBAC7B,EAAS,KACT,EAAuB,IAEnB,EAAa,KAAM,MAAK,mBAAmB,UAC/C,GAEI,EAAM,KAAK,gBAAgB,WAAW,EAAS,MACrD,KAAK,OAAO,eAAe,CACzB,cAAe,GACf,YAAa,KAAK,gBAAgB,2BAA2B,GACzD,kBACA,cAEN,KAAK,OAAO,IAAI,EAAS,KAAM,EAAK,CAAE,eACtC,KAAM,GAAa,KAAM,MAAK,OAAO,KAAK,EAAS,MAEnD,AAAI,EAAW,UACb,KAAK,cAAc,IAAI,EAAU,EAAW,WAE5C,EAAO,MACL,wCAAwC,EAAS,yBAG9C,EAAP,CACA,EAAO,MACL,yCAAyC,EAAS,SAAS,MAYjE,SAAS,EAAuD,CAC9D,MAAO,MAAK,cAAc,YAAY,GAQxC,cAAc,EAA+B,CAC3C,MAAO,CAAC,CAAC,KAAK,cAAc,YAAY,GAGlC,kBAAkB,EAA2C,CACnE,KAAM,GAAW,KAAK,gBAAgB,YAAY,GAClD,MAAO,IAAY,KAAK,mBAAmB,SAAS,EAAS,MACzD,EACA,KAON,SAAgB,CACd,KAAK,cAAc,SA9GhB,EAAM,iBARL",
4
+ "sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-present Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n const logger = new gdjs.Logger('Spine Manager');\n\n const resourceKinds: ResourceKind[] = ['spine'];\n\n /**\n * SpineManager manages pixi spine skeleton data.\n */\n export class SpineManager implements gdjs.ResourceManager {\n private _spineAtlasManager: SpineAtlasManager;\n private _resourceLoader: ResourceLoader;\n private _loadedSpines = new gdjs.ResourceCache<pixi_spine.ISkeletonData>();\n\n /**\n * @param resourceLoader The resources loader of the game.\n * @param spineAtlasManager The resources data of the game.\n */\n constructor(\n resourceLoader: gdjs.ResourceLoader,\n spineAtlasManager: SpineAtlasManager\n ) {\n this._resourceLoader = resourceLoader;\n this._spineAtlasManager = spineAtlasManager;\n }\n\n getResourceKinds(): ResourceKind[] {\n return resourceKinds;\n }\n\n async processResource(resourceName: string): Promise<void> {\n // Do nothing because pixi-spine parses resources by itself.\n }\n\n async loadResource(resourceName: string): Promise<void> {\n const resource = this._getSpineResource(resourceName);\n\n if (!resource) {\n return logger.error(\n `Unable to find spine json for resource ${resourceName}.`\n );\n }\n\n try {\n const game = this._resourceLoader.getRuntimeGame();\n const embeddedResourcesNames = game.getEmbeddedResourcesNames(\n resource.name\n );\n\n // there should be exactly one file which is pointing to atlas\n if (embeddedResourcesNames.length !== 1) {\n return logger.error(\n `Unable to find atlas metadata for resource spine json ${resourceName}.`\n );\n }\n\n const atlasResourceName = game.resolveEmbeddedResource(\n resource.name,\n embeddedResourcesNames[0]\n );\n const spineAtlas =\n await this._spineAtlasManager.getOrLoad(atlasResourceName);\n const url = this._resourceLoader.getFullUrl(resource.file);\n PIXI.Assets.setPreferences({\n preferWorkers: false,\n crossOrigin: this._resourceLoader.checkIfCredentialsRequired(url)\n ? 'use-credentials'\n : 'anonymous',\n });\n PIXI.Assets.add({\n alias: resource.name,\n src: url,\n data: { spineAtlas },\n });\n const loadedJson = await PIXI.Assets.load(resource.name);\n\n if (loadedJson.spineData) {\n this._loadedSpines.set(resource, loadedJson.spineData);\n } else {\n logger.error(\n `Loader cannot process spine resource ${resource.name} correctly.`\n );\n }\n } catch (error) {\n logger.error(\n `Error while preloading spine resource ${resource.name}: ${error}`\n );\n }\n }\n\n /**\n * Get the object for the given resource that is already loaded (preloaded or loaded with `loadJson`).\n * If the resource is not loaded, `null` will be returned.\n *\n * @param resourceName The name of the spine skeleton.\n * @returns the spine skeleton if loaded, `null` otherwise.\n */\n getSpine(resourceName: string): pixi_spine.ISkeletonData | null {\n return this._loadedSpines.getFromName(resourceName);\n }\n\n /**\n * Check if the given spine skeleton was loaded.\n * @param resourceName The name of the spine skeleton.\n * @returns true if the content of the spine skeleton is loaded, false otherwise.\n */\n isSpineLoaded(resourceName: string): boolean {\n return !!this._loadedSpines.getFromName(resourceName);\n }\n\n private _getSpineResource(resourceName: string): ResourceData | null {\n const resource = this._resourceLoader.getResource(resourceName);\n return resource && this.getResourceKinds().includes(resource.kind)\n ? resource\n : null;\n }\n\n /**\n * To be called when the game is disposed.\n * Clear the Spine skeleton data loaded in this manager.\n */\n dispose(): void {\n this._loadedSpines.clear();\n }\n }\n}\n"],
5
+ "mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,iBAEzB,EAAgC,CAAC,SAKhC,OAAmD,CASxD,YACE,EACA,EACA,CATM,mBAAgB,GAAI,GAAK,cAU/B,KAAK,gBAAkB,EACvB,KAAK,mBAAqB,EAG5B,kBAAmC,CACjC,MAAO,QAGH,iBAAgB,EAAqC,OAIrD,cAAa,EAAqC,CACtD,KAAM,GAAW,KAAK,kBAAkB,GAExC,GAAI,CAAC,EACH,MAAO,GAAO,MACZ,0CAA0C,MAI9C,GAAI,CACF,KAAM,GAAO,KAAK,gBAAgB,iBAC5B,EAAyB,EAAK,0BAClC,EAAS,MAIX,GAAI,EAAuB,SAAW,EACpC,MAAO,GAAO,MACZ,yDAAyD,MAI7D,KAAM,GAAoB,EAAK,wBAC7B,EAAS,KACT,EAAuB,IAEnB,EACJ,KAAM,MAAK,mBAAmB,UAAU,GACpC,EAAM,KAAK,gBAAgB,WAAW,EAAS,MACrD,KAAK,OAAO,eAAe,CACzB,cAAe,GACf,YAAa,KAAK,gBAAgB,2BAA2B,GACzD,kBACA,cAEN,KAAK,OAAO,IAAI,CACd,MAAO,EAAS,KAChB,IAAK,EACL,KAAM,CAAE,gBAEV,KAAM,GAAa,KAAM,MAAK,OAAO,KAAK,EAAS,MAEnD,AAAI,EAAW,UACb,KAAK,cAAc,IAAI,EAAU,EAAW,WAE5C,EAAO,MACL,wCAAwC,EAAS,yBAG9C,EAAP,CACA,EAAO,MACL,yCAAyC,EAAS,SAAS,MAYjE,SAAS,EAAuD,CAC9D,MAAO,MAAK,cAAc,YAAY,GAQxC,cAAc,EAA+B,CAC3C,MAAO,CAAC,CAAC,KAAK,cAAc,YAAY,GAGlC,kBAAkB,EAA2C,CACnE,KAAM,GAAW,KAAK,gBAAgB,YAAY,GAClD,MAAO,IAAY,KAAK,mBAAmB,SAAS,EAAS,MACzD,EACA,KAON,SAAgB,CACd,KAAK,cAAc,SAjHhB,EAAM,iBARL",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/Spine/spineruntimeobject-pixi-renderer.ts"],
4
- "sourcesContent": ["namespace gdjs {\n const isSpine = (obj: any): obj is pixi_spine.Spine =>\n obj instanceof pixi_spine.Spine;\n\n // See https://github.com/pixijs/spine/issues/562\n // IPointAttachment is not declared and exported but its implementation does exist and it is used in runtime\n interface IPointAttachment extends pixi_spine.IVertexAttachment {\n computeWorldPosition(\n bone: pixi_spine.IBone,\n point: pixi_spine.Vector2\n ): pixi_spine.Vector2;\n computeWorldRotation(bone: pixi_spine.IBone): number;\n }\n\n const isPointAttachment = (\n attachment: pixi_spine.IAttachment\n ): attachment is IPointAttachment =>\n !!attachment && attachment.type === pixi_spine.AttachmentType.Point;\n\n export class SpineRuntimeObjectPixiRenderer {\n private _object: gdjs.SpineRuntimeObject;\n private _rendererObject: pixi_spine.Spine | PIXI.Container;\n private _isAnimationComplete = true;\n\n /**\n * @param runtimeObject The object to render\n * @param instanceContainer The container in which the object is\n */\n constructor(\n runtimeObject: gdjs.SpineRuntimeObject,\n private instanceContainer: gdjs.RuntimeInstanceContainer\n ) {\n this._object = runtimeObject;\n this._rendererObject = this.constructRendererObject();\n if (isSpine(this._rendererObject)) {\n this._rendererObject.autoUpdate = false;\n }\n\n this.updatePosition();\n this.updateAngle();\n this.updateOpacity();\n this.updateScale();\n\n instanceContainer\n .getLayer('')\n .getRenderer()\n .addRendererObject(this._rendererObject, runtimeObject.getZOrder());\n }\n\n updateAnimation(timeDelta: float) {\n if (!isSpine(this._rendererObject)) {\n return;\n }\n this._rendererObject.update(timeDelta);\n }\n\n getRendererObject(): pixi_spine.Spine | PIXI.Container {\n return this._rendererObject;\n }\n\n getOriginOffset(): PIXI.Point {\n if (!isSpine(this._rendererObject)) return new PIXI.Point(0, 0);\n\n const localBounds = this._rendererObject.getLocalBounds(undefined, true);\n\n return new PIXI.Point(\n localBounds.x * this._rendererObject.scale.x,\n localBounds.y * this._rendererObject.scale.y\n );\n }\n\n onDestroy(): void {\n this._rendererObject.destroy();\n }\n\n updateScale(): void {\n const scaleX = Math.max(\n this._object._originalScale * this._object.getScaleX(),\n 0\n );\n const scaleY = Math.max(\n this._object._originalScale * this._object.getScaleY(),\n 0\n );\n this._rendererObject.scale.x = this._object.isFlippedX()\n ? -scaleX\n : scaleX;\n this._rendererObject.scale.y = this._object.isFlippedY()\n ? -scaleY\n : scaleY;\n }\n\n updatePosition(): void {\n this._rendererObject.position.x = this._object.x;\n this._rendererObject.position.y = this._object.y;\n }\n\n updateAngle(): void {\n this._rendererObject.rotation = gdjs.toRad(this._object.angle);\n }\n\n updateOpacity(): void {\n this._rendererObject.alpha = this._object.getOpacity() / 255;\n }\n\n getWidth(): float {\n return this._rendererObject.width;\n }\n\n getHeight(): float {\n return this._rendererObject.height;\n }\n\n setWidth(width: float): void {\n this._rendererObject.width = width;\n }\n\n setHeight(height: float): void {\n this._rendererObject.height = height;\n }\n\n getUnscaledWidth(): float {\n return Math.abs(\n (this._rendererObject.width * this._object._originalScale) /\n this._rendererObject.scale.x\n );\n }\n\n getUnscaledHeight(): float {\n return Math.abs(\n (this._rendererObject.height * this._object._originalScale) /\n this._rendererObject.scale.y\n );\n }\n\n setMixing(from: string, to: string, duration: number): void {\n if (!isSpine(this._rendererObject)) return;\n\n this._rendererObject.stateData.setMix(from, to, duration);\n }\n\n setAnimation(animation: string, loop: boolean): void {\n if (isSpine(this._rendererObject)) {\n const onCompleteListener: pixi_spine.IAnimationStateListener = {\n complete: () => {\n this._isAnimationComplete = true;\n (this._rendererObject as pixi_spine.Spine).state.removeListener(\n onCompleteListener\n );\n },\n };\n\n this._isAnimationComplete = false;\n this._rendererObject.state.addListener(onCompleteListener);\n this._rendererObject.state.setAnimation(0, animation, loop);\n this._rendererObject.update(0);\n }\n }\n\n getAnimationDuration(sourceAnimationName: string) {\n if (!isSpine(this._rendererObject)) {\n return 0;\n }\n const animation = this._rendererObject.spineData.findAnimation(\n sourceAnimationName\n );\n return animation ? animation.duration : 0;\n }\n\n getAnimationElapsedTime(): number {\n if (!isSpine(this._rendererObject)) {\n return 0;\n }\n const tracks = this._rendererObject.state.tracks;\n if (tracks.length === 0) {\n return 0;\n }\n // This should be fine because only 1 track is used.\n const track = tracks[0];\n // @ts-ignore TrackEntry.getAnimationTime is not exposed.\n return track.getAnimationTime();\n }\n\n setAnimationElapsedTime(time: number): void {\n if (!isSpine(this._rendererObject)) {\n return;\n }\n const tracks = this._rendererObject.state.tracks;\n if (tracks.length === 0) {\n return;\n }\n const track = tracks[0];\n track.trackTime = time;\n }\n\n isAnimationComplete(): boolean {\n return this._isAnimationComplete;\n }\n\n getPointAttachmentPosition(\n attachmentName: string,\n slotName?: string\n ): pixi_spine.Vector2 {\n if (!slotName) {\n slotName = attachmentName;\n }\n if (!isSpine(this._rendererObject)) {\n return new pixi_spine.Vector2(\n this._rendererObject.x,\n this._rendererObject.y\n );\n }\n const slot = this._rendererObject.skeleton.findSlot(slotName);\n if (!slot) {\n throw new Error(\n `Unable to find ${slotName} slot name for ${attachmentName} point attachment.`\n );\n }\n const attachment = this._rendererObject.skeleton.getAttachmentByName(\n slotName,\n attachmentName\n );\n if (!isPointAttachment(attachment)) {\n throw new Error(\n `Unable to find ${attachmentName} point attachment with ${slotName} slot name.`\n );\n }\n\n return new PIXI.Matrix()\n .rotate(this._rendererObject.rotation)\n .scale(this._rendererObject.scale.x, this._rendererObject.scale.y)\n .translate(this._rendererObject.x, this._rendererObject.y)\n .apply(\n attachment.computeWorldPosition(slot.bone, new pixi_spine.Vector2())\n );\n }\n\n private constructRendererObject(): pixi_spine.Spine | PIXI.Container {\n const game = this.instanceContainer.getGame();\n const spineManager = game.getSpineManager();\n\n if (\n !spineManager ||\n !spineManager.isSpineLoaded(this._object.spineResourceName)\n ) {\n return new PIXI.Container();\n }\n\n return new pixi_spine.Spine(\n spineManager.getSpine(this._object.spineResourceName)!\n );\n }\n }\n export const SpineRuntimeObjectRenderer = SpineRuntimeObjectPixiRenderer;\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAU,AAAC,GACf,YAAe,YAAW,MAYtB,EAAoB,AACxB,GAEA,CAAC,CAAC,GAAc,EAAW,OAAS,WAAW,eAAe,MAEzD,O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,CAAC,EAAQ,KAAK,iBAChB,MAAO,IAAI,YAAW,QACpB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GAGzB,KAAM,GAAO,KAAK,gBAAgB,SAAS,SAAS,GACpD,GAAI,CAAC,EACH,KAAM,IAAI,OACR,kBAAkB,mBAA0B,uBAGhD,KAAM,GAAa,KAAK,gBAAgB,SAAS,oBAC/C,EACA,GAEF,GAAI,CAAC,EAAkB,GACrB,KAAM,IAAI,OACR,kBAAkB,2BAAwC,gBAI9D,MAAO,IAAI,MAAK,SACb,OAAO,KAAK,gBAAgB,UAC5B,MAAM,KAAK,gBAAgB,MAAM,EAAG,KAAK,gBAAgB,MAAM,GAC/D,UAAU,KAAK,gBAAgB,EAAG,KAAK,gBAAgB,GACvD,MACC,EAAW,qBAAqB,EAAK,KAAM,GAAI,YAAW,UAIxD,yBAA6D,CAEnE,KAAM,GAAe,AADR,KAAK,kBAAkB,UACV,kBAE1B,MACE,CAAC,GACD,CAAC,EAAa,cAAc,KAAK,QAAQ,mBAElC,GAAI,MAAK,UAGX,GAAI,YAAW,MACpB,EAAa,SAAS,KAAK,QAAQ,qBAtOlC,EAAM,iCA0OA,6BAA6B,IA7PlC",
4
+ "sourcesContent": ["namespace gdjs {\n const isSpine = (obj: any): obj is pixi_spine.Spine =>\n obj instanceof pixi_spine.Spine;\n\n // See https://github.com/pixijs/spine/issues/562\n // IPointAttachment is not declared and exported but its implementation does exist and it is used in runtime\n interface IPointAttachment extends pixi_spine.IVertexAttachment {\n computeWorldPosition(\n bone: pixi_spine.IBone,\n point: pixi_spine.Vector2\n ): pixi_spine.Vector2;\n computeWorldRotation(bone: pixi_spine.IBone): number;\n }\n\n const isPointAttachment = (\n attachment: pixi_spine.IAttachment\n ): attachment is IPointAttachment =>\n !!attachment && attachment.type === pixi_spine.AttachmentType.Point;\n\n export class SpineRuntimeObjectPixiRenderer {\n private _object: gdjs.SpineRuntimeObject;\n private _rendererObject: pixi_spine.Spine | PIXI.Container;\n private _isAnimationComplete = true;\n\n /**\n * @param runtimeObject The object to render\n * @param instanceContainer The container in which the object is\n */\n constructor(\n runtimeObject: gdjs.SpineRuntimeObject,\n private instanceContainer: gdjs.RuntimeInstanceContainer\n ) {\n this._object = runtimeObject;\n this._rendererObject = this.constructRendererObject();\n if (isSpine(this._rendererObject)) {\n this._rendererObject.autoUpdate = false;\n }\n\n this.updatePosition();\n this.updateAngle();\n this.updateOpacity();\n this.updateScale();\n\n instanceContainer\n .getLayer('')\n .getRenderer()\n .addRendererObject(this._rendererObject, runtimeObject.getZOrder());\n }\n\n updateAnimation(timeDelta: float) {\n if (!isSpine(this._rendererObject)) {\n return;\n }\n this._rendererObject.update(timeDelta);\n }\n\n getRendererObject(): pixi_spine.Spine | PIXI.Container {\n return this._rendererObject;\n }\n\n getOriginOffset(): PIXI.Point {\n if (!isSpine(this._rendererObject)) return new PIXI.Point(0, 0);\n\n const localBounds = this._rendererObject.getLocalBounds(undefined, true);\n\n return new PIXI.Point(\n localBounds.x * this._rendererObject.scale.x,\n localBounds.y * this._rendererObject.scale.y\n );\n }\n\n onDestroy(): void {\n this._rendererObject.destroy();\n }\n\n updateScale(): void {\n const scaleX = Math.max(\n this._object._originalScale * this._object.getScaleX(),\n 0\n );\n const scaleY = Math.max(\n this._object._originalScale * this._object.getScaleY(),\n 0\n );\n this._rendererObject.scale.x = this._object.isFlippedX()\n ? -scaleX\n : scaleX;\n this._rendererObject.scale.y = this._object.isFlippedY()\n ? -scaleY\n : scaleY;\n }\n\n updatePosition(): void {\n this._rendererObject.position.x = this._object.x;\n this._rendererObject.position.y = this._object.y;\n }\n\n updateAngle(): void {\n this._rendererObject.rotation = gdjs.toRad(this._object.angle);\n }\n\n updateOpacity(): void {\n this._rendererObject.alpha = this._object.getOpacity() / 255;\n }\n\n getWidth(): float {\n return this._rendererObject.width;\n }\n\n getHeight(): float {\n return this._rendererObject.height;\n }\n\n setWidth(width: float): void {\n this._rendererObject.width = width;\n }\n\n setHeight(height: float): void {\n this._rendererObject.height = height;\n }\n\n getUnscaledWidth(): float {\n return Math.abs(\n (this._rendererObject.width * this._object._originalScale) /\n this._rendererObject.scale.x\n );\n }\n\n getUnscaledHeight(): float {\n return Math.abs(\n (this._rendererObject.height * this._object._originalScale) /\n this._rendererObject.scale.y\n );\n }\n\n setMixing(from: string, to: string, duration: number): void {\n if (!isSpine(this._rendererObject)) return;\n\n this._rendererObject.stateData.setMix(from, to, duration);\n }\n\n setAnimation(animation: string, loop: boolean): void {\n if (isSpine(this._rendererObject)) {\n const onCompleteListener: pixi_spine.IAnimationStateListener = {\n complete: () => {\n this._isAnimationComplete = true;\n (this._rendererObject as pixi_spine.Spine).state.removeListener(\n onCompleteListener\n );\n },\n };\n\n this._isAnimationComplete = false;\n this._rendererObject.state.addListener(onCompleteListener);\n this._rendererObject.state.setAnimation(0, animation, loop);\n this._rendererObject.update(0);\n }\n }\n\n getAnimationDuration(sourceAnimationName: string) {\n if (!isSpine(this._rendererObject)) {\n return 0;\n }\n const animation =\n this._rendererObject.spineData.findAnimation(sourceAnimationName);\n return animation ? animation.duration : 0;\n }\n\n getAnimationElapsedTime(): number {\n if (!isSpine(this._rendererObject)) {\n return 0;\n }\n const tracks = this._rendererObject.state.tracks;\n if (tracks.length === 0) {\n return 0;\n }\n // This should be fine because only 1 track is used.\n const track = tracks[0];\n // @ts-ignore TrackEntry.getAnimationTime is not exposed.\n return track.getAnimationTime();\n }\n\n setAnimationElapsedTime(time: number): void {\n if (!isSpine(this._rendererObject)) {\n return;\n }\n const tracks = this._rendererObject.state.tracks;\n if (tracks.length === 0) {\n return;\n }\n const track = tracks[0];\n track.trackTime = time;\n }\n\n isAnimationComplete(): boolean {\n return this._isAnimationComplete;\n }\n\n getPointAttachmentPosition(\n attachmentName: string,\n slotName?: string\n ): pixi_spine.Vector2 {\n if (!slotName) {\n slotName = attachmentName;\n }\n if (!isSpine(this._rendererObject)) {\n return new pixi_spine.Vector2(\n this._rendererObject.x,\n this._rendererObject.y\n );\n }\n const slot = this._rendererObject.skeleton.findSlot(slotName);\n if (!slot) {\n throw new Error(\n `Unable to find ${slotName} slot name for ${attachmentName} point attachment.`\n );\n }\n const attachment = this._rendererObject.skeleton.getAttachmentByName(\n slotName,\n attachmentName\n );\n if (!isPointAttachment(attachment)) {\n throw new Error(\n `Unable to find ${attachmentName} point attachment with ${slotName} slot name.`\n );\n }\n\n return new PIXI.Matrix()\n .rotate(this._rendererObject.rotation)\n .scale(this._rendererObject.scale.x, this._rendererObject.scale.y)\n .translate(this._rendererObject.x, this._rendererObject.y)\n .apply(\n attachment.computeWorldPosition(slot.bone, new pixi_spine.Vector2())\n );\n }\n\n private constructRendererObject(): pixi_spine.Spine | PIXI.Container {\n const game = this.instanceContainer.getGame();\n const spineManager = game.getSpineManager();\n\n if (\n !spineManager ||\n !spineManager.isSpineLoaded(this._object.spineResourceName)\n ) {\n return new PIXI.Container();\n }\n\n return new pixi_spine.Spine(\n spineManager.getSpine(this._object.spineResourceName)!\n );\n }\n }\n export const SpineRuntimeObjectRenderer = SpineRuntimeObjectPixiRenderer;\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAU,AAAC,GACf,YAAe,YAAW,MAYtB,EAAoB,AACxB,GAEA,CAAC,CAAC,GAAc,EAAW,OAAS,WAAW,eAAe,MAEzD,OAAqC,CAS1C,YACE,EACQ,EACR,CADQ,yBARF,0BAAuB,GAU7B,KAAK,QAAU,EACf,KAAK,gBAAkB,KAAK,0BACxB,EAAQ,KAAK,kBACf,MAAK,gBAAgB,WAAa,IAGpC,KAAK,iBACL,KAAK,cACL,KAAK,gBACL,KAAK,cAEL,EACG,SAAS,IACT,cACA,kBAAkB,KAAK,gBAAiB,EAAc,aAG3D,gBAAgB,EAAkB,CAChC,AAAI,CAAC,EAAQ,KAAK,kBAGlB,KAAK,gBAAgB,OAAO,GAG9B,mBAAuD,CACrD,MAAO,MAAK,gBAGd,iBAA8B,CAC5B,GAAI,CAAC,EAAQ,K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