gdcore-tools 2.0.0-beta6 → 2.0.0-beta8

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 (139) hide show
  1. package/dist/Runtime/Cordova/config.xml +4 -0
  2. package/dist/Runtime/Cordova/package.json +12 -20
  3. package/dist/Runtime/CustomRuntimeObject.js +1 -1
  4. package/dist/Runtime/CustomRuntimeObject.js.map +2 -2
  5. package/dist/Runtime/CustomRuntimeObjectInstanceContainer.js +1 -1
  6. package/dist/Runtime/CustomRuntimeObjectInstanceContainer.js.map +2 -2
  7. package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js +1 -1
  8. package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js.map +2 -2
  9. package/dist/Runtime/Extensions/3D/AmbientLight.js +1 -1
  10. package/dist/Runtime/Extensions/3D/AmbientLight.js.map +2 -2
  11. package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js +1 -1
  12. package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js.map +2 -2
  13. package/dist/Runtime/Extensions/3D/DirectionalLight.js +1 -1
  14. package/dist/Runtime/Extensions/3D/DirectionalLight.js.map +2 -2
  15. package/dist/Runtime/Extensions/3D/ExponentialFog.js +1 -1
  16. package/dist/Runtime/Extensions/3D/ExponentialFog.js.map +2 -2
  17. package/dist/Runtime/Extensions/3D/HemisphereLight.js +1 -1
  18. package/dist/Runtime/Extensions/3D/HemisphereLight.js.map +2 -2
  19. package/dist/Runtime/Extensions/3D/JsExtension.js +419 -228
  20. package/dist/Runtime/Extensions/3D/LinearFog.js +1 -1
  21. package/dist/Runtime/Extensions/3D/LinearFog.js.map +2 -2
  22. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js +1 -1
  23. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js.map +2 -2
  24. package/dist/Runtime/Extensions/AdvancedWindow/electron-advancedwindowtools.js +1 -1
  25. package/dist/Runtime/Extensions/AdvancedWindow/electron-advancedwindowtools.js.map +2 -2
  26. package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js +1 -1
  27. package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js.map +2 -2
  28. package/dist/Runtime/Extensions/BBText/JsExtension.js +45 -42
  29. package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js +1 -1
  30. package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js.map +2 -2
  31. package/dist/Runtime/Extensions/BitmapText/JsExtension.js +40 -49
  32. package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js +1 -1
  33. package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js.map +2 -2
  34. package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js +1 -1
  35. package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js.map +2 -2
  36. package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js +1 -1
  37. package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js.map +2 -2
  38. package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js +1 -1
  39. package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js.map +2 -2
  40. package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js +1 -1
  41. package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js.map +2 -2
  42. package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js +1 -1
  43. package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js.map +2 -2
  44. package/dist/Runtime/Extensions/ExampleJsExtension/JsExtension.js +18 -21
  45. package/dist/Runtime/Extensions/Firebase/B_firebasetools/C_firebasetools.js +1 -1
  46. package/dist/Runtime/Extensions/Firebase/B_firebasetools/C_firebasetools.js.map +2 -2
  47. package/dist/Runtime/Extensions/JsExtensionTypes.d.ts +8 -2
  48. package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js +1 -1
  49. package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js.map +2 -2
  50. package/dist/Runtime/Extensions/Lighting/JsExtension.js +50 -38
  51. package/dist/Runtime/Extensions/Lighting/lightruntimeobject-pixi-renderer.js +1 -1
  52. package/dist/Runtime/Extensions/Lighting/lightruntimeobject-pixi-renderer.js.map +2 -2
  53. package/dist/Runtime/Extensions/Multiplayer/JsExtension.js +15 -0
  54. package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js +1 -1
  55. package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js.map +2 -2
  56. package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js.map +2 -2
  57. package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js +1 -1
  58. package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js.map +2 -2
  59. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js +1 -1
  60. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js.map +2 -2
  61. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js +1 -1
  62. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js.map +2 -2
  63. package/dist/Runtime/Extensions/Physics2Behavior/JsExtension.js +76 -24
  64. package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js +1 -1
  65. package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
  66. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js +1 -1
  67. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js.map +2 -2
  68. package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js +1 -1
  69. package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js.map +2 -2
  70. package/dist/Runtime/Extensions/Spine/JsExtension.js +45 -36
  71. package/dist/Runtime/Extensions/Spine/spineruntimeobject.js +1 -1
  72. package/dist/Runtime/Extensions/Spine/spineruntimeobject.js.map +2 -2
  73. package/dist/Runtime/Extensions/TextInput/JsExtension.js +52 -55
  74. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js +1 -1
  75. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js.map +2 -2
  76. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js +1 -1
  77. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js.map +2 -2
  78. package/dist/Runtime/Extensions/TextObject/textruntimeobject-pixi-renderer.js +1 -1
  79. package/dist/Runtime/Extensions/TextObject/textruntimeobject-pixi-renderer.js.map +2 -2
  80. package/dist/Runtime/Extensions/TextObject/textruntimeobject.js +1 -1
  81. package/dist/Runtime/Extensions/TextObject/textruntimeobject.js.map +2 -2
  82. package/dist/Runtime/Extensions/TileMap/JsExtension.js +430 -261
  83. package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js +1 -1
  84. package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js.map +2 -2
  85. package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js +1 -1
  86. package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js.map +2 -2
  87. package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.js +1 -1
  88. package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.js.map +1 -1
  89. package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts.map +1 -1
  90. package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapPixiHelper.d.ts +1 -0
  91. package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapPixiHelper.d.ts.map +1 -1
  92. package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js +1 -1
  93. package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js.map +2 -2
  94. package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js +1 -1
  95. package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js.map +2 -2
  96. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js +1 -1
  97. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js.map +2 -2
  98. package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js +1 -1
  99. package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js.map +2 -2
  100. package/dist/Runtime/Extensions/Video/JsExtension.js +35 -44
  101. package/dist/Runtime/Extensions/Video/videoruntimeobject.js +1 -1
  102. package/dist/Runtime/Extensions/Video/videoruntimeobject.js.map +2 -2
  103. package/dist/Runtime/ResourceLoader.js +1 -1
  104. package/dist/Runtime/ResourceLoader.js.map +2 -2
  105. package/dist/Runtime/RuntimeInstanceContainer.js.map +2 -2
  106. package/dist/Runtime/debugger-client/hot-reloader.js +2 -2
  107. package/dist/Runtime/debugger-client/hot-reloader.js.map +2 -2
  108. package/dist/Runtime/events-tools/inputtools.js +1 -1
  109. package/dist/Runtime/events-tools/inputtools.js.map +2 -2
  110. package/dist/Runtime/events-tools/objecttools.js +1 -1
  111. package/dist/Runtime/events-tools/objecttools.js.map +2 -2
  112. package/dist/Runtime/gd.js +1 -1
  113. package/dist/Runtime/gd.js.map +2 -2
  114. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js +1 -1
  115. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js.map +2 -2
  116. package/dist/Runtime/inputmanager.js +1 -1
  117. package/dist/Runtime/inputmanager.js.map +2 -2
  118. package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js +1 -1
  119. package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js.map +2 -2
  120. package/dist/Runtime/pixi-renderers/pixi-filters-tools.js +1 -1
  121. package/dist/Runtime/pixi-renderers/pixi-filters-tools.js.map +2 -2
  122. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js +1 -1
  123. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js.map +2 -2
  124. package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js +1 -1
  125. package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js.map +2 -2
  126. package/dist/Runtime/runtimegame.js +1 -1
  127. package/dist/Runtime/runtimegame.js.map +1 -1
  128. package/dist/Runtime/runtimeobject.js +1 -1
  129. package/dist/Runtime/runtimeobject.js.map +2 -2
  130. package/dist/Runtime/spriteruntimeobject.js +1 -1
  131. package/dist/Runtime/spriteruntimeobject.js.map +2 -2
  132. package/dist/Runtime/types/project-data.d.ts +5 -0
  133. package/dist/lib/libGD.cjs +1 -1
  134. package/dist/lib/libGD.d.cts +5 -0
  135. package/dist/lib/libGD.wasm +0 -0
  136. package/dist/loaders.cjs +3 -1
  137. package/dist/loaders.d.cts +2 -0
  138. package/gd.d.ts +74 -30
  139. package/package.json +3 -3
@@ -1,2 +1,2 @@
1
- var gdjs;(function(t){t.PixiFiltersTools.registerFilterCreator("Scene3D::LinearFog",new class{makeFilter(o,n){return typeof THREE=="undefined"?new t.PixiFiltersTools.EmptyFilter:new class{constructor(){this.fog=new THREE.Fog(16777215)}isEnabled(e){const r=e.get3DRendererObject();return r?r.fog===this.fog:!1}setEnabled(e,r){return r?this.applyEffect(e):this.removeEffect(e)}applyEffect(e){const r=e.get3DRendererObject();return!r||r.fog===void 0?!1:(r.fog=this.fog,!0)}removeEffect(e){const r=e.get3DRendererObject();return!r||r.fog===void 0?!1:(r.fog=null,!0)}updatePreRender(e){}updateDoubleParameter(e,r){e==="near"?this.fog.near=r:e==="far"&&(this.fog.far=r)}getDoubleParameter(e){return e==="near"?this.fog.near:e==="far"?this.fog.far:0}updateStringParameter(e,r){e==="color"&&(this.fog.color=new THREE.Color(t.PixiFiltersTools.rgbOrHexToHexNumber(r)))}updateColorParameter(e,r){e==="color"&&this.fog.color.setHex(r)}getColorParameter(e){return e==="color"?this.fog.color.getHex():0}updateBooleanParameter(e,r){}getNetworkSyncData(){return{n:this.fog.near,f:this.fog.far,c:this.fog.color.getHex()}}updateFromNetworkSyncData(e){this.fog.near=e.n,this.fog.far=e.f,this.fog.color.setHex(e.c)}}}})})(gdjs||(gdjs={}));
1
+ var gdjs;(function(t){t.PixiFiltersTools.registerFilterCreator("Scene3D::LinearFog",new class{makeFilter(n,o){return typeof THREE=="undefined"?new t.PixiFiltersTools.EmptyFilter:new class{constructor(){this.fog=new THREE.Fog(16777215)}isEnabled(e){const r=e.get3DRendererObject();return r?r.fog===this.fog:!1}setEnabled(e,r){return r?this.applyEffect(e):this.removeEffect(e)}applyEffect(e){const r=e.get3DRendererObject();return!r||r.fog===void 0?!1:(r.fog=this.fog,!0)}removeEffect(e){const r=e.get3DRendererObject();return!r||r.fog===void 0?!1:(r.fog=null,!0)}updatePreRender(e){}updateDoubleParameter(e,r){e==="near"?this.fog.near=r:e==="far"&&(this.fog.far=r)}getDoubleParameter(e){return e==="near"?this.fog.near:e==="far"?this.fog.far:0}updateStringParameter(e,r){e==="color"&&(this.fog.color=new THREE.Color(t.rgbOrHexStringToNumber(r)))}updateColorParameter(e,r){e==="color"&&this.fog.color.setHex(r)}getColorParameter(e){return e==="color"?this.fog.color.getHex():0}updateBooleanParameter(e,r){}getNetworkSyncData(){return{n:this.fog.near,f:this.fog.far,c:this.fog.color.getHex()}}updateFromNetworkSyncData(e){this.fog.near=e.n,this.fog.far=e.f,this.fog.color.setHex(e.c)}}}})})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=LinearFog.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/3D/LinearFog.ts"],
4
- "sourcesContent": ["namespace gdjs {\n interface LinearFogFilterNetworkSyncData {\n n: number;\n f: number;\n c: number;\n }\n gdjs.PixiFiltersTools.registerFilterCreator(\n 'Scene3D::LinearFog',\n new (class implements gdjs.PixiFiltersTools.FilterCreator {\n makeFilter(\n target: EffectsTarget,\n effectData: EffectData\n ): gdjs.PixiFiltersTools.Filter {\n if (typeof THREE === 'undefined') {\n return new gdjs.PixiFiltersTools.EmptyFilter();\n }\n return new (class implements gdjs.PixiFiltersTools.Filter {\n fog: THREE.Fog;\n\n constructor() {\n this.fog = new THREE.Fog(0xffffff);\n }\n\n isEnabled(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n return scene ? scene.fog === this.fog : false;\n }\n setEnabled(target: EffectsTarget, enabled: boolean): boolean {\n if (enabled) {\n return this.applyEffect(target);\n } else {\n return this.removeEffect(target);\n }\n }\n applyEffect(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n if (!scene || scene.fog === undefined) {\n return false;\n }\n scene.fog = this.fog;\n return true;\n }\n removeEffect(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n if (!scene || scene.fog === undefined) {\n return false;\n }\n scene.fog = null;\n return true;\n }\n updatePreRender(target: gdjs.EffectsTarget): any {}\n updateDoubleParameter(parameterName: string, value: number): void {\n if (parameterName === 'near') {\n this.fog.near = value;\n } else if (parameterName === 'far') {\n this.fog.far = value;\n }\n }\n getDoubleParameter(parameterName: string): number {\n if (parameterName === 'near') {\n return this.fog.near;\n } else if (parameterName === 'far') {\n return this.fog.far;\n }\n return 0;\n }\n updateStringParameter(parameterName: string, value: string): void {\n if (parameterName === 'color') {\n this.fog.color = new THREE.Color(\n gdjs.PixiFiltersTools.rgbOrHexToHexNumber(value)\n );\n }\n }\n updateColorParameter(parameterName: string, value: number): void {\n if (parameterName === 'color') {\n this.fog.color.setHex(value);\n }\n }\n getColorParameter(parameterName: string): number {\n if (parameterName === 'color') {\n return this.fog.color.getHex();\n }\n return 0;\n }\n updateBooleanParameter(parameterName: string, value: boolean): void {}\n getNetworkSyncData(): LinearFogFilterNetworkSyncData {\n return {\n n: this.fog.near,\n f: this.fog.far,\n c: this.fog.color.getHex(),\n };\n }\n updateFromNetworkSyncData(\n data: LinearFogFilterNetworkSyncData\n ): void {\n this.fog.near = data.n;\n this.fog.far = data.f;\n this.fog.color.setHex(data.c);\n }\n })();\n }\n })()\n );\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAME,EAAK,iBAAiB,sBACpB,qBACA,GAAK,MAAqD,CACxD,WACE,EACA,EAC8B,CAC9B,MAAI,OAAO,QAAU,YACZ,GAAI,GAAK,iBAAiB,YAE5B,GAAK,MAA8C,CAGxD,aAAc,CACZ,KAAK,IAAM,GAAI,OAAM,IAAI,UAG3B,UAAU,EAAgC,CACxC,KAAM,GAAQ,EAAO,sBAIrB,MAAO,GAAQ,EAAM,MAAQ,KAAK,IAAM,GAE1C,WAAW,EAAuB,EAA2B,CAC3D,MAAI,GACK,KAAK,YAAY,GAEjB,KAAK,aAAa,GAG7B,YAAY,EAAgC,CAC1C,KAAM,GAAQ,EAAO,sBAIrB,MAAI,CAAC,GAAS,EAAM,MAAQ,OACnB,GAET,GAAM,IAAM,KAAK,IACV,IAET,aAAa,EAAgC,CAC3C,KAAM,GAAQ,EAAO,sBAIrB,MAAI,CAAC,GAAS,EAAM,MAAQ,OACnB,GAET,GAAM,IAAM,KACL,IAET,gBAAgB,EAAiC,EACjD,sBAAsB,EAAuB,EAAqB,CAChE,AAAI,IAAkB,OACpB,KAAK,IAAI,KAAO,EACP,IAAkB,OAC3B,MAAK,IAAI,IAAM,GAGnB,mBAAmB,EAA+B,CAChD,MAAI,KAAkB,OACb,KAAK,IAAI,KACP,IAAkB,MACpB,KAAK,IAAI,IAEX,EAET,sBAAsB,EAAuB,EAAqB,CAChE,AAAI,IAAkB,SACpB,MAAK,IAAI,MAAQ,GAAI,OAAM,MACzB,EAAK,iBAAiB,oBAAoB,KAIhD,qBAAqB,EAAuB,EAAqB,CAC/D,AAAI,IAAkB,SACpB,KAAK,IAAI,MAAM,OAAO,GAG1B,kBAAkB,EAA+B,CAC/C,MAAI,KAAkB,QACb,KAAK,IAAI,MAAM,SAEjB,EAET,uBAAuB,EAAuB,EAAsB,EACpE,oBAAqD,CACnD,MAAO,CACL,EAAG,KAAK,IAAI,KACZ,EAAG,KAAK,IAAI,IACZ,EAAG,KAAK,IAAI,MAAM,UAGtB,0BACE,EACM,CACN,KAAK,IAAI,KAAO,EAAK,EACrB,KAAK,IAAI,IAAM,EAAK,EACpB,KAAK,IAAI,MAAM,OAAO,EAAK,UA1G7B",
4
+ "sourcesContent": ["namespace gdjs {\n interface LinearFogFilterNetworkSyncData {\n n: number;\n f: number;\n c: number;\n }\n gdjs.PixiFiltersTools.registerFilterCreator(\n 'Scene3D::LinearFog',\n new (class implements gdjs.PixiFiltersTools.FilterCreator {\n makeFilter(\n target: EffectsTarget,\n effectData: EffectData\n ): gdjs.PixiFiltersTools.Filter {\n if (typeof THREE === 'undefined') {\n return new gdjs.PixiFiltersTools.EmptyFilter();\n }\n return new (class implements gdjs.PixiFiltersTools.Filter {\n fog: THREE.Fog;\n\n constructor() {\n this.fog = new THREE.Fog(0xffffff);\n }\n\n isEnabled(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n return scene ? scene.fog === this.fog : false;\n }\n setEnabled(target: EffectsTarget, enabled: boolean): boolean {\n if (enabled) {\n return this.applyEffect(target);\n } else {\n return this.removeEffect(target);\n }\n }\n applyEffect(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n if (!scene || scene.fog === undefined) {\n return false;\n }\n scene.fog = this.fog;\n return true;\n }\n removeEffect(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n if (!scene || scene.fog === undefined) {\n return false;\n }\n scene.fog = null;\n return true;\n }\n updatePreRender(target: gdjs.EffectsTarget): any {}\n updateDoubleParameter(parameterName: string, value: number): void {\n if (parameterName === 'near') {\n this.fog.near = value;\n } else if (parameterName === 'far') {\n this.fog.far = value;\n }\n }\n getDoubleParameter(parameterName: string): number {\n if (parameterName === 'near') {\n return this.fog.near;\n } else if (parameterName === 'far') {\n return this.fog.far;\n }\n return 0;\n }\n updateStringParameter(parameterName: string, value: string): void {\n if (parameterName === 'color') {\n this.fog.color = new THREE.Color(\n gdjs.rgbOrHexStringToNumber(value)\n );\n }\n }\n updateColorParameter(parameterName: string, value: number): void {\n if (parameterName === 'color') {\n this.fog.color.setHex(value);\n }\n }\n getColorParameter(parameterName: string): number {\n if (parameterName === 'color') {\n return this.fog.color.getHex();\n }\n return 0;\n }\n updateBooleanParameter(parameterName: string, value: boolean): void {}\n getNetworkSyncData(): LinearFogFilterNetworkSyncData {\n return {\n n: this.fog.near,\n f: this.fog.far,\n c: this.fog.color.getHex(),\n };\n }\n updateFromNetworkSyncData(\n data: LinearFogFilterNetworkSyncData\n ): void {\n this.fog.near = data.n;\n this.fog.far = data.f;\n this.fog.color.setHex(data.c);\n }\n })();\n }\n })()\n );\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAME,EAAK,iBAAiB,sBACpB,qBACA,GAAK,MAAqD,CACxD,WACE,EACA,EAC8B,CAC9B,MAAI,OAAO,QAAU,YACZ,GAAI,GAAK,iBAAiB,YAE5B,GAAK,MAA8C,CAGxD,aAAc,CACZ,KAAK,IAAM,GAAI,OAAM,IAAI,UAG3B,UAAU,EAAgC,CACxC,KAAM,GAAQ,EAAO,sBAIrB,MAAO,GAAQ,EAAM,MAAQ,KAAK,IAAM,GAE1C,WAAW,EAAuB,EAA2B,CAC3D,MAAI,GACK,KAAK,YAAY,GAEjB,KAAK,aAAa,GAG7B,YAAY,EAAgC,CAC1C,KAAM,GAAQ,EAAO,sBAIrB,MAAI,CAAC,GAAS,EAAM,MAAQ,OACnB,GAET,GAAM,IAAM,KAAK,IACV,IAET,aAAa,EAAgC,CAC3C,KAAM,GAAQ,EAAO,sBAIrB,MAAI,CAAC,GAAS,EAAM,MAAQ,OACnB,GAET,GAAM,IAAM,KACL,IAET,gBAAgB,EAAiC,EACjD,sBAAsB,EAAuB,EAAqB,CAChE,AAAI,IAAkB,OACpB,KAAK,IAAI,KAAO,EACP,IAAkB,OAC3B,MAAK,IAAI,IAAM,GAGnB,mBAAmB,EAA+B,CAChD,MAAI,KAAkB,OACb,KAAK,IAAI,KACP,IAAkB,MACpB,KAAK,IAAI,IAEX,EAET,sBAAsB,EAAuB,EAAqB,CAChE,AAAI,IAAkB,SACpB,MAAK,IAAI,MAAQ,GAAI,OAAM,MACzB,EAAK,uBAAuB,KAIlC,qBAAqB,EAAuB,EAAqB,CAC/D,AAAI,IAAkB,SACpB,KAAK,IAAI,MAAM,OAAO,GAG1B,kBAAkB,EAA+B,CAC/C,MAAI,KAAkB,QACb,KAAK,IAAI,MAAM,SAEjB,EAET,uBAAuB,EAAuB,EAAsB,EACpE,oBAAqD,CACnD,MAAO,CACL,EAAG,KAAK,IAAI,KACZ,EAAG,KAAK,IAAI,IACZ,EAAG,KAAK,IAAI,MAAM,UAGtB,0BACE,EACM,CACN,KAAK,IAAI,KAAO,EAAK,EACrB,KAAK,IAAI,IAAM,EAAK,EACpB,KAAK,IAAI,MAAM,OAAO,EAAK,UA1G7B",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var gdjs;(function(n){const o=r=>{switch(r){case"ModelOrigin":return null;case"ObjectCenter":return[.5,.5,.5];case"BottomCenterZ":return[.5,.5,0];case"BottomCenterY":return[.5,1,.5];case"TopLeft":return[0,0,0];default:return null}};class s extends n.RuntimeObject3D{constructor(e,t){super(e,t);this._materialType=n.Model3DRuntimeObject.MaterialType.Basic;this._currentAnimationIndex=0;this._animationSpeedScale=1;this._animationPaused=!1;this._modelResourceName=t.content.modelResourceName,this._animations=t.content.animations,this._originPoint=o(t.content.originLocation),this._centerPoint=o(t.content.centerLocation),this._renderer=new n.Model3DRuntimeObjectRenderer(this,e),this._materialType=this._convertMaterialType(t.content.materialType),this.onModelChanged(t),this.onCreated()}onModelChanged(e){this._updateModel(e),this._animations.length>0&&this._renderer.playAnimation(this._animations[0].source,this._animations[0].loop)}updateFromObjectData(e,t){return super.updateFromObjectData(e,t),e.content.materialType!==t.content.materialType&&(this._materialType=this._convertMaterialType(t.content.materialType)),e.content.modelResourceName!==t.content.modelResourceName?this._reloadModel(t):(e.content.width!==t.content.width||e.content.height!==t.content.height||e.content.depth!==t.content.depth||e.content.rotationX!==t.content.rotationX||e.content.rotationY!==t.content.rotationY||e.content.rotationZ!==t.content.rotationZ||e.content.keepAspectRatio!==t.content.keepAspectRatio||e.content.materialType!==t.content.materialType)&&this._updateModel(t),e.content.originLocation!==t.content.originLocation&&(this._originPoint=o(t.content.originLocation)),e.content.centerLocation!==t.content.centerLocation&&(this._centerPoint=o(t.content.centerLocation)),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),mt:this._materialType,op:this._originPoint,cp:this._centerPoint,anis:this._animations,ai:this._currentAnimationIndex,ass:this._animationSpeedScale,ap:this._animationPaused}}updateFromNetworkSyncData(e){super.updateFromNetworkSyncData(e),e.mt!==void 0&&(this._materialType=e.mt),e.op!==void 0&&(this._originPoint=e.op),e.cp!==void 0&&(this._centerPoint=e.cp),e.anis!==void 0&&(this._animations=e.anis),e.ai!==void 0&&this.setAnimationIndex(e.ai),e.ass!==void 0&&this.setAnimationSpeedScale(e.ass),e.ap!==void 0&&e.ap!==this.isAnimationPaused()&&(e.ap?this.pauseAnimation():this.resumeAnimation())}_reloadModel(e){this._modelResourceName=e.content.modelResourceName,this._renderer._reloadModel(this,this._runtimeScene),this.onModelChanged(e)}_updateModel(e){const t=e.content.rotationX||0,a=e.content.rotationY||0,d=e.content.rotationZ||0,i=e.content.keepAspectRatio;this._renderer._updateModel(t,a,d,this._getOriginalWidth(),this._getOriginalHeight(),this._getOriginalDepth(),i)}getRenderer(){return this._renderer}_convertMaterialType(e){return e==="KeepOriginal"?n.Model3DRuntimeObject.MaterialType.KeepOriginal:e==="StandardWithoutMetalness"?n.Model3DRuntimeObject.MaterialType.StandardWithoutMetalness:n.Model3DRuntimeObject.MaterialType.Basic}update(e){const t=this.getElapsedTime()/1e3;this._renderer.updateAnimation(t*this._animationSpeedScale)}getAnimationIndex(){return this._currentAnimationIndex}setAnimationIndex(e){if(e=e|0,e<this._animations.length&&this._currentAnimationIndex!==e&&e>=0){const t=this._animations[e];this._currentAnimationIndex=e,this._renderer.playAnimation(t.source,t.loop),this._animationPaused&&this._renderer.pauseAnimation()}}getAnimationName(){return this._currentAnimationIndex>=this._animations.length?"":this._animations[this._currentAnimationIndex].name}setAnimationName(e){if(!e)return;const t=this._animations.findIndex(a=>a.name===e);t>=0&&this.setAnimationIndex(t)}isCurrentAnimationName(e){return this.getAnimationName()===e}hasAnimationEnded(){return this._renderer.hasAnimationEnded()}isAnimationPaused(){return this._animationPaused}pauseAnimation(){this._animationPaused=!0,this._renderer.pauseAnimation()}resumeAnimation(){this._animationPaused=!1,this._renderer.resumeAnimation()}getAnimationSpeedScale(){return this._animationSpeedScale}setAnimationSpeedScale(e){this._animationSpeedScale=e}getAnimationElapsedTime(){return this._renderer.getAnimationElapsedTime()}setAnimationElapsedTime(e){this._renderer.setAnimationElapsedTime(e)}getAnimationDuration(){return this._renderer.getAnimationDuration(this._animations[this._currentAnimationIndex].source)}getCenterX(){const e=this._renderer.getCenterPoint();return this.getWidth()*e[0]}getCenterY(){const e=this._renderer.getCenterPoint();return this.getHeight()*e[1]}getCenterZ(){const e=this._renderer.getCenterPoint();return this.getDepth()*e[2]}getDrawableX(){const e=this._renderer.getOriginPoint();return this.getX()-this.getWidth()*e[0]}getDrawableY(){const e=this._renderer.getOriginPoint();return this.getY()-this.getHeight()*e[1]}getDrawableZ(){const e=this._renderer.getOriginPoint();return this.getZ()-this.getDepth()*e[2]}}n.Model3DRuntimeObject=s,function(e){let r;(function(i){i[i.Basic=0]="Basic",i[i.StandardWithoutMetalness=1]="StandardWithoutMetalness",i[i.KeepOriginal=2]="KeepOriginal"})(r=e.MaterialType||(e.MaterialType={}))}(s=n.Model3DRuntimeObject||(n.Model3DRuntimeObject={})),n.registerObject("Scene3D::Model3DObject",n.Model3DRuntimeObject)})(gdjs||(gdjs={}));
1
+ var gdjs;(function(n){const o=r=>{switch(r){case"ModelOrigin":return null;case"ObjectCenter":return[.5,.5,.5];case"BottomCenterZ":return[.5,.5,0];case"BottomCenterY":return[.5,1,.5];case"TopLeft":return[0,0,0];default:return null}};class s extends n.RuntimeObject3D{constructor(e,t){super(e,t);this._materialType=n.Model3DRuntimeObject.MaterialType.Basic;this._currentAnimationIndex=0;this._animationSpeedScale=1;this._animationPaused=!1;this._modelResourceName=t.content.modelResourceName,this._animations=t.content.animations,this._originPoint=o(t.content.originLocation),this._centerPoint=o(t.content.centerLocation),this._renderer=new n.Model3DRuntimeObjectRenderer(this,e),this._materialType=this._convertMaterialType(t.content.materialType),this.onModelChanged(t),this.onCreated()}onModelChanged(e){this._updateModel(e),this._animations.length>0&&this._renderer.playAnimation(this._animations[0].source,this._animations[0].loop)}updateFromObjectData(e,t){return super.updateFromObjectData(e,t),e.content.materialType!==t.content.materialType&&(this._materialType=this._convertMaterialType(t.content.materialType)),e.content.modelResourceName!==t.content.modelResourceName?this._reloadModel(t):(e.content.width!==t.content.width||e.content.height!==t.content.height||e.content.depth!==t.content.depth||e.content.rotationX!==t.content.rotationX||e.content.rotationY!==t.content.rotationY||e.content.rotationZ!==t.content.rotationZ||e.content.keepAspectRatio!==t.content.keepAspectRatio||e.content.materialType!==t.content.materialType)&&this._updateModel(t),e.content.originLocation!==t.content.originLocation&&(this._originPoint=o(t.content.originLocation)),e.content.centerLocation!==t.content.centerLocation&&(this._centerPoint=o(t.content.centerLocation)),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),mt:this._materialType,op:this._originPoint,cp:this._centerPoint,anis:this._animations,ai:this._currentAnimationIndex,ass:this._animationSpeedScale,ap:this._animationPaused}}updateFromNetworkSyncData(e){super.updateFromNetworkSyncData(e),e.mt!==void 0&&(this._materialType=e.mt),e.op!==void 0&&(this._originPoint=e.op),e.cp!==void 0&&(this._centerPoint=e.cp),e.anis!==void 0&&(this._animations=e.anis),e.ai!==void 0&&this.setAnimationIndex(e.ai),e.ass!==void 0&&this.setAnimationSpeedScale(e.ass),e.ap!==void 0&&e.ap!==this.isAnimationPaused()&&(e.ap?this.pauseAnimation():this.resumeAnimation())}_reloadModel(e){this._modelResourceName=e.content.modelResourceName,this._renderer._reloadModel(this,this._runtimeScene),this.onModelChanged(e)}_updateModel(e){const t=e.content.rotationX||0,a=e.content.rotationY||0,d=e.content.rotationZ||0,i=e.content.keepAspectRatio;this._renderer._updateModel(t,a,d,this._getOriginalWidth(),this._getOriginalHeight(),this._getOriginalDepth(),i)}getRenderer(){return this._renderer}_convertMaterialType(e){return e==="KeepOriginal"?n.Model3DRuntimeObject.MaterialType.KeepOriginal:e==="StandardWithoutMetalness"?n.Model3DRuntimeObject.MaterialType.StandardWithoutMetalness:n.Model3DRuntimeObject.MaterialType.Basic}update(e){const t=this.getElapsedTime()/1e3;this._renderer.updateAnimation(t*this._animationSpeedScale)}getAnimationIndex(){return this._currentAnimationIndex}setAnimationIndex(e){if(e=e|0,e<this._animations.length&&this._currentAnimationIndex!==e&&e>=0){const t=this._animations[e];this._currentAnimationIndex=e,this._renderer.playAnimation(t.source,t.loop),this._animationPaused&&this._renderer.pauseAnimation()}}getAnimationName(){return this._currentAnimationIndex>=this._animations.length?"":this._animations[this._currentAnimationIndex].name}setAnimationName(e){if(!e)return;const t=this._animations.findIndex(a=>a.name===e);t>=0&&this.setAnimationIndex(t)}isCurrentAnimationName(e){return this.getAnimationName()===e}hasAnimationEnded(){return this._renderer.hasAnimationEnded()}isAnimationPaused(){return this._animationPaused}pauseAnimation(){this._animationPaused=!0,this._renderer.pauseAnimation()}resumeAnimation(){this._animationPaused=!1,this._renderer.resumeAnimation()}getAnimationSpeedScale(){return this._animationSpeedScale}setAnimationSpeedScale(e){this._animationSpeedScale=e}getAnimationElapsedTime(){return this._renderer.getAnimationElapsedTime()}setAnimationElapsedTime(e){this._renderer.setAnimationElapsedTime(e),this._animationPaused||this._renderer.resumeAnimation()}getAnimationDuration(){return this._renderer.getAnimationDuration(this._animations[this._currentAnimationIndex].source)}getCenterX(){const e=this._renderer.getCenterPoint();return this.getWidth()*e[0]}getCenterY(){const e=this._renderer.getCenterPoint();return this.getHeight()*e[1]}getCenterZ(){const e=this._renderer.getCenterPoint();return this.getDepth()*e[2]}getDrawableX(){const e=this._renderer.getOriginPoint();return this.getX()-this.getWidth()*e[0]}getDrawableY(){const e=this._renderer.getOriginPoint();return this.getY()-this.getHeight()*e[1]}getDrawableZ(){const e=this._renderer.getOriginPoint();return this.getZ()-this.getDepth()*e[2]}}n.Model3DRuntimeObject=s,function(e){let r;(function(i){i[i.Basic=0]="Basic",i[i.StandardWithoutMetalness=1]="StandardWithoutMetalness",i[i.KeepOriginal=2]="KeepOriginal"})(r=e.MaterialType||(e.MaterialType={}))}(s=n.Model3DRuntimeObject||(n.Model3DRuntimeObject={})),n.registerObject("Scene3D::Model3DObject",n.Model3DRuntimeObject)})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=Model3DRuntimeObject.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/3D/Model3DRuntimeObject.ts"],
4
- "sourcesContent": ["namespace gdjs {\n type Model3DAnimation = { name: string; source: string; loop: boolean };\n\n type Model3DObjectNetworkSyncDataType = {\n mt: number;\n op: FloatPoint3D | null;\n cp: FloatPoint3D | null;\n anis: Model3DAnimation[];\n ai: integer;\n ass: float;\n ap: boolean;\n };\n\n type Model3DObjectNetworkSyncData = Object3DNetworkSyncData &\n Model3DObjectNetworkSyncDataType;\n\n /** Base parameters for {@link gdjs.Cube3DRuntimeObject} */\n export interface Model3DObjectData extends Object3DData {\n /** The base parameters of the Model3D object */\n content: Object3DDataContent & {\n modelResourceName: string;\n rotationX: number;\n rotationY: number;\n rotationZ: number;\n keepAspectRatio: boolean;\n materialType: 'Basic' | 'StandardWithoutMetalness' | 'KeepOriginal';\n originLocation:\n | 'ModelOrigin'\n | 'ObjectCenter'\n | 'BottomCenterZ'\n | 'BottomCenterY'\n | 'TopLeft';\n centerLocation:\n | 'ModelOrigin'\n | 'ObjectCenter'\n | 'BottomCenterZ'\n | 'BottomCenterY';\n animations: Model3DAnimation[];\n };\n }\n\n type FloatPoint3D = [float, float, float];\n\n const getPointForLocation = (location: string): FloatPoint3D | null => {\n switch (location) {\n case 'ModelOrigin':\n return null;\n case 'ObjectCenter':\n return [0.5, 0.5, 0.5];\n case 'BottomCenterZ':\n return [0.5, 0.5, 0];\n case 'BottomCenterY':\n return [0.5, 1, 0.5];\n case 'TopLeft':\n return [0, 0, 0];\n default:\n return null;\n }\n };\n\n /**\n * A 3D object which displays a 3D model.\n */\n export class Model3DRuntimeObject\n extends gdjs.RuntimeObject3D\n implements gdjs.Animatable {\n _renderer: gdjs.Model3DRuntimeObjectRenderer;\n\n _modelResourceName: string;\n _materialType: gdjs.Model3DRuntimeObject.MaterialType =\n gdjs.Model3DRuntimeObject.MaterialType.Basic;\n\n /**\n * The local point of the model that will be at the object position.\n *\n * Coordinates are between 0 and 1.\n *\n * Its value is `null` when the point is configured to `\"ModelOrigin\"`\n * because the model origin needs to be evaluated according to the object\n * configuration.\n * @see gdjs.Model3DRuntimeObject3DRenderer.getOriginPoint\n */\n _originPoint: FloatPoint3D | null;\n /**\n * The local point of the model that is used as rotation center.\n *\n * Coordinates are between 0 and 1.\n *\n * Its value is `null` when the point is configured to `\"ModelOrigin\"`\n * because the model origin needs to be evaluated according to the object\n * configuration.\n * @see gdjs.Model3DRuntimeObject3DRenderer.getCenterPoint\n */\n _centerPoint: FloatPoint3D | null;\n\n _animations: Model3DAnimation[];\n _currentAnimationIndex: integer = 0;\n _animationSpeedScale: float = 1;\n _animationPaused: boolean = false;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n objectData: Model3DObjectData\n ) {\n super(instanceContainer, objectData);\n this._modelResourceName = objectData.content.modelResourceName;\n this._animations = objectData.content.animations;\n this._originPoint = getPointForLocation(\n objectData.content.originLocation\n );\n this._centerPoint = getPointForLocation(\n objectData.content.centerLocation\n );\n this._renderer = new gdjs.Model3DRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n this._materialType = this._convertMaterialType(\n objectData.content.materialType\n );\n\n this.onModelChanged(objectData);\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n /**\n * To be called after the renderer loaded a Model resource:\n * - After the renderer was instantiated\n * - After reloading the model\n */\n private onModelChanged(objectData) {\n this._updateModel(objectData);\n if (this._animations.length > 0) {\n this._renderer.playAnimation(\n this._animations[0].source,\n this._animations[0].loop\n );\n }\n }\n\n updateFromObjectData(\n oldObjectData: Model3DObjectData,\n newObjectData: Model3DObjectData\n ): boolean {\n super.updateFromObjectData(oldObjectData, newObjectData);\n\n if (\n oldObjectData.content.materialType !==\n newObjectData.content.materialType\n ) {\n this._materialType = this._convertMaterialType(\n newObjectData.content.materialType\n );\n }\n if (\n oldObjectData.content.modelResourceName !==\n newObjectData.content.modelResourceName\n ) {\n this._reloadModel(newObjectData);\n } else if (\n oldObjectData.content.width !== newObjectData.content.width ||\n oldObjectData.content.height !== newObjectData.content.height ||\n oldObjectData.content.depth !== newObjectData.content.depth ||\n oldObjectData.content.rotationX !== newObjectData.content.rotationX ||\n oldObjectData.content.rotationY !== newObjectData.content.rotationY ||\n oldObjectData.content.rotationZ !== newObjectData.content.rotationZ ||\n oldObjectData.content.keepAspectRatio !==\n newObjectData.content.keepAspectRatio ||\n oldObjectData.content.materialType !==\n newObjectData.content.materialType\n ) {\n this._updateModel(newObjectData);\n }\n if (\n oldObjectData.content.originLocation !==\n newObjectData.content.originLocation\n ) {\n this._originPoint = getPointForLocation(\n newObjectData.content.originLocation\n );\n }\n if (\n oldObjectData.content.centerLocation !==\n newObjectData.content.centerLocation\n ) {\n this._centerPoint = getPointForLocation(\n newObjectData.content.centerLocation\n );\n }\n return true;\n }\n\n getNetworkSyncData(): Model3DObjectNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n mt: this._materialType,\n op: this._originPoint,\n cp: this._centerPoint,\n anis: this._animations,\n ai: this._currentAnimationIndex,\n ass: this._animationSpeedScale,\n ap: this._animationPaused,\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: Model3DObjectNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n if (networkSyncData.mt !== undefined) {\n this._materialType = networkSyncData.mt;\n }\n if (networkSyncData.op !== undefined) {\n this._originPoint = networkSyncData.op;\n }\n if (networkSyncData.cp !== undefined) {\n this._centerPoint = networkSyncData.cp;\n }\n if (networkSyncData.anis !== undefined) {\n this._animations = networkSyncData.anis;\n }\n if (networkSyncData.ai !== undefined) {\n this.setAnimationIndex(networkSyncData.ai);\n }\n if (networkSyncData.ass !== undefined) {\n this.setAnimationSpeedScale(networkSyncData.ass);\n }\n if (networkSyncData.ap !== undefined) {\n if (networkSyncData.ap !== this.isAnimationPaused()) {\n networkSyncData.ap ? this.pauseAnimation() : this.resumeAnimation();\n }\n }\n }\n\n _reloadModel(objectData: Model3DObjectData) {\n this._modelResourceName = objectData.content.modelResourceName;\n this._renderer._reloadModel(this, this._runtimeScene);\n this.onModelChanged(objectData);\n }\n\n _updateModel(objectData: Model3DObjectData) {\n const rotationX = objectData.content.rotationX || 0;\n const rotationY = objectData.content.rotationY || 0;\n const rotationZ = objectData.content.rotationZ || 0;\n const keepAspectRatio = objectData.content.keepAspectRatio;\n this._renderer._updateModel(\n rotationX,\n rotationY,\n rotationZ,\n this._getOriginalWidth(),\n this._getOriginalHeight(),\n this._getOriginalDepth(),\n keepAspectRatio\n );\n }\n\n getRenderer(): RuntimeObject3DRenderer {\n return this._renderer;\n }\n\n _convertMaterialType(\n materialTypeString: string\n ): gdjs.Model3DRuntimeObject.MaterialType {\n if (materialTypeString === 'KeepOriginal') {\n return gdjs.Model3DRuntimeObject.MaterialType.KeepOriginal;\n } else if (materialTypeString === 'StandardWithoutMetalness') {\n return gdjs.Model3DRuntimeObject.MaterialType.StandardWithoutMetalness;\n } else {\n return gdjs.Model3DRuntimeObject.MaterialType.Basic;\n }\n }\n\n update(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n const elapsedTime = this.getElapsedTime() / 1000;\n this._renderer.updateAnimation(elapsedTime * this._animationSpeedScale);\n }\n\n /**\n * Get the index of the animation being played.\n * @return The index of the new animation being played\n */\n getAnimationIndex(): number {\n return this._currentAnimationIndex;\n }\n\n /**\n * Change the animation being played.\n * @param animationIndex The index of the new animation to be played\n */\n setAnimationIndex(animationIndex: number): void {\n animationIndex = animationIndex | 0;\n if (\n animationIndex < this._animations.length &&\n this._currentAnimationIndex !== animationIndex &&\n animationIndex >= 0\n ) {\n const animation = this._animations[animationIndex];\n this._currentAnimationIndex = animationIndex;\n this._renderer.playAnimation(animation.source, animation.loop);\n if (this._animationPaused) {\n this._renderer.pauseAnimation();\n }\n }\n }\n\n /**\n * Get the name of the animation being played.\n * @return The name of the new animation being played\n */\n getAnimationName(): string {\n if (this._currentAnimationIndex >= this._animations.length) {\n return '';\n }\n return this._animations[this._currentAnimationIndex].name;\n }\n\n /**\n * Change the animation being played.\n * @param newAnimationName The name of the new animation to be played\n */\n setAnimationName(newAnimationName: string): void {\n if (!newAnimationName) {\n return;\n }\n const animationIndex = this._animations.findIndex(\n (animation) => animation.name === newAnimationName\n );\n if (animationIndex >= 0) {\n this.setAnimationIndex(animationIndex);\n }\n }\n\n isCurrentAnimationName(name: string): boolean {\n return this.getAnimationName() === name;\n }\n\n /**\n * Return true if animation has ended.\n * The animation had ended if:\n * - it's not configured as a loop;\n * - the current frame is the last frame;\n * - the last frame has been displayed long enough.\n */\n hasAnimationEnded(): boolean {\n return this._renderer.hasAnimationEnded();\n }\n\n isAnimationPaused() {\n return this._animationPaused;\n }\n\n pauseAnimation() {\n this._animationPaused = true;\n this._renderer.pauseAnimation();\n }\n\n resumeAnimation() {\n this._animationPaused = false;\n this._renderer.resumeAnimation();\n }\n\n getAnimationSpeedScale() {\n return this._animationSpeedScale;\n }\n\n setAnimationSpeedScale(ratio: float): void {\n this._animationSpeedScale = ratio;\n }\n\n getAnimationElapsedTime(): float {\n return this._renderer.getAnimationElapsedTime();\n }\n\n setAnimationElapsedTime(time: float): void {\n this._renderer.setAnimationElapsedTime(time);\n }\n\n getAnimationDuration(): float {\n return this._renderer.getAnimationDuration(\n this._animations[this._currentAnimationIndex].source\n );\n }\n\n getCenterX(): float {\n const centerPoint = this._renderer.getCenterPoint();\n return this.getWidth() * centerPoint[0];\n }\n\n getCenterY(): float {\n const centerPoint = this._renderer.getCenterPoint();\n return this.getHeight() * centerPoint[1];\n }\n\n getCenterZ(): float {\n const centerPoint = this._renderer.getCenterPoint();\n return this.getDepth() * centerPoint[2];\n }\n\n getDrawableX(): float {\n const originPoint = this._renderer.getOriginPoint();\n return this.getX() - this.getWidth() * originPoint[0];\n }\n\n getDrawableY(): float {\n const originPoint = this._renderer.getOriginPoint();\n return this.getY() - this.getHeight() * originPoint[1];\n }\n\n getDrawableZ(): float {\n const originPoint = this._renderer.getOriginPoint();\n return this.getZ() - this.getDepth() * originPoint[2];\n }\n }\n\n export namespace Model3DRuntimeObject {\n export enum MaterialType {\n Basic,\n StandardWithoutMetalness,\n KeepOriginal,\n }\n }\n gdjs.registerObject('Scene3D::Model3DObject', gdjs.Model3DRuntimeObject);\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CA2CE,KAAM,GAAsB,AAAC,GAA0C,CACrE,OAAQ,OACD,cACH,MAAO,UACJ,eACH,MAAO,CAAC,GAAK,GAAK,QACf,gBACH,MAAO,CAAC,GAAK,GAAK,OACf,gBACH,MAAO,CAAC,GAAK,EAAG,QACb,UACH,MAAO,CAAC,EAAG,EAAG,WAEd,MAAO,QAON,eACG,GAAK,eACc,CAmC3B,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAnC3B,mBACE,EAAK,q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OAAS,KAAK,YAAc,EAAY,GAGtD,cAAsB,CACpB,KAAM,GAAc,KAAK,UAAU,iBACnC,MAAO,MAAK,OAAS,KAAK,WAAa,EAAY,IA9VhD,EAAM,uBAkWN,SAAU,EAAV,CACE,GAAK,GAAL,UAAK,EAAL,CACL,qBACA,2DACA,qCAHU,wCADG,uDAOjB,EAAK,eAAe,yBAA0B,EAAK,wBAxa3C",
4
+ "sourcesContent": ["namespace gdjs {\n type Model3DAnimation = { name: string; source: string; loop: boolean };\n\n type Model3DObjectNetworkSyncDataType = {\n mt: number;\n op: FloatPoint3D | null;\n cp: FloatPoint3D | null;\n anis: Model3DAnimation[];\n ai: integer;\n ass: float;\n ap: boolean;\n };\n\n type Model3DObjectNetworkSyncData = Object3DNetworkSyncData &\n Model3DObjectNetworkSyncDataType;\n\n /** Base parameters for {@link gdjs.Cube3DRuntimeObject} */\n export interface Model3DObjectData extends Object3DData {\n /** The base parameters of the Model3D object */\n content: Object3DDataContent & {\n modelResourceName: string;\n rotationX: number;\n rotationY: number;\n rotationZ: number;\n keepAspectRatio: boolean;\n materialType: 'Basic' | 'StandardWithoutMetalness' | 'KeepOriginal';\n originLocation:\n | 'ModelOrigin'\n | 'ObjectCenter'\n | 'BottomCenterZ'\n | 'BottomCenterY'\n | 'TopLeft';\n centerLocation:\n | 'ModelOrigin'\n | 'ObjectCenter'\n | 'BottomCenterZ'\n | 'BottomCenterY';\n animations: Model3DAnimation[];\n };\n }\n\n type FloatPoint3D = [float, float, float];\n\n const getPointForLocation = (location: string): FloatPoint3D | null => {\n switch (location) {\n case 'ModelOrigin':\n return null;\n case 'ObjectCenter':\n return [0.5, 0.5, 0.5];\n case 'BottomCenterZ':\n return [0.5, 0.5, 0];\n case 'BottomCenterY':\n return [0.5, 1, 0.5];\n case 'TopLeft':\n return [0, 0, 0];\n default:\n return null;\n }\n };\n\n /**\n * A 3D object which displays a 3D model.\n */\n export class Model3DRuntimeObject\n extends gdjs.RuntimeObject3D\n implements gdjs.Animatable {\n _renderer: gdjs.Model3DRuntimeObjectRenderer;\n\n _modelResourceName: string;\n _materialType: gdjs.Model3DRuntimeObject.MaterialType =\n gdjs.Model3DRuntimeObject.MaterialType.Basic;\n\n /**\n * The local point of the model that will be at the object position.\n *\n * Coordinates are between 0 and 1.\n *\n * Its value is `null` when the point is configured to `\"ModelOrigin\"`\n * because the model origin needs to be evaluated according to the object\n * configuration.\n * @see gdjs.Model3DRuntimeObject3DRenderer.getOriginPoint\n */\n _originPoint: FloatPoint3D | null;\n /**\n * The local point of the model that is used as rotation center.\n *\n * Coordinates are between 0 and 1.\n *\n * Its value is `null` when the point is configured to `\"ModelOrigin\"`\n * because the model origin needs to be evaluated according to the object\n * configuration.\n * @see gdjs.Model3DRuntimeObject3DRenderer.getCenterPoint\n */\n _centerPoint: FloatPoint3D | null;\n\n _animations: Model3DAnimation[];\n _currentAnimationIndex: integer = 0;\n _animationSpeedScale: float = 1;\n _animationPaused: boolean = false;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n objectData: Model3DObjectData\n ) {\n super(instanceContainer, objectData);\n this._modelResourceName = objectData.content.modelResourceName;\n this._animations = objectData.content.animations;\n this._originPoint = getPointForLocation(\n objectData.content.originLocation\n );\n this._centerPoint = getPointForLocation(\n objectData.content.centerLocation\n );\n this._renderer = new gdjs.Model3DRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n this._materialType = this._convertMaterialType(\n objectData.content.materialType\n );\n\n this.onModelChanged(objectData);\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n /**\n * To be called after the renderer loaded a Model resource:\n * - After the renderer was instantiated\n * - After reloading the model\n */\n private onModelChanged(objectData) {\n this._updateModel(objectData);\n if (this._animations.length > 0) {\n this._renderer.playAnimation(\n this._animations[0].source,\n this._animations[0].loop\n );\n }\n }\n\n updateFromObjectData(\n oldObjectData: Model3DObjectData,\n newObjectData: Model3DObjectData\n ): boolean {\n super.updateFromObjectData(oldObjectData, newObjectData);\n\n if (\n oldObjectData.content.materialType !==\n newObjectData.content.materialType\n ) {\n this._materialType = this._convertMaterialType(\n newObjectData.content.materialType\n );\n }\n if (\n oldObjectData.content.modelResourceName !==\n newObjectData.content.modelResourceName\n ) {\n this._reloadModel(newObjectData);\n } else if (\n oldObjectData.content.width !== newObjectData.content.width ||\n oldObjectData.content.height !== newObjectData.content.height ||\n oldObjectData.content.depth !== newObjectData.content.depth ||\n oldObjectData.content.rotationX !== newObjectData.content.rotationX ||\n oldObjectData.content.rotationY !== newObjectData.content.rotationY ||\n oldObjectData.content.rotationZ !== newObjectData.content.rotationZ ||\n oldObjectData.content.keepAspectRatio !==\n newObjectData.content.keepAspectRatio ||\n oldObjectData.content.materialType !==\n newObjectData.content.materialType\n ) {\n this._updateModel(newObjectData);\n }\n if (\n oldObjectData.content.originLocation !==\n newObjectData.content.originLocation\n ) {\n this._originPoint = getPointForLocation(\n newObjectData.content.originLocation\n );\n }\n if (\n oldObjectData.content.centerLocation !==\n newObjectData.content.centerLocation\n ) {\n this._centerPoint = getPointForLocation(\n newObjectData.content.centerLocation\n );\n }\n return true;\n }\n\n getNetworkSyncData(): Model3DObjectNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n mt: this._materialType,\n op: this._originPoint,\n cp: this._centerPoint,\n anis: this._animations,\n ai: this._currentAnimationIndex,\n ass: this._animationSpeedScale,\n ap: this._animationPaused,\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: Model3DObjectNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n if (networkSyncData.mt !== undefined) {\n this._materialType = networkSyncData.mt;\n }\n if (networkSyncData.op !== undefined) {\n this._originPoint = networkSyncData.op;\n }\n if (networkSyncData.cp !== undefined) {\n this._centerPoint = networkSyncData.cp;\n }\n if (networkSyncData.anis !== undefined) {\n this._animations = networkSyncData.anis;\n }\n if (networkSyncData.ai !== undefined) {\n this.setAnimationIndex(networkSyncData.ai);\n }\n if (networkSyncData.ass !== undefined) {\n this.setAnimationSpeedScale(networkSyncData.ass);\n }\n if (networkSyncData.ap !== undefined) {\n if (networkSyncData.ap !== this.isAnimationPaused()) {\n networkSyncData.ap ? this.pauseAnimation() : this.resumeAnimation();\n }\n }\n }\n\n _reloadModel(objectData: Model3DObjectData) {\n this._modelResourceName = objectData.content.modelResourceName;\n this._renderer._reloadModel(this, this._runtimeScene);\n this.onModelChanged(objectData);\n }\n\n _updateModel(objectData: Model3DObjectData) {\n const rotationX = objectData.content.rotationX || 0;\n const rotationY = objectData.content.rotationY || 0;\n const rotationZ = objectData.content.rotationZ || 0;\n const keepAspectRatio = objectData.content.keepAspectRatio;\n this._renderer._updateModel(\n rotationX,\n rotationY,\n rotationZ,\n this._getOriginalWidth(),\n this._getOriginalHeight(),\n this._getOriginalDepth(),\n keepAspectRatio\n );\n }\n\n getRenderer(): RuntimeObject3DRenderer {\n return this._renderer;\n }\n\n _convertMaterialType(\n materialTypeString: string\n ): gdjs.Model3DRuntimeObject.MaterialType {\n if (materialTypeString === 'KeepOriginal') {\n return gdjs.Model3DRuntimeObject.MaterialType.KeepOriginal;\n } else if (materialTypeString === 'StandardWithoutMetalness') {\n return gdjs.Model3DRuntimeObject.MaterialType.StandardWithoutMetalness;\n } else {\n return gdjs.Model3DRuntimeObject.MaterialType.Basic;\n }\n }\n\n update(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n const elapsedTime = this.getElapsedTime() / 1000;\n this._renderer.updateAnimation(elapsedTime * this._animationSpeedScale);\n }\n\n /**\n * Get the index of the animation being played.\n * @return The index of the new animation being played\n */\n getAnimationIndex(): number {\n return this._currentAnimationIndex;\n }\n\n /**\n * Change the animation being played.\n * @param animationIndex The index of the new animation to be played\n */\n setAnimationIndex(animationIndex: number): void {\n animationIndex = animationIndex | 0;\n if (\n animationIndex < this._animations.length &&\n this._currentAnimationIndex !== animationIndex &&\n animationIndex >= 0\n ) {\n const animation = this._animations[animationIndex];\n this._currentAnimationIndex = animationIndex;\n this._renderer.playAnimation(animation.source, animation.loop);\n if (this._animationPaused) {\n this._renderer.pauseAnimation();\n }\n }\n }\n\n /**\n * Get the name of the animation being played.\n * @return The name of the new animation being played\n */\n getAnimationName(): string {\n if (this._currentAnimationIndex >= this._animations.length) {\n return '';\n }\n return this._animations[this._currentAnimationIndex].name;\n }\n\n /**\n * Change the animation being played.\n * @param newAnimationName The name of the new animation to be played\n */\n setAnimationName(newAnimationName: string): void {\n if (!newAnimationName) {\n return;\n }\n const animationIndex = this._animations.findIndex(\n (animation) => animation.name === newAnimationName\n );\n if (animationIndex >= 0) {\n this.setAnimationIndex(animationIndex);\n }\n }\n\n isCurrentAnimationName(name: string): boolean {\n return this.getAnimationName() === name;\n }\n\n /**\n * Return true if animation has ended.\n * The animation had ended if:\n * - it's not configured as a loop;\n * - the current frame is the last frame;\n * - the last frame has been displayed long enough.\n */\n hasAnimationEnded(): boolean {\n return this._renderer.hasAnimationEnded();\n }\n\n isAnimationPaused() {\n return this._animationPaused;\n }\n\n pauseAnimation() {\n this._animationPaused = true;\n this._renderer.pauseAnimation();\n }\n\n resumeAnimation() {\n this._animationPaused = false;\n this._renderer.resumeAnimation();\n }\n\n getAnimationSpeedScale() {\n return this._animationSpeedScale;\n }\n\n setAnimationSpeedScale(ratio: float): void {\n this._animationSpeedScale = ratio;\n }\n\n getAnimationElapsedTime(): float {\n return this._renderer.getAnimationElapsedTime();\n }\n\n setAnimationElapsedTime(time: float): void {\n this._renderer.setAnimationElapsedTime(time);\n if (!this._animationPaused) {\n this._renderer.resumeAnimation();\n }\n }\n\n getAnimationDuration(): float {\n return this._renderer.getAnimationDuration(\n this._animations[this._currentAnimationIndex].source\n );\n }\n\n getCenterX(): float {\n const centerPoint = this._renderer.getCenterPoint();\n return this.getWidth() * centerPoint[0];\n }\n\n getCenterY(): float {\n const centerPoint = this._renderer.getCenterPoint();\n return this.getHeight() * centerPoint[1];\n }\n\n getCenterZ(): float {\n const centerPoint = this._renderer.getCenterPoint();\n return this.getDepth() * centerPoint[2];\n }\n\n getDrawableX(): float {\n const originPoint = this._renderer.getOriginPoint();\n return this.getX() - this.getWidth() * originPoint[0];\n }\n\n getDrawableY(): float {\n const originPoint = this._renderer.getOriginPoint();\n return this.getY() - this.getHeight() * originPoint[1];\n }\n\n getDrawableZ(): float {\n const originPoint = this._renderer.getOriginPoint();\n return this.getZ() - this.getDepth() * originPoint[2];\n }\n }\n\n export namespace Model3DRuntimeObject {\n export enum MaterialType {\n Basic,\n StandardWithoutMetalness,\n KeepOriginal,\n }\n }\n gdjs.registerObject('Scene3D::Model3DObject', gdjs.Model3DRuntimeObject);\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CA2CE,KAAM,GAAsB,AAAC,GAA0C,CACrE,OAAQ,OACD,cACH,MAAO,UACJ,eACH,MAAO,CAAC,GAAK,GAAK,QACf,gBACH,MAAO,CAAC,GAAK,GAAK,OACf,gBACH,MAAO,CAAC,GAAK,EAAG,QACb,UACH,MAAO,CAAC,EAAG,EAAG,WAEd,MAAO,QAON,eACG,GAAK,eACc,CAmC3B,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAnC3B,mBACE,EAAK,qBAAqB,aAAa,MA0BzC,4BAAkC,EAClC,0BAA8B,EAC9B,sBAA4B,GAO1B,KAAK,mBAAqB,EAAW,QAAQ,kBAC7C,KAAK,YAAc,EAAW,QAAQ,WACtC,KAAK,aAAe,EAClB,EAAW,QAAQ,gBAErB,KAAK,aAAe,EAClB,EAAW,QAAQ,gBAErB,KAAK,UAAY,GAAI,GAAK,6BACxB,KACA,GAEF,KAAK,cAAgB,KAAK,qBACxB,EAAW,QAAQ,cAGrB,KAAK,eAAe,GAGpB,KAAK,YAQC,eAAe,EAAY,CACjC,KAAK,aAAa,GACd,KAAK,YAAY,OAAS,GAC5B,KAAK,UAAU,cACb,KAAK,YAAY,GAAG,OACpB,KAAK,YAAY,GAAG,MAK1B,qBACE,EACA,EACS,CACT,aAAM,qBAAqB,EAAe,GAGxC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d,gBAAiB,CACf,KAAK,iBAAmB,GACxB,KAAK,UAAU,iBAGjB,iBAAkB,CAChB,KAAK,iBAAmB,GACxB,KAAK,UAAU,kBAGjB,wBAAyB,CACvB,MAAO,MAAK,qBAGd,uBAAuB,EAAoB,CACzC,KAAK,qBAAuB,EAG9B,yBAAiC,CAC/B,MAAO,MAAK,UAAU,0BAGxB,wBAAwB,EAAmB,CACzC,KAAK,UAAU,wBAAwB,GAClC,KAAK,kBACR,KAAK,UAAU,kBAInB,sBAA8B,CAC5B,MAAO,MAAK,UAAU,qBACpB,KAAK,YAAY,KAAK,wBAAwB,QAIlD,YAAoB,CAClB,KAAM,GAAc,KAAK,UAAU,iBACnC,MAAO,MAAK,WAAa,EAAY,GAGvC,YAAoB,CAClB,KAAM,GAAc,KAAK,UAAU,iBACnC,MAAO,MAAK,YAAc,EAAY,GAGxC,YAAoB,CAClB,KAAM,GAAc,KAAK,UAAU,iBACnC,MAAO,MAAK,WAAa,EAAY,GAGvC,cAAsB,CACpB,KAAM,GAAc,KAAK,UAAU,iBACnC,MAAO,MAAK,OAAS,KAAK,WAAa,EAAY,GAGrD,cAAsB,CACpB,KAAM,GAAc,KAAK,UAAU,iBACnC,MAAO,MAAK,OAAS,KAAK,YAAc,EAAY,GAGtD,cAAsB,CACpB,KAAM,GAAc,KAAK,UAAU,iBACnC,MAAO,MAAK,OAAS,KAAK,WAAa,EAAY,IAjWhD,EAAM,uBAqWN,SAAU,EAAV,CACE,GAAK,GAAL,UAAK,EAAL,CACL,qBACA,2DACA,qCAHU,wCADG,uDAOjB,EAAK,eAAe,yBAA0B,EAAK,wBA3a3C",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var gdjs;(function(i){let l;(function(c){let u;(function(s){const t=n=>{const e=n.getGame().getRenderer().getElectronRemote();return e?e.getCurrentWindow():null};s.focus=function(n,e){const o=t(e);o&&(n?o.focus():o.blur())},s.isFocused=function(n){const e=t(n);return e?e.isFocused():!1},s.show=function(n,e){const o=t(e);o&&(n?o.showInactive():o.hide())},s.isVisible=function(n){const e=t(n);return e?e.isVisible():!1},s.maximize=function(n,e){const o=t(e);o&&(n?o.maximize():o.unmaximize())},s.isMaximized=function(n){const e=t(n);return e?e.isMaximized():!1},s.minimize=function(n,e){const o=t(e);o&&(n?o.minimize():o.restore())},s.isMinimized=function(n){const e=t(n);return e?e.isMinimized():!1},s.enable=function(n,e){const o=t(e);o&&o.setEnabled(n)},s.isEnabled=function(n){const e=t(n);return e?e.isEnabled():!1},s.setResizable=function(n,e){const o=t(e);o&&o.setResizable(n)},s.isResizable=function(n){const e=t(n);return e?e.isResizable():!1},s.setMovable=function(n,e){const o=t(e);o&&o.setMovable(n)},s.isMovable=function(n){const e=t(n);return e?e.isMovable():!1},s.setMaximizable=function(n,e){const o=t(e);o&&o.setMaximizable(n)},s.isMaximizable=function(n){const e=t(n);return e?e.isMaximizable():!1},s.setMinimizable=function(n,e){const o=t(e);o&&o.setMinimizable(n)},s.isMinimizable=function(n){const e=t(n);return e?e.isMinimizable():!1},s.setFullScreenable=function(n,e){const o=t(e);o&&o.setFullScreenable(n)},s.isFullScreenable=function(n){const e=t(n);return e?e.isFullScreenable():!1},s.setClosable=function(n,e){const o=t(e);o&&o.setClosable(n)},s.isClosable=function(n){const e=t(n);return e?e.isClosable():!1},s.setAlwaysOnTop=function(n,e,o){const r=t(o);r&&r.setAlwaysOnTop(n,e)},s.isAlwaysOnTop=function(n){const e=t(n);return e?e.isAlwaysOnTop():!1},s.setPosition=function(n,e,o){const r=t(o);r&&r.setPosition(~~n,~~e)},s.getPositionX=function(n){const e=t(n);return e?e.getPosition()[0]:0},s.getPositionY=function(n){const e=t(n);return e?e.getPosition()[1]:0},s.setKiosk=function(n,e){const o=t(e);o&&o.setKiosk(n)},s.isKiosk=function(n){const e=t(n);return e?e.isKiosk():!1},s.flash=function(n,e){const o=t(e);o&&o.flashFrame(n)},s.setHasShadow=function(n,e){const o=t(e);o&&o.setHasShadow(n)},s.hasShadow=function(n){const e=t(n);return e?e.hasShadow():!1},s.setOpacity=function(n,e){const o=t(e);o&&o.setOpacity(n)},s.getOpacity=function(n){const e=t(n);return e?e.getOpacity():1},s.setContentProtection=function(n,e){const o=t(e);o&&o.setContentProtection(n)},s.setFocusable=function(n,e){const o=t(e);o&&o.setFocusable(n)}})(u=c.advancedWindow||(c.advancedWindow={}))})(l=i.evtTools||(i.evtTools={}))})(gdjs||(gdjs={}));
1
+ var gdjs;(function(i){let l;(function(c){let u;(function(s){const t=n=>{try{const e=n.getGame().getRenderer().getElectronRemote();return e?e.getCurrentWindow():null}catch{return null}};s.focus=function(n,e){const o=t(e);o&&(n?o.focus():o.blur())},s.isFocused=function(n){const e=t(n);return e?e.isFocused():!1},s.show=function(n,e){const o=t(e);o&&(n?o.showInactive():o.hide())},s.isVisible=function(n){const e=t(n);return e?e.isVisible():!1},s.maximize=function(n,e){const o=t(e);o&&(n?o.maximize():o.unmaximize())},s.isMaximized=function(n){const e=t(n);return e?e.isMaximized():!1},s.minimize=function(n,e){const o=t(e);o&&(n?o.minimize():o.restore())},s.isMinimized=function(n){const e=t(n);return e?e.isMinimized():!1},s.enable=function(n,e){const o=t(e);o&&o.setEnabled(n)},s.isEnabled=function(n){const e=t(n);return e?e.isEnabled():!1},s.setResizable=function(n,e){const o=t(e);o&&o.setResizable(n)},s.isResizable=function(n){const e=t(n);return e?e.isResizable():!1},s.setMovable=function(n,e){const o=t(e);o&&o.setMovable(n)},s.isMovable=function(n){const e=t(n);return e?e.isMovable():!1},s.setMaximizable=function(n,e){const o=t(e);o&&o.setMaximizable(n)},s.isMaximizable=function(n){const e=t(n);return e?e.isMaximizable():!1},s.setMinimizable=function(n,e){const o=t(e);o&&o.setMinimizable(n)},s.isMinimizable=function(n){const e=t(n);return e?e.isMinimizable():!1},s.setFullScreenable=function(n,e){const o=t(e);o&&o.setFullScreenable(n)},s.isFullScreenable=function(n){const e=t(n);return e?e.isFullScreenable():!1},s.setClosable=function(n,e){const o=t(e);o&&o.setClosable(n)},s.isClosable=function(n){const e=t(n);return e?e.isClosable():!1},s.setAlwaysOnTop=function(n,e,o){const r=t(o);r&&r.setAlwaysOnTop(n,e)},s.isAlwaysOnTop=function(n){const e=t(n);return e?e.isAlwaysOnTop():!1},s.setPosition=function(n,e,o){const r=t(o);r&&r.setPosition(~~n,~~e)},s.getPositionX=function(n){const e=t(n);return e?e.getPosition()[0]:0},s.getPositionY=function(n){const e=t(n);return e?e.getPosition()[1]:0},s.setKiosk=function(n,e){const o=t(e);o&&o.setKiosk(n)},s.isKiosk=function(n){const e=t(n);return e?e.isKiosk():!1},s.flash=function(n,e){const o=t(e);o&&o.flashFrame(n)},s.setHasShadow=function(n,e){const o=t(e);o&&o.setHasShadow(n)},s.hasShadow=function(n){const e=t(n);return e?e.hasShadow():!1},s.setOpacity=function(n,e){const o=t(e);o&&o.setOpacity(n)},s.getOpacity=function(n){const e=t(n);return e?e.getOpacity():1},s.setContentProtection=function(n,e){const o=t(e);o&&o.setContentProtection(n)},s.setFocusable=function(n,e){const o=t(e);o&&o.setFocusable(n)}})(u=c.advancedWindow||(c.advancedWindow={}))})(l=i.evtTools||(i.evtTools={}))})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=electron-advancedwindowtools.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/AdvancedWindow/electron-advancedwindowtools.ts"],
4
- "sourcesContent": ["namespace gdjs {\n /**\n * Tools to manipulate the game window positioning and\n * interactions with the operating system.\n * @author arthuro555\n */\n export namespace evtTools {\n export namespace advancedWindow {\n const getElectronBrowserWindow = (runtimeScene: gdjs.RuntimeScene) => {\n const electronRemote = runtimeScene\n .getGame()\n .getRenderer()\n .getElectronRemote();\n if (electronRemote) {\n return electronRemote.getCurrentWindow();\n }\n\n return null;\n };\n\n export const focus = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n if (activate) {\n electronBrowserWindow.focus();\n } else {\n electronBrowserWindow.blur();\n }\n }\n };\n\n export const isFocused = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isFocused();\n }\n return false;\n };\n\n export const show = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n if (activate) {\n electronBrowserWindow.showInactive();\n } else {\n electronBrowserWindow.hide();\n }\n }\n };\n\n export const isVisible = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isVisible();\n }\n return false;\n };\n\n export const maximize = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n if (activate) {\n electronBrowserWindow.maximize();\n } else {\n electronBrowserWindow.unmaximize();\n }\n }\n };\n\n export const isMaximized = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isMaximized();\n }\n return false;\n };\n\n export const minimize = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n if (activate) {\n electronBrowserWindow.minimize();\n } else {\n electronBrowserWindow.restore();\n }\n }\n };\n\n export const isMinimized = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isMinimized();\n }\n return false;\n };\n\n export const enable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setEnabled(activate);\n }\n };\n\n export const isEnabled = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isEnabled();\n }\n return false;\n };\n\n export const setResizable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setResizable(activate);\n }\n };\n\n export const isResizable = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isResizable();\n }\n return false;\n };\n\n export const setMovable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setMovable(activate);\n }\n };\n\n export const isMovable = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isMovable();\n }\n return false;\n };\n\n export const setMaximizable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setMaximizable(activate);\n }\n };\n\n export const isMaximizable = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isMaximizable();\n }\n return false;\n };\n\n export const setMinimizable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setMinimizable(activate);\n }\n };\n\n export const isMinimizable = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isMinimizable();\n }\n return false;\n };\n\n export const setFullScreenable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setFullScreenable(activate);\n }\n };\n\n export const isFullScreenable = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isFullScreenable();\n }\n return false;\n };\n\n export const setClosable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setClosable(activate);\n }\n };\n\n export const isClosable = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isClosable();\n }\n return false;\n };\n\n export const setAlwaysOnTop = function (\n activate: boolean,\n level:\n | 'normal'\n | 'floating'\n | 'torn-off-menu'\n | 'modal-panel'\n | 'main-menu'\n | 'status'\n | 'pop-up-menu'\n | 'screen-saver',\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setAlwaysOnTop(activate, level);\n }\n };\n\n export const isAlwaysOnTop = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isAlwaysOnTop();\n }\n return false;\n };\n\n export const setPosition = function (\n x: float,\n y: float,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n // Convert x and y to (32 bit) integers to avoid Electron errors.\n electronBrowserWindow.setPosition(~~x, ~~y);\n }\n };\n\n export const getPositionX = function (\n runtimeScene: gdjs.RuntimeScene\n ): number {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.getPosition()[0];\n }\n return 0;\n };\n\n export const getPositionY = function (\n runtimeScene: gdjs.RuntimeScene\n ): number {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.getPosition()[1];\n }\n return 0;\n };\n\n export const setKiosk = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setKiosk(activate);\n }\n };\n\n export const isKiosk = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isKiosk();\n }\n return false;\n };\n\n export const flash = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.flashFrame(activate);\n }\n };\n\n export const setHasShadow = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setHasShadow(activate);\n }\n };\n\n export const hasShadow = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.hasShadow();\n }\n return false;\n };\n\n export const setOpacity = function (\n opacity: float,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setOpacity(opacity);\n }\n };\n\n export const getOpacity = function (\n runtimeScene: gdjs.RuntimeScene\n ): number {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.getOpacity();\n }\n return 1;\n };\n\n export const setContentProtection = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setContentProtection(activate);\n }\n };\n\n export const setFocusable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setFocusable(activate);\n }\n };\n }\n }\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAMS,GAAU,GAAV,UAAU,EAAV,CACE,GAAU,GAAV,UAAU,EAAV,CACL,KAAM,GAA2B,AAAC,GAAoC,CACpE,KAAM,GAAiB,EACpB,UACA,cACA,oBACH,MAAI,GACK,EAAe,mBAGjB,MAGF,AAAM,QAAQ,SACnB,EACA,EACA,CACA,KAAM,GAAwB,EAAyB,GACvD,AAAI,GACF,CAAI,EACF,EAAsB,QAEtB,EAAsB,SAKf,YAAY,SACvB,EACS,CACT,KAAM,GAAwB,EAAyB,GACvD,MAAI,GACK,EAAsB,YAExB,IAGI,OAAO,SAClB,EACA,EACA,CACA,KAAM,GAAwB,EAAyB,GACvD,AAAI,GACF,CAAI,EACF,EAAsB,eAEtB,EAAsB,SAKf,YAAY,SACvB,EACS,CACT,KAAM,GAAwB,EAAyB,GACvD,MAAI,GACK,EAAsB,YAExB,IAGI,WAAW,SACtB,EACA,EACA,CACA,KAAM,GAAwB,EAAyB,GACvD,AAAI,GACF,CAAI,EACF,EAAsB,WAEtB,EAAsB,eAKf,cAAc,SAC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I,uBAAuB,SAClC,EACA,EACA,CACA,KAAM,GAAwB,EAAyB,GACvD,AAAI,GACF,EAAsB,qBAAqB,IAIlC,eAAe,SAC1B,EACA,EACA,CACA,KAAM,GAAwB,EAAyB,GACvD,AAAI,GACF,EAAsB,aAAa,MA5YxB,6CADF,iCANT",
4
+ "sourcesContent": ["namespace gdjs {\n /**\n * Tools to manipulate the game window positioning and\n * interactions with the operating system.\n * @author arthuro555\n */\n export namespace evtTools {\n export namespace advancedWindow {\n const getElectronBrowserWindow = (runtimeScene: gdjs.RuntimeScene) => {\n try {\n const electronRemote = runtimeScene\n .getGame()\n .getRenderer()\n .getElectronRemote();\n if (electronRemote) {\n return electronRemote.getCurrentWindow();\n }\n return null;\n } catch (error) {\n return null;\n }\n };\n\n export const focus = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n if (activate) {\n electronBrowserWindow.focus();\n } else {\n electronBrowserWindow.blur();\n }\n }\n };\n\n export const isFocused = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isFocused();\n }\n return false;\n };\n\n export const show = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n if (activate) {\n electronBrowserWindow.showInactive();\n } else {\n electronBrowserWindow.hide();\n }\n }\n };\n\n export const isVisible = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isVisible();\n }\n return false;\n };\n\n export const maximize = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n if (activate) {\n electronBrowserWindow.maximize();\n } else {\n electronBrowserWindow.unmaximize();\n }\n }\n };\n\n export const isMaximized = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isMaximized();\n }\n return false;\n };\n\n export const minimize = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n if (activate) {\n electronBrowserWindow.minimize();\n } else {\n electronBrowserWindow.restore();\n }\n }\n };\n\n export const isMinimized = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isMinimized();\n }\n return false;\n };\n\n export const enable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setEnabled(activate);\n }\n };\n\n export const isEnabled = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isEnabled();\n }\n return false;\n };\n\n export const setResizable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setResizable(activate);\n }\n };\n\n export const isResizable = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isResizable();\n }\n return false;\n };\n\n export const setMovable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setMovable(activate);\n }\n };\n\n export const isMovable = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isMovable();\n }\n return false;\n };\n\n export const setMaximizable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setMaximizable(activate);\n }\n };\n\n export const isMaximizable = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isMaximizable();\n }\n return false;\n };\n\n export const setMinimizable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setMinimizable(activate);\n }\n };\n\n export const isMinimizable = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isMinimizable();\n }\n return false;\n };\n\n export const setFullScreenable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setFullScreenable(activate);\n }\n };\n\n export const isFullScreenable = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isFullScreenable();\n }\n return false;\n };\n\n export const setClosable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setClosable(activate);\n }\n };\n\n export const isClosable = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isClosable();\n }\n return false;\n };\n\n export const setAlwaysOnTop = function (\n activate: boolean,\n level:\n | 'normal'\n | 'floating'\n | 'torn-off-menu'\n | 'modal-panel'\n | 'main-menu'\n | 'status'\n | 'pop-up-menu'\n | 'screen-saver',\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setAlwaysOnTop(activate, level);\n }\n };\n\n export const isAlwaysOnTop = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isAlwaysOnTop();\n }\n return false;\n };\n\n export const setPosition = function (\n x: float,\n y: float,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n // Convert x and y to (32 bit) integers to avoid Electron errors.\n electronBrowserWindow.setPosition(~~x, ~~y);\n }\n };\n\n export const getPositionX = function (\n runtimeScene: gdjs.RuntimeScene\n ): number {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.getPosition()[0];\n }\n return 0;\n };\n\n export const getPositionY = function (\n runtimeScene: gdjs.RuntimeScene\n ): number {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.getPosition()[1];\n }\n return 0;\n };\n\n export const setKiosk = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setKiosk(activate);\n }\n };\n\n export const isKiosk = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.isKiosk();\n }\n return false;\n };\n\n export const flash = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.flashFrame(activate);\n }\n };\n\n export const setHasShadow = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setHasShadow(activate);\n }\n };\n\n export const hasShadow = function (\n runtimeScene: gdjs.RuntimeScene\n ): boolean {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.hasShadow();\n }\n return false;\n };\n\n export const setOpacity = function (\n opacity: float,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setOpacity(opacity);\n }\n };\n\n export const getOpacity = function (\n runtimeScene: gdjs.RuntimeScene\n ): number {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n return electronBrowserWindow.getOpacity();\n }\n return 1;\n };\n\n export const setContentProtection = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setContentProtection(activate);\n }\n };\n\n export const setFocusable = function (\n activate: boolean,\n runtimeScene: gdjs.RuntimeScene\n ) {\n const electronBrowserWindow = getElectronBrowserWindow(runtimeScene);\n if (electronBrowserWindow) {\n electronBrowserWindow.setFocusable(activate);\n }\n };\n }\n }\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAMS,GAAU,GAAV,UAAU,EAAV,CACE,GAAU,GAAV,UAAU,EAAV,CACL,KAAM,GAA2B,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,cAAc,GAEtC,GAGI,WAAW,SACtB,EACA,EACA,CACA,KAAM,GAAwB,EAAyB,GACvD,AAAI,GACF,EAAsB,SAAS,IAItB,UAAU,SACrB,EACS,CACT,KAAM,GAAwB,EAAyB,GACvD,MAAI,GACK,EAAsB,UAExB,IAGI,QAAQ,SACnB,EACA,EACA,CACA,KAAM,GAAwB,EAAyB,GACvD,AAAI,GACF,EAAsB,WAAW,IAIxB,eAAe,SAC1B,EACA,EACA,CACA,KAAM,GAAwB,EAAyB,GACvD,AAAI,GACF,EAAsB,aAAa,IAI1B,YAAY,SACvB,EACS,CACT,KAAM,GAAwB,EAAyB,GACvD,MAAI,GACK,EAAsB,YAExB,IAGI,aAAa,SACxB,EACA,EACA,CACA,KAAM,GAAwB,EAAyB,GACvD,AAAI,GACF,EAAsB,WAAW,IAIxB,aAAa,SACxB,EACQ,CACR,KAAM,GAAwB,EAAyB,GACvD,MAAI,GACK,EAAsB,aAExB,GAGI,uBAAuB,SAClC,EACA,EACA,CACA,KAAM,GAAwB,EAAyB,GACvD,AAAI,GACF,EAAsB,qBAAqB,IAIlC,eAAe,SAC1B,EACA,EACA,CACA,KAAM,GAAwB,EAAyB,GACvD,AAAI,GACF,EAAsB,aAAa,MA/YxB,6CADF,iCANT",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var gdjs;(function(c){let i;(function(t){t[t.None=0]="None",t[t.WindowLeft=1]="WindowLeft",t[t.WindowRight=2]="WindowRight",t[t.Proportional=3]="Proportional",t[t.WindowCenter=4]="WindowCenter"})(i||(i={}));let o;(function(t){t[t.None=0]="None",t[t.WindowTop=1]="WindowTop",t[t.WindowBottom=2]="WindowBottom",t[t.Proportional=3]="Proportional",t[t.WindowCenter=4]="WindowCenter"})(o||(o={}));class P extends c.RuntimeBehavior{constructor(n,e,s){super(n,e,s);this._invalidDistances=!0;this._leftEdgeDistance=0;this._rightEdgeDistance=0;this._topEdgeDistance=0;this._bottomEdgeDistance=0;this._useLegacyBottomAndRightAnchors=!1;this._relativeToOriginalWindowSize=!!e.relativeToOriginalWindowSize,this._leftEdgeAnchor=e.leftEdgeAnchor,this._rightEdgeAnchor=e.rightEdgeAnchor,this._topEdgeAnchor=e.topEdgeAnchor,this._bottomEdgeAnchor=e.bottomEdgeAnchor,this._useLegacyBottomAndRightAnchors=e.useLegacyBottomAndRightAnchors===void 0?!0:e.useLegacyBottomAndRightAnchors}updateFromBehaviorData(n,e){return n.leftEdgeAnchor!==e.leftEdgeAnchor&&(this._leftEdgeAnchor=e.leftEdgeAnchor),n.rightEdgeAnchor!==e.rightEdgeAnchor&&(this._rightEdgeAnchor=e.rightEdgeAnchor),n.topEdgeAnchor!==e.topEdgeAnchor&&(this._topEdgeAnchor=e.topEdgeAnchor),n.bottomEdgeAnchor!==e.bottomEdgeAnchor&&(this._bottomEdgeAnchor=e.bottomEdgeAnchor),n.useLegacyTrajectory!==e.useLegacyTrajectory&&(this._useLegacyBottomAndRightAnchors=e.useLegacyBottomAndRightAnchors),n.relativeToOriginalWindowSize===e.relativeToOriginalWindowSize}onActivate(){this._invalidDistances=!0}doStepPreEvents(n){const e=c.staticArray(c.AnchorRuntimeBehavior.prototype.doStepPreEvents);let s=n.getUnrotatedViewportMinX(),g=n.getUnrotatedViewportMinY(),t=n.getUnrotatedViewportMaxX(),d=n.getUnrotatedViewportMaxY(),E=(t+s)/2,_=(d+g)/2,l=t-s,f=d-g;const m=n.getLayer(this.owner.getLayer());if(this._invalidDistances){this._relativeToOriginalWindowSize&&(s=n.getInitialUnrotatedViewportMinX(),g=n.getInitialUnrotatedViewportMinY(),t=n.getInitialUnrotatedViewportMaxX(),d=n.getInitialUnrotatedViewportMaxY(),E=(t+s)/2,_=(d+g)/2,l=t-s,f=d-g);const h=m.convertCoords(this.owner.getDrawableX(),this.owner.getDrawableY(),0,e);this._leftEdgeAnchor===1?this._leftEdgeDistance=h[0]-s:this._leftEdgeAnchor===2?this._leftEdgeDistance=h[0]-t:this._leftEdgeAnchor===3?this._leftEdgeDistance=(h[0]-s)/l:this._leftEdgeAnchor===4&&(this._leftEdgeDistance=h[0]-E),this._topEdgeAnchor===1?this._topEdgeDistance=h[1]-g:this._topEdgeAnchor===2?this._topEdgeDistance=h[1]-d:this._topEdgeAnchor===3?this._topEdgeDistance=(h[1]-g)/f:this._topEdgeAnchor===4&&(this._topEdgeDistance=h[1]-_);const r=m.convertCoords(this.owner.getDrawableX()+this.owner.getWidth(),this.owner.getDrawableY()+this.owner.getHeight(),0,e);this._rightEdgeAnchor===1?this._rightEdgeDistance=r[0]-s:this._rightEdgeAnchor===2?this._rightEdgeDistance=r[0]-t:this._rightEdgeAnchor===3?this._rightEdgeDistance=(r[0]-s)/l:this._rightEdgeAnchor===4&&(this._rightEdgeDistance=r[0]-E),this._bottomEdgeAnchor===1?this._bottomEdgeDistance=r[1]-g:this._bottomEdgeAnchor===2?this._bottomEdgeDistance=r[1]-d:this._bottomEdgeAnchor===3?this._bottomEdgeDistance=(r[1]-g)/f:this._bottomEdgeAnchor===4&&(this._bottomEdgeDistance=r[1]-_),this._invalidDistances=!1}else{let h=0,r=0,w=0,A=0;this._leftEdgeAnchor===1?h=s+this._leftEdgeDistance:this._leftEdgeAnchor===2?h=t+this._leftEdgeDistance:this._leftEdgeAnchor===3?h=s+this._leftEdgeDistance*l:this._leftEdgeAnchor===4&&(h=E+this._leftEdgeDistance),this._topEdgeAnchor===1?r=g+this._topEdgeDistance:this._topEdgeAnchor===2?r=d+this._topEdgeDistance:this._topEdgeAnchor===3?r=g+this._topEdgeDistance*f:this._topEdgeAnchor===4&&(r=_+this._topEdgeDistance),this._rightEdgeAnchor===1?w=s+this._rightEdgeDistance:this._rightEdgeAnchor===2?w=t+this._rightEdgeDistance:this._rightEdgeAnchor===3?w=s+this._rightEdgeDistance*l:this._rightEdgeAnchor===4&&(w=E+this._rightEdgeDistance),this._bottomEdgeAnchor===1?A=g+this._bottomEdgeDistance:this._bottomEdgeAnchor===2?A=d+this._bottomEdgeDistance:this._bottomEdgeAnchor===3?A=g+this._bottomEdgeDistance*f:this._bottomEdgeAnchor===4&&(A=_+this._bottomEdgeDistance);const u=m.convertInverseCoords(h,r,0,e),p=u[0],a=u[1],D=m.convertInverseCoords(w,A,0,e),b=D[0],W=D[1];this._useLegacyBottomAndRightAnchors?(this._rightEdgeAnchor!==0&&this.owner.setWidth(b-p),this._bottomEdgeAnchor!==0&&this.owner.setHeight(W-a),this._leftEdgeAnchor!==0&&this.owner.setX(p+this.owner.getX()-this.owner.getDrawableX()),this._topEdgeAnchor!==0&&this.owner.setY(a+this.owner.getY()-this.owner.getDrawableY())):(this._rightEdgeAnchor!==0&&this._leftEdgeAnchor!==0?(this.owner.setWidth(b-p),this.owner.setX(p)):(this._leftEdgeAnchor!==0&&this.owner.setX(p+this.owner.getX()-this.owner.getDrawableX()),this._rightEdgeAnchor!==0&&this.owner.setX(b+this.owner.getX()-this.owner.getDrawableX()-this.owner.getWidth())),this._bottomEdgeAnchor!==0&&this._topEdgeAnchor!==0?(this.owner.setHeight(W-a),this.owner.setY(a)):(this._topEdgeAnchor!==0&&this.owner.setY(a+this.owner.getY()-this.owner.getDrawableY()),this._bottomEdgeAnchor!==0&&this.owner.setY(W+this.owner.getY()-this.owner.getDrawableY()-this.owner.getHeight())))}}doStepPostEvents(n){}}c.AnchorRuntimeBehavior=P,c.registerBehavior("AnchorBehavior::AnchorBehavior",c.AnchorRuntimeBehavior)})(gdjs||(gdjs={}));
1
+ var gdjs;(function(_){let o;(function(t){t[t.None=0]="None",t[t.WindowLeft=1]="WindowLeft",t[t.WindowRight=2]="WindowRight",t[t.Proportional=3]="Proportional",t[t.WindowCenter=4]="WindowCenter"})(o||(o={}));let n;(function(t){t[t.None=0]="None",t[t.WindowTop=1]="WindowTop",t[t.WindowBottom=2]="WindowBottom",t[t.Proportional=3]="Proportional",t[t.WindowCenter=4]="WindowCenter"})(n||(n={}));class R extends _.RuntimeBehavior{constructor(e,i,s){super(e,i,s);this._invalidDistances=!0;this._leftEdgeDistance=0;this._rightEdgeDistance=0;this._topEdgeDistance=0;this._bottomEdgeDistance=0;this._useLegacyBottomAndRightAnchors=!1;this._relativeToOriginalWindowSize=!!i.relativeToOriginalWindowSize,this._leftEdgeAnchor=i.leftEdgeAnchor,this._rightEdgeAnchor=i.rightEdgeAnchor,this._topEdgeAnchor=i.topEdgeAnchor,this._bottomEdgeAnchor=i.bottomEdgeAnchor,this._useLegacyBottomAndRightAnchors=i.useLegacyBottomAndRightAnchors===void 0?!0:i.useLegacyBottomAndRightAnchors}updateFromBehaviorData(e,i){return e.leftEdgeAnchor!==i.leftEdgeAnchor&&(this._leftEdgeAnchor=i.leftEdgeAnchor),e.rightEdgeAnchor!==i.rightEdgeAnchor&&(this._rightEdgeAnchor=i.rightEdgeAnchor),e.topEdgeAnchor!==i.topEdgeAnchor&&(this._topEdgeAnchor=i.topEdgeAnchor),e.bottomEdgeAnchor!==i.bottomEdgeAnchor&&(this._bottomEdgeAnchor=i.bottomEdgeAnchor),e.useLegacyTrajectory!==i.useLegacyTrajectory&&(this._useLegacyBottomAndRightAnchors=i.useLegacyBottomAndRightAnchors),e.relativeToOriginalWindowSize===i.relativeToOriginalWindowSize}onActivate(){this._invalidDistances=!0}doStepPreEvents(e){const i=_.staticArray(_.AnchorRuntimeBehavior.prototype.doStepPreEvents);let s=e.getUnrotatedViewportMinX(),h=e.getUnrotatedViewportMinY(),t=e.getUnrotatedViewportMaxX(),d=e.getUnrotatedViewportMaxY(),l=(t+s)/2,f=(d+h)/2,w=t-s,A=d-h;const b=e.getLayer(this.owner.getLayer());if(this._invalidDistances){this._relativeToOriginalWindowSize&&(s=e.getInitialUnrotatedViewportMinX(),h=e.getInitialUnrotatedViewportMinY(),t=e.getInitialUnrotatedViewportMaxX(),d=e.getInitialUnrotatedViewportMaxY(),l=(t+s)/2,f=(d+h)/2,w=t-s,A=d-h);const r=this._convertCoords(e,b,this.owner.getDrawableX(),this.owner.getDrawableY(),i);this._leftEdgeAnchor===1?this._leftEdgeDistance=r[0]-s:this._leftEdgeAnchor===2?this._leftEdgeDistance=r[0]-t:this._leftEdgeAnchor===3?this._leftEdgeDistance=(r[0]-s)/w:this._leftEdgeAnchor===4&&(this._leftEdgeDistance=r[0]-l),this._topEdgeAnchor===1?this._topEdgeDistance=r[1]-h:this._topEdgeAnchor===2?this._topEdgeDistance=r[1]-d:this._topEdgeAnchor===3?this._topEdgeDistance=(r[1]-h)/A:this._topEdgeAnchor===4&&(this._topEdgeDistance=r[1]-f);const g=this._convertCoords(e,b,this.owner.getDrawableX()+this.owner.getWidth(),this.owner.getDrawableY()+this.owner.getHeight(),i);this._rightEdgeAnchor===1?this._rightEdgeDistance=g[0]-s:this._rightEdgeAnchor===2?this._rightEdgeDistance=g[0]-t:this._rightEdgeAnchor===3?this._rightEdgeDistance=(g[0]-s)/w:this._rightEdgeAnchor===4&&(this._rightEdgeDistance=g[0]-l),this._bottomEdgeAnchor===1?this._bottomEdgeDistance=g[1]-h:this._bottomEdgeAnchor===2?this._bottomEdgeDistance=g[1]-d:this._bottomEdgeAnchor===3?this._bottomEdgeDistance=(g[1]-h)/A:this._bottomEdgeAnchor===4&&(this._bottomEdgeDistance=g[1]-f),this._invalidDistances=!1}else{let r=0,g=0,a=0,p=0;this._leftEdgeAnchor===1?r=s+this._leftEdgeDistance:this._leftEdgeAnchor===2?r=t+this._leftEdgeDistance:this._leftEdgeAnchor===3?r=s+this._leftEdgeDistance*w:this._leftEdgeAnchor===4&&(r=l+this._leftEdgeDistance),this._topEdgeAnchor===1?g=h+this._topEdgeDistance:this._topEdgeAnchor===2?g=d+this._topEdgeDistance:this._topEdgeAnchor===3?g=h+this._topEdgeDistance*A:this._topEdgeAnchor===4&&(g=f+this._topEdgeDistance),this._rightEdgeAnchor===1?a=s+this._rightEdgeDistance:this._rightEdgeAnchor===2?a=t+this._rightEdgeDistance:this._rightEdgeAnchor===3?a=s+this._rightEdgeDistance*w:this._rightEdgeAnchor===4&&(a=l+this._rightEdgeDistance),this._bottomEdgeAnchor===1?p=h+this._bottomEdgeDistance:this._bottomEdgeAnchor===2?p=d+this._bottomEdgeDistance:this._bottomEdgeAnchor===3?p=h+this._bottomEdgeDistance*A:this._bottomEdgeAnchor===4&&(p=f+this._bottomEdgeDistance);const D=this._convertInverseCoords(e,b,r,g,i),c=D[0],E=D[1],P=this._convertInverseCoords(e,b,a,p,i),W=P[0],u=P[1];if(this._useLegacyBottomAndRightAnchors)this._rightEdgeAnchor!==0&&this.owner.setWidth(W-c),this._bottomEdgeAnchor!==0&&this.owner.setHeight(u-E),this._leftEdgeAnchor!==0&&this.owner.setX(c+this.owner.getX()-this.owner.getDrawableX()),this._topEdgeAnchor!==0&&this.owner.setY(E+this.owner.getY()-this.owner.getDrawableY());else{if(this._rightEdgeAnchor!==0&&this._leftEdgeAnchor!==0){const m=W-c;this.owner.setX(this.owner.getX()===this.owner.getDrawableX()?c:c+(this.owner.getX()-this.owner.getDrawableX())*m/this.owner.getWidth()),this.owner.setWidth(m)}else this._leftEdgeAnchor!==0&&this.owner.setX(c+this.owner.getX()-this.owner.getDrawableX()),this._rightEdgeAnchor!==0&&this.owner.setX(W+this.owner.getX()-this.owner.getDrawableX()-this.owner.getWidth());if(this._bottomEdgeAnchor!==0&&this._topEdgeAnchor!==0){const m=u-E;this.owner.setY(this.owner.getY()===this.owner.getDrawableY()?E:E+(this.owner.getY()-this.owner.getDrawableY())*m/this.owner.getHeight()),this.owner.setHeight(m)}else this._topEdgeAnchor!==0&&this.owner.setY(E+this.owner.getY()-this.owner.getDrawableY()),this._bottomEdgeAnchor!==0&&this.owner.setY(u+this.owner.getY()-this.owner.getDrawableY()-this.owner.getHeight())}}}doStepPostEvents(e){}_convertCoords(e,i,s,h,t){return e!==e.getScene()?(t[0]=s,t[1]=h,t):i.convertCoords(s,h,0,t)}_convertInverseCoords(e,i,s,h,t){return e!==e.getScene()?(t[0]=s,t[1]=h,t):i.convertInverseCoords(s,h,0,t)}}_.AnchorRuntimeBehavior=R,_.registerBehavior("AnchorBehavior::AnchorBehavior",_.AnchorRuntimeBehavior)})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=anchorruntimebehavior.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/AnchorBehavior/anchorruntimebehavior.ts"],
4
- "sourcesContent": ["/*\nGDevelop - Anchor Behavior Extension\nCopyright (c) 2013-2016 Florian Rival (Florian.Rival@gmail.com)\n */\n\nnamespace gdjs {\n const enum HorizontalAnchor {\n None = 0,\n WindowLeft,\n WindowRight,\n Proportional,\n WindowCenter,\n }\n const enum VerticalAnchor {\n None = 0,\n WindowTop,\n WindowBottom,\n Proportional,\n WindowCenter,\n }\n\n export class AnchorRuntimeBehavior extends gdjs.RuntimeBehavior {\n _relativeToOriginalWindowSize: any;\n _leftEdgeAnchor: HorizontalAnchor;\n _rightEdgeAnchor: HorizontalAnchor;\n _topEdgeAnchor: any;\n _bottomEdgeAnchor: any;\n _invalidDistances: boolean = true;\n _leftEdgeDistance: number = 0;\n _rightEdgeDistance: number = 0;\n _topEdgeDistance: number = 0;\n _bottomEdgeDistance: number = 0;\n _useLegacyBottomAndRightAnchors: boolean = false;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n behaviorData,\n owner: gdjs.RuntimeObject\n ) {\n super(instanceContainer, behaviorData, owner);\n this._relativeToOriginalWindowSize = !!behaviorData.relativeToOriginalWindowSize;\n this._leftEdgeAnchor = behaviorData.leftEdgeAnchor;\n this._rightEdgeAnchor = behaviorData.rightEdgeAnchor;\n this._topEdgeAnchor = behaviorData.topEdgeAnchor;\n this._bottomEdgeAnchor = behaviorData.bottomEdgeAnchor;\n this._useLegacyBottomAndRightAnchors =\n behaviorData.useLegacyBottomAndRightAnchors === undefined\n ? true\n : behaviorData.useLegacyBottomAndRightAnchors;\n }\n\n updateFromBehaviorData(oldBehaviorData, newBehaviorData): boolean {\n if (oldBehaviorData.leftEdgeAnchor !== newBehaviorData.leftEdgeAnchor) {\n this._leftEdgeAnchor = newBehaviorData.leftEdgeAnchor;\n }\n if (oldBehaviorData.rightEdgeAnchor !== newBehaviorData.rightEdgeAnchor) {\n this._rightEdgeAnchor = newBehaviorData.rightEdgeAnchor;\n }\n if (oldBehaviorData.topEdgeAnchor !== newBehaviorData.topEdgeAnchor) {\n this._topEdgeAnchor = newBehaviorData.topEdgeAnchor;\n }\n if (\n oldBehaviorData.bottomEdgeAnchor !== newBehaviorData.bottomEdgeAnchor\n ) {\n this._bottomEdgeAnchor = newBehaviorData.bottomEdgeAnchor;\n }\n if (\n oldBehaviorData.useLegacyTrajectory !==\n newBehaviorData.useLegacyTrajectory\n ) {\n this._useLegacyBottomAndRightAnchors =\n newBehaviorData.useLegacyBottomAndRightAnchors;\n }\n if (\n oldBehaviorData.relativeToOriginalWindowSize !==\n newBehaviorData.relativeToOriginalWindowSize\n ) {\n return false;\n }\n return true;\n }\n\n onActivate() {\n this._invalidDistances = true;\n }\n\n doStepPreEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {\n const workingPoint: FloatPoint = gdjs.staticArray(\n gdjs.AnchorRuntimeBehavior.prototype.doStepPreEvents\n ) as FloatPoint;\n // TODO EBO Make it work with event based objects or hide this behavior for them.\n let parentMinX = instanceContainer.getUnrotatedViewportMinX();\n let parentMinY = instanceContainer.getUnrotatedViewportMinY();\n let parentMaxX = instanceContainer.getUnrotatedViewportMaxX();\n let parentMaxY = instanceContainer.getUnrotatedViewportMaxY();\n let parentCenterX = (parentMaxX + parentMinX) / 2;\n let parentCenterY = (parentMaxY + parentMinY) / 2;\n let parentWidth = parentMaxX - parentMinX;\n let parentHeight = parentMaxY - parentMinY;\n const layer = instanceContainer.getLayer(this.owner.getLayer());\n if (this._invalidDistances) {\n if (this._relativeToOriginalWindowSize) {\n parentMinX = instanceContainer.getInitialUnrotatedViewportMinX();\n parentMinY = instanceContainer.getInitialUnrotatedViewportMinY();\n parentMaxX = instanceContainer.getInitialUnrotatedViewportMaxX();\n parentMaxY = instanceContainer.getInitialUnrotatedViewportMaxY();\n parentCenterX = (parentMaxX + parentMinX) / 2;\n parentCenterY = (parentMaxY + parentMinY) / 2;\n parentWidth = parentMaxX - parentMinX;\n parentHeight = parentMaxY - parentMinY;\n }\n\n //Calculate the distances from the window's bounds.\n const topLeftPixel = layer.convertCoords(\n this.owner.getDrawableX(),\n this.owner.getDrawableY(),\n 0,\n workingPoint\n );\n\n // Left edge\n if (this._leftEdgeAnchor === HorizontalAnchor.WindowLeft) {\n this._leftEdgeDistance = topLeftPixel[0] - parentMinX;\n } else if (this._leftEdgeAnchor === HorizontalAnchor.WindowRight) {\n this._leftEdgeDistance = topLeftPixel[0] - parentMaxX;\n } else if (this._leftEdgeAnchor === HorizontalAnchor.Proportional) {\n this._leftEdgeDistance = (topLeftPixel[0] - parentMinX) / parentWidth;\n } else if (this._leftEdgeAnchor === HorizontalAnchor.WindowCenter) {\n this._leftEdgeDistance = topLeftPixel[0] - parentCenterX;\n }\n\n // Top edge\n if (this._topEdgeAnchor === VerticalAnchor.WindowTop) {\n this._topEdgeDistance = topLeftPixel[1] - parentMinY;\n } else if (this._topEdgeAnchor === VerticalAnchor.WindowBottom) {\n this._topEdgeDistance = topLeftPixel[1] - parentMaxY;\n } else if (this._topEdgeAnchor === VerticalAnchor.Proportional) {\n this._topEdgeDistance = (topLeftPixel[1] - parentMinY) / parentHeight;\n } else if (this._topEdgeAnchor === VerticalAnchor.WindowCenter) {\n this._topEdgeDistance = topLeftPixel[1] - parentCenterY;\n }\n\n // It's fine to reuse workingPoint as topLeftPixel is no longer used.\n const bottomRightPixel = layer.convertCoords(\n this.owner.getDrawableX() + this.owner.getWidth(),\n this.owner.getDrawableY() + this.owner.getHeight(),\n 0,\n workingPoint\n );\n\n // Right edge\n if (this._rightEdgeAnchor === HorizontalAnchor.WindowLeft) {\n this._rightEdgeDistance = bottomRightPixel[0] - parentMinX;\n } else if (this._rightEdgeAnchor === HorizontalAnchor.WindowRight) {\n this._rightEdgeDistance = bottomRightPixel[0] - parentMaxX;\n } else if (this._rightEdgeAnchor === HorizontalAnchor.Proportional) {\n this._rightEdgeDistance =\n (bottomRightPixel[0] - parentMinX) / parentWidth;\n } else if (this._rightEdgeAnchor === HorizontalAnchor.WindowCenter) {\n this._rightEdgeDistance = bottomRightPixel[0] - parentCenterX;\n }\n\n // Bottom edge\n if (this._bottomEdgeAnchor === VerticalAnchor.WindowTop) {\n this._bottomEdgeDistance = bottomRightPixel[1] - parentMinY;\n } else if (this._bottomEdgeAnchor === VerticalAnchor.WindowBottom) {\n this._bottomEdgeDistance = bottomRightPixel[1] - parentMaxY;\n } else if (this._bottomEdgeAnchor === VerticalAnchor.Proportional) {\n this._bottomEdgeDistance =\n (bottomRightPixel[1] - parentMinY) / parentHeight;\n } else if (this._bottomEdgeAnchor === VerticalAnchor.WindowCenter) {\n this._bottomEdgeDistance = bottomRightPixel[1] - parentCenterY;\n }\n\n this._invalidDistances = false;\n } else {\n //Move and resize the object if needed\n let leftPixel = 0;\n let topPixel = 0;\n let rightPixel = 0;\n let bottomPixel = 0;\n\n // Left edge\n if (this._leftEdgeAnchor === HorizontalAnchor.WindowLeft) {\n leftPixel = parentMinX + this._leftEdgeDistance;\n } else if (this._leftEdgeAnchor === HorizontalAnchor.WindowRight) {\n leftPixel = parentMaxX + this._leftEdgeDistance;\n } else if (this._leftEdgeAnchor === HorizontalAnchor.Proportional) {\n leftPixel = parentMinX + this._leftEdgeDistance * parentWidth;\n } else if (this._leftEdgeAnchor === HorizontalAnchor.WindowCenter) {\n leftPixel = parentCenterX + this._leftEdgeDistance;\n }\n\n // Top edge\n if (this._topEdgeAnchor === VerticalAnchor.WindowTop) {\n topPixel = parentMinY + this._topEdgeDistance;\n } else if (this._topEdgeAnchor === VerticalAnchor.WindowBottom) {\n topPixel = parentMaxY + this._topEdgeDistance;\n } else if (this._topEdgeAnchor === VerticalAnchor.Proportional) {\n topPixel = parentMinY + this._topEdgeDistance * parentHeight;\n } else if (this._topEdgeAnchor === VerticalAnchor.WindowCenter) {\n topPixel = parentCenterY + this._topEdgeDistance;\n }\n\n // Right edge\n if (this._rightEdgeAnchor === HorizontalAnchor.WindowLeft) {\n rightPixel = parentMinX + this._rightEdgeDistance;\n } else if (this._rightEdgeAnchor === HorizontalAnchor.WindowRight) {\n rightPixel = parentMaxX + this._rightEdgeDistance;\n } else if (this._rightEdgeAnchor === HorizontalAnchor.Proportional) {\n rightPixel = parentMinX + this._rightEdgeDistance * parentWidth;\n } else if (this._rightEdgeAnchor === HorizontalAnchor.WindowCenter) {\n rightPixel = parentCenterX + this._rightEdgeDistance;\n }\n\n // Bottom edge\n if (this._bottomEdgeAnchor === VerticalAnchor.WindowTop) {\n bottomPixel = parentMinY + this._bottomEdgeDistance;\n } else if (this._bottomEdgeAnchor === VerticalAnchor.WindowBottom) {\n bottomPixel = parentMaxY + this._bottomEdgeDistance;\n } else if (this._bottomEdgeAnchor === VerticalAnchor.Proportional) {\n bottomPixel = parentMinY + this._bottomEdgeDistance * parentHeight;\n } else if (this._bottomEdgeAnchor === VerticalAnchor.WindowCenter) {\n bottomPixel = parentCenterY + this._bottomEdgeDistance;\n }\n\n // It's fine to reuse workingPoint as topLeftPixel is no longer used.\n const topLeftCoord = layer.convertInverseCoords(\n leftPixel,\n topPixel,\n 0,\n workingPoint\n );\n const left = topLeftCoord[0];\n const top = topLeftCoord[1];\n\n const bottomRightCoord = layer.convertInverseCoords(\n rightPixel,\n bottomPixel,\n 0,\n workingPoint\n );\n const right = bottomRightCoord[0];\n const bottom = bottomRightCoord[1];\n\n // Compatibility with GD <= 5.0.133\n if (this._useLegacyBottomAndRightAnchors) {\n //Move and resize the object according to the anchors\n if (this._rightEdgeAnchor !== HorizontalAnchor.None) {\n this.owner.setWidth(right - left);\n }\n if (this._bottomEdgeAnchor !== VerticalAnchor.None) {\n this.owner.setHeight(bottom - top);\n }\n if (this._leftEdgeAnchor !== HorizontalAnchor.None) {\n this.owner.setX(\n left + this.owner.getX() - this.owner.getDrawableX()\n );\n }\n if (this._topEdgeAnchor !== VerticalAnchor.None) {\n this.owner.setY(\n top + this.owner.getY() - this.owner.getDrawableY()\n );\n }\n }\n // End of compatibility code\n else {\n // Resize if right and left anchors are set\n if (\n this._rightEdgeAnchor !== HorizontalAnchor.None &&\n this._leftEdgeAnchor !== HorizontalAnchor.None\n ) {\n this.owner.setWidth(right - left);\n this.owner.setX(left);\n } else {\n if (this._leftEdgeAnchor !== HorizontalAnchor.None) {\n this.owner.setX(\n left + this.owner.getX() - this.owner.getDrawableX()\n );\n }\n if (this._rightEdgeAnchor !== HorizontalAnchor.None) {\n this.owner.setX(\n right +\n this.owner.getX() -\n this.owner.getDrawableX() -\n this.owner.getWidth()\n );\n }\n }\n // Resize if top and bottom anchors are set\n if (\n this._bottomEdgeAnchor !== VerticalAnchor.None &&\n this._topEdgeAnchor !== VerticalAnchor.None\n ) {\n this.owner.setHeight(bottom - top);\n this.owner.setY(top);\n } else {\n if (this._topEdgeAnchor !== VerticalAnchor.None) {\n this.owner.setY(\n top + this.owner.getY() - this.owner.getDrawableY()\n );\n }\n if (this._bottomEdgeAnchor !== VerticalAnchor.None) {\n this.owner.setY(\n bottom +\n this.owner.getY() -\n this.owner.getDrawableY() -\n this.owner.getHeight()\n );\n }\n }\n }\n }\n }\n\n doStepPostEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {}\n }\n gdjs.registerBehavior(\n 'AnchorBehavior::AnchorBehavior',\n gdjs.AnchorRuntimeBehavior\n );\n}\n"],
5
- "mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,GAAW,GAAX,UAAW,EAAX,CACE,SAAO,GAAP,OACA,+BACA,iCACA,mCACA,qCALS,WAOX,GAAW,GAAX,UAAW,EAAX,CACE,SAAO,GAAP,OACA,6BACA,mCACA,mCACA,qCALS,WAQJ,eAAoC,GAAK,eAAgB,CAa9D,YACE,EACA,EACA,EACA,CACA,MAAM,EAAmB,EAAc,GAZzC,uBAA6B,GAC7B,uBAA4B,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AM,OAAS,KAAK,MAAM,iBAOzC,CACE,KAAK,mBAAqB,GAC1B,KAAK,kBAAoB,EAEzB,MAAK,MAAM,SAAS,EAAQ,GAC5B,KAAK,MAAM,KAAK,IAEZ,MAAK,kBAAoB,GAC3B,KAAK,MAAM,KACT,EAAO,KAAK,MAAM,OAAS,KAAK,MAAM,gBAGtC,KAAK,mBAAqB,GAC5B,KAAK,MAAM,KACT,EACE,KAAK,MAAM,OACX,KAAK,MAAM,eACX,KAAK,MAAM,aAKnB,AACE,KAAK,oBAAsB,GAC3B,KAAK,iBAAmB,EAExB,MAAK,MAAM,UAAU,EAAS,GAC9B,KAAK,MAAM,KAAK,IAEZ,MAAK,iBAAmB,GAC1B,KAAK,MAAM,KACT,EAAM,KAAK,MAAM,OAAS,KAAK,MAAM,gBAGrC,KAAK,oBAAsB,GAC7B,KAAK,MAAM,KACT,EACE,KAAK,MAAM,OACX,KAAK,MAAM,eACX,KAAK,MAAM,gBAQzB,iBAAiB,EAAkD,GAtS9D,EAAM,wBAwSb,EAAK,iBACH,iCACA,EAAK,yBA1TC",
4
+ "sourcesContent": ["/*\nGDevelop - Anchor Behavior Extension\nCopyright (c) 2013-2016 Florian Rival (Florian.Rival@gmail.com)\n */\n\nnamespace gdjs {\n const enum HorizontalAnchor {\n None = 0,\n WindowLeft,\n WindowRight,\n Proportional,\n WindowCenter,\n }\n const enum VerticalAnchor {\n None = 0,\n WindowTop,\n WindowBottom,\n Proportional,\n WindowCenter,\n }\n\n export class AnchorRuntimeBehavior extends gdjs.RuntimeBehavior {\n _relativeToOriginalWindowSize: any;\n _leftEdgeAnchor: HorizontalAnchor;\n _rightEdgeAnchor: HorizontalAnchor;\n _topEdgeAnchor: any;\n _bottomEdgeAnchor: any;\n _invalidDistances: boolean = true;\n _leftEdgeDistance: number = 0;\n _rightEdgeDistance: number = 0;\n _topEdgeDistance: number = 0;\n _bottomEdgeDistance: number = 0;\n _useLegacyBottomAndRightAnchors: boolean = false;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n behaviorData,\n owner: gdjs.RuntimeObject\n ) {\n super(instanceContainer, behaviorData, owner);\n this._relativeToOriginalWindowSize = !!behaviorData.relativeToOriginalWindowSize;\n this._leftEdgeAnchor = behaviorData.leftEdgeAnchor;\n this._rightEdgeAnchor = behaviorData.rightEdgeAnchor;\n this._topEdgeAnchor = behaviorData.topEdgeAnchor;\n this._bottomEdgeAnchor = behaviorData.bottomEdgeAnchor;\n this._useLegacyBottomAndRightAnchors =\n behaviorData.useLegacyBottomAndRightAnchors === undefined\n ? true\n : behaviorData.useLegacyBottomAndRightAnchors;\n }\n\n updateFromBehaviorData(oldBehaviorData, newBehaviorData): boolean {\n if (oldBehaviorData.leftEdgeAnchor !== newBehaviorData.leftEdgeAnchor) {\n this._leftEdgeAnchor = newBehaviorData.leftEdgeAnchor;\n }\n if (oldBehaviorData.rightEdgeAnchor !== newBehaviorData.rightEdgeAnchor) {\n this._rightEdgeAnchor = newBehaviorData.rightEdgeAnchor;\n }\n if (oldBehaviorData.topEdgeAnchor !== newBehaviorData.topEdgeAnchor) {\n this._topEdgeAnchor = newBehaviorData.topEdgeAnchor;\n }\n if (\n oldBehaviorData.bottomEdgeAnchor !== newBehaviorData.bottomEdgeAnchor\n ) {\n this._bottomEdgeAnchor = newBehaviorData.bottomEdgeAnchor;\n }\n if (\n oldBehaviorData.useLegacyTrajectory !==\n newBehaviorData.useLegacyTrajectory\n ) {\n this._useLegacyBottomAndRightAnchors =\n newBehaviorData.useLegacyBottomAndRightAnchors;\n }\n if (\n oldBehaviorData.relativeToOriginalWindowSize !==\n newBehaviorData.relativeToOriginalWindowSize\n ) {\n return false;\n }\n return true;\n }\n\n onActivate() {\n this._invalidDistances = true;\n }\n\n doStepPreEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {\n const workingPoint: FloatPoint = gdjs.staticArray(\n gdjs.AnchorRuntimeBehavior.prototype.doStepPreEvents\n ) as FloatPoint;\n let parentMinX = instanceContainer.getUnrotatedViewportMinX();\n let parentMinY = instanceContainer.getUnrotatedViewportMinY();\n let parentMaxX = instanceContainer.getUnrotatedViewportMaxX();\n let parentMaxY = instanceContainer.getUnrotatedViewportMaxY();\n let parentCenterX = (parentMaxX + parentMinX) / 2;\n let parentCenterY = (parentMaxY + parentMinY) / 2;\n let parentWidth = parentMaxX - parentMinX;\n let parentHeight = parentMaxY - parentMinY;\n const layer = instanceContainer.getLayer(this.owner.getLayer());\n if (this._invalidDistances) {\n if (this._relativeToOriginalWindowSize) {\n parentMinX = instanceContainer.getInitialUnrotatedViewportMinX();\n parentMinY = instanceContainer.getInitialUnrotatedViewportMinY();\n parentMaxX = instanceContainer.getInitialUnrotatedViewportMaxX();\n parentMaxY = instanceContainer.getInitialUnrotatedViewportMaxY();\n parentCenterX = (parentMaxX + parentMinX) / 2;\n parentCenterY = (parentMaxY + parentMinY) / 2;\n parentWidth = parentMaxX - parentMinX;\n parentHeight = parentMaxY - parentMinY;\n }\n\n //Calculate the distances from the window's bounds.\n const topLeftPixel = this._convertCoords(\n instanceContainer,\n layer,\n this.owner.getDrawableX(),\n this.owner.getDrawableY(),\n workingPoint\n );\n\n // Left edge\n if (this._leftEdgeAnchor === HorizontalAnchor.WindowLeft) {\n this._leftEdgeDistance = topLeftPixel[0] - parentMinX;\n } else if (this._leftEdgeAnchor === HorizontalAnchor.WindowRight) {\n this._leftEdgeDistance = topLeftPixel[0] - parentMaxX;\n } else if (this._leftEdgeAnchor === HorizontalAnchor.Proportional) {\n this._leftEdgeDistance = (topLeftPixel[0] - parentMinX) / parentWidth;\n } else if (this._leftEdgeAnchor === HorizontalAnchor.WindowCenter) {\n this._leftEdgeDistance = topLeftPixel[0] - parentCenterX;\n }\n\n // Top edge\n if (this._topEdgeAnchor === VerticalAnchor.WindowTop) {\n this._topEdgeDistance = topLeftPixel[1] - parentMinY;\n } else if (this._topEdgeAnchor === VerticalAnchor.WindowBottom) {\n this._topEdgeDistance = topLeftPixel[1] - parentMaxY;\n } else if (this._topEdgeAnchor === VerticalAnchor.Proportional) {\n this._topEdgeDistance = (topLeftPixel[1] - parentMinY) / parentHeight;\n } else if (this._topEdgeAnchor === VerticalAnchor.WindowCenter) {\n this._topEdgeDistance = topLeftPixel[1] - parentCenterY;\n }\n\n // It's fine to reuse workingPoint as topLeftPixel is no longer used.\n const bottomRightPixel = this._convertCoords(\n instanceContainer,\n layer,\n this.owner.getDrawableX() + this.owner.getWidth(),\n this.owner.getDrawableY() + this.owner.getHeight(),\n workingPoint\n );\n\n // Right edge\n if (this._rightEdgeAnchor === HorizontalAnchor.WindowLeft) {\n this._rightEdgeDistance = bottomRightPixel[0] - parentMinX;\n } else if (this._rightEdgeAnchor === HorizontalAnchor.WindowRight) {\n this._rightEdgeDistance = bottomRightPixel[0] - parentMaxX;\n } else if (this._rightEdgeAnchor === HorizontalAnchor.Proportional) {\n this._rightEdgeDistance =\n (bottomRightPixel[0] - parentMinX) / parentWidth;\n } else if (this._rightEdgeAnchor === HorizontalAnchor.WindowCenter) {\n this._rightEdgeDistance = bottomRightPixel[0] - parentCenterX;\n }\n\n // Bottom edge\n if (this._bottomEdgeAnchor === VerticalAnchor.WindowTop) {\n this._bottomEdgeDistance = bottomRightPixel[1] - parentMinY;\n } else if (this._bottomEdgeAnchor === VerticalAnchor.WindowBottom) {\n this._bottomEdgeDistance = bottomRightPixel[1] - parentMaxY;\n } else if (this._bottomEdgeAnchor === VerticalAnchor.Proportional) {\n this._bottomEdgeDistance =\n (bottomRightPixel[1] - parentMinY) / parentHeight;\n } else if (this._bottomEdgeAnchor === VerticalAnchor.WindowCenter) {\n this._bottomEdgeDistance = bottomRightPixel[1] - parentCenterY;\n }\n\n this._invalidDistances = false;\n } else {\n //Move and resize the object if needed\n let leftPixel = 0;\n let topPixel = 0;\n let rightPixel = 0;\n let bottomPixel = 0;\n\n // Left edge\n if (this._leftEdgeAnchor === HorizontalAnchor.WindowLeft) {\n leftPixel = parentMinX + this._leftEdgeDistance;\n } else if (this._leftEdgeAnchor === HorizontalAnchor.WindowRight) {\n leftPixel = parentMaxX + this._leftEdgeDistance;\n } else if (this._leftEdgeAnchor === HorizontalAnchor.Proportional) {\n leftPixel = parentMinX + this._leftEdgeDistance * parentWidth;\n } else if (this._leftEdgeAnchor === HorizontalAnchor.WindowCenter) {\n leftPixel = parentCenterX + this._leftEdgeDistance;\n }\n\n // Top edge\n if (this._topEdgeAnchor === VerticalAnchor.WindowTop) {\n topPixel = parentMinY + this._topEdgeDistance;\n } else if (this._topEdgeAnchor === VerticalAnchor.WindowBottom) {\n topPixel = parentMaxY + this._topEdgeDistance;\n } else if (this._topEdgeAnchor === VerticalAnchor.Proportional) {\n topPixel = parentMinY + this._topEdgeDistance * parentHeight;\n } else if (this._topEdgeAnchor === VerticalAnchor.WindowCenter) {\n topPixel = parentCenterY + this._topEdgeDistance;\n }\n\n // Right edge\n if (this._rightEdgeAnchor === HorizontalAnchor.WindowLeft) {\n rightPixel = parentMinX + this._rightEdgeDistance;\n } else if (this._rightEdgeAnchor === HorizontalAnchor.WindowRight) {\n rightPixel = parentMaxX + this._rightEdgeDistance;\n } else if (this._rightEdgeAnchor === HorizontalAnchor.Proportional) {\n rightPixel = parentMinX + this._rightEdgeDistance * parentWidth;\n } else if (this._rightEdgeAnchor === HorizontalAnchor.WindowCenter) {\n rightPixel = parentCenterX + this._rightEdgeDistance;\n }\n\n // Bottom edge\n if (this._bottomEdgeAnchor === VerticalAnchor.WindowTop) {\n bottomPixel = parentMinY + this._bottomEdgeDistance;\n } else if (this._bottomEdgeAnchor === VerticalAnchor.WindowBottom) {\n bottomPixel = parentMaxY + this._bottomEdgeDistance;\n } else if (this._bottomEdgeAnchor === VerticalAnchor.Proportional) {\n bottomPixel = parentMinY + this._bottomEdgeDistance * parentHeight;\n } else if (this._bottomEdgeAnchor === VerticalAnchor.WindowCenter) {\n bottomPixel = parentCenterY + this._bottomEdgeDistance;\n }\n\n // It's fine to reuse workingPoint as topLeftPixel is no longer used.\n const topLeftCoord = this._convertInverseCoords(\n instanceContainer,\n layer,\n leftPixel,\n topPixel,\n workingPoint\n );\n const left = topLeftCoord[0];\n const top = topLeftCoord[1];\n\n const bottomRightCoord = this._convertInverseCoords(\n instanceContainer,\n layer,\n rightPixel,\n bottomPixel,\n workingPoint\n );\n const right = bottomRightCoord[0];\n const bottom = bottomRightCoord[1];\n\n // Compatibility with GD <= 5.0.133\n if (this._useLegacyBottomAndRightAnchors) {\n //Move and resize the object according to the anchors\n if (this._rightEdgeAnchor !== HorizontalAnchor.None) {\n this.owner.setWidth(right - left);\n }\n if (this._bottomEdgeAnchor !== VerticalAnchor.None) {\n this.owner.setHeight(bottom - top);\n }\n if (this._leftEdgeAnchor !== HorizontalAnchor.None) {\n this.owner.setX(\n left + this.owner.getX() - this.owner.getDrawableX()\n );\n }\n if (this._topEdgeAnchor !== VerticalAnchor.None) {\n this.owner.setY(\n top + this.owner.getY() - this.owner.getDrawableY()\n );\n }\n }\n // End of compatibility code\n else {\n // Resize if right and left anchors are set\n if (\n this._rightEdgeAnchor !== HorizontalAnchor.None &&\n this._leftEdgeAnchor !== HorizontalAnchor.None\n ) {\n const width = right - left;\n this.owner.setX(\n this.owner.getX() === this.owner.getDrawableX()\n ? left\n : // It uses the position of the origin relatively to the object\n // size to apply it with the new size.\n // This is the same as doing:\n // lerp(left, right, (this.owner.getX() - this.owner.getDrawableX() / this.owner.getWidth())\n // But, the division is done at the end to avoid rounding errors.\n left +\n ((this.owner.getX() - this.owner.getDrawableX()) * width) /\n this.owner.getWidth()\n );\n this.owner.setWidth(width);\n } else {\n if (this._leftEdgeAnchor !== HorizontalAnchor.None) {\n this.owner.setX(\n left + this.owner.getX() - this.owner.getDrawableX()\n );\n }\n if (this._rightEdgeAnchor !== HorizontalAnchor.None) {\n this.owner.setX(\n right +\n this.owner.getX() -\n this.owner.getDrawableX() -\n this.owner.getWidth()\n );\n }\n }\n // Resize if top and bottom anchors are set\n if (\n this._bottomEdgeAnchor !== VerticalAnchor.None &&\n this._topEdgeAnchor !== VerticalAnchor.None\n ) {\n const height = bottom - top;\n this.owner.setY(\n this.owner.getY() === this.owner.getDrawableY()\n ? top\n : top +\n ((this.owner.getY() - this.owner.getDrawableY()) * height) /\n this.owner.getHeight()\n );\n this.owner.setHeight(height);\n } else {\n if (this._topEdgeAnchor !== VerticalAnchor.None) {\n this.owner.setY(\n top + this.owner.getY() - this.owner.getDrawableY()\n );\n }\n if (this._bottomEdgeAnchor !== VerticalAnchor.None) {\n this.owner.setY(\n bottom +\n this.owner.getY() -\n this.owner.getDrawableY() -\n this.owner.getHeight()\n );\n }\n }\n }\n }\n }\n\n doStepPostEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {}\n\n private _convertCoords(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n layer: gdjs.RuntimeLayer,\n x: float,\n y: float,\n result: FloatPoint\n ) {\n const isParentACustomObject =\n instanceContainer !== instanceContainer.getScene();\n if (isParentACustomObject) {\n result[0] = x;\n result[1] = y;\n return result;\n }\n return layer.convertCoords(x, y, 0, result);\n }\n\n private _convertInverseCoords(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n layer: gdjs.RuntimeLayer,\n x: float,\n y: float,\n result: FloatPoint\n ) {\n const isParentACustomObject =\n instanceContainer !== instanceContainer.getScene();\n if (isParentACustomObject) {\n result[0] = x;\n result[1] = y;\n return result;\n }\n return layer.convertInverseCoords(x, y, 0, result);\n }\n }\n gdjs.registerBehavior(\n 'AnchorBehavior::AnchorBehavior',\n gdjs.AnchorRuntimeBehavior\n );\n}\n"],
5
+ "mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,GAAW,GAAX,UAAW,EAAX,CACE,SAAO,GAAP,OACA,+BACA,iCACA,mCACA,qCALS,WAOX,GAAW,GAAX,UAAW,EAAX,CACE,SAAO,GAAP,OACA,6BACA,mCACA,mCACA,qCALS,WAQJ,eAAoC,GAAK,eAAgB,CAa9D,YACE,EACA,EACA,EACA,CACA,MAAM,EAAmB,EAAc,GAZzC,u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AAK,iBACH,iCACA,EAAK,yBAlXC",
6
6
  "names": []
7
7
  }
@@ -34,11 +34,8 @@ module.exports = {
34
34
  .setIcon('JsPlatform/Extensions/bbcode32.png');
35
35
 
36
36
  var objectBBText = new gd.ObjectJsImplementation();
37
- objectBBText.updateProperty = function (
38
- objectContent,
39
- propertyName,
40
- newValue
41
- ) {
37
+ objectBBText.updateProperty = function (propertyName, newValue) {
38
+ const objectContent = this.content;
42
39
  if (propertyName in objectContent) {
43
40
  if (typeof objectContent[propertyName] === 'boolean')
44
41
  objectContent[propertyName] = newValue === '1';
@@ -50,8 +47,9 @@ module.exports = {
50
47
 
51
48
  return false;
52
49
  };
53
- objectBBText.getProperties = function (objectContent) {
50
+ objectBBText.getProperties = function () {
54
51
  const objectProperties = new gd.MapStringPropertyDescriptor();
52
+ const objectContent = this.content;
55
53
 
56
54
  objectProperties
57
55
  .getOrCreate('text')
@@ -66,13 +64,6 @@ module.exports = {
66
64
  .setLabel(_('Base color'))
67
65
  .setGroup(_('Appearance'));
68
66
 
69
- objectProperties
70
- .getOrCreate('opacity')
71
- .setValue(objectContent.opacity.toString())
72
- .setType('number')
73
- .setLabel(_('Opacity (0-255)'))
74
- .setGroup(_('Appearance'));
75
-
76
67
  objectProperties
77
68
  .getOrCreate('fontSize')
78
69
  .setValue(objectContent.fontSize.toString())
@@ -114,29 +105,26 @@ module.exports = {
114
105
 
115
106
  return objectProperties;
116
107
  };
117
- objectBBText.setRawJSONContent(
118
- JSON.stringify({
119
- text:
120
- '[b]bold[/b] [i]italic[/i] [size=15]smaller[/size] [font=times]times[/font] font\n[spacing=12]spaced out[/spacing]\n[outline=yellow]outlined[/outline] [shadow=red]DropShadow[/shadow] ',
121
- opacity: 255,
122
- fontSize: 20,
123
- visible: true,
124
- color: '0;0;0',
125
- fontFamily: 'Arial',
126
- align: 'left',
127
- wordWrap: true,
128
- })
129
- );
108
+ objectBBText.content = {
109
+ text:
110
+ '[b]bold[/b] [i]italic[/i] [size=15]smaller[/size] [font=times]times[/font] font\n[spacing=12]spaced out[/spacing]\n[outline=yellow]outlined[/outline] [shadow=red]DropShadow[/shadow] ',
111
+ opacity: 255,
112
+ fontSize: 20,
113
+ visible: true,
114
+ color: '0;0;0',
115
+ fontFamily: 'Arial',
116
+ align: 'left',
117
+ wordWrap: true,
118
+ };
130
119
 
131
120
  objectBBText.updateInitialInstanceProperty = function (
132
- objectContent,
133
121
  instance,
134
122
  propertyName,
135
123
  newValue
136
124
  ) {
137
125
  return false;
138
126
  };
139
- objectBBText.getInitialInstanceProperties = function (content, instance) {
127
+ objectBBText.getInitialInstanceProperties = function (instance) {
140
128
  var instanceProperties = new gd.MapStringPropertyDescriptor();
141
129
  return instanceProperties;
142
130
  };
@@ -538,25 +526,33 @@ module.exports = {
538
526
  * This is called to update the PIXI object on the scene editor
539
527
  */
540
528
  update() {
541
- const properties = this._associatedObjectConfiguration.getProperties();
529
+ const object = gd.castObject(
530
+ this._associatedObjectConfiguration,
531
+ gd.ObjectJsImplementation
532
+ );
542
533
 
543
- const rawText = properties.get('text').getValue();
534
+ const rawText = object.content.text;
544
535
  if (rawText !== this._pixiObject.text) {
545
536
  this._pixiObject.text = rawText;
546
537
  }
547
538
 
548
- const opacity = +properties.get('opacity').getValue();
549
- this._pixiObject.alpha = opacity / 255;
550
-
551
- const color = properties.get('color').getValue();
552
- this._pixiObject.textStyles.default.fill = objectsRenderingService.rgbOrHexToHexNumber(
553
- color
554
- );
539
+ const color = object.content.color;
540
+ const newColor = objectsRenderingService.rgbOrHexToHexNumber(color);
541
+ if (newColor !== this._pixiObject.textStyles.default.fill) {
542
+ this._pixiObject.textStyles.default.fill = newColor;
543
+ this._pixiObject.dirty = true;
544
+ }
555
545
 
556
- const fontSize = properties.get('fontSize').getValue();
557
- this._pixiObject.textStyles.default.fontSize = `${fontSize}px`;
546
+ const fontSize = object.content.fontSize;
547
+ const newDefaultFontsize = `${fontSize}px`;
548
+ if (
549
+ newDefaultFontsize !== this._pixiObject.textStyles.default.fontSize
550
+ ) {
551
+ this._pixiObject.textStyles.default.fontSize = `${fontSize}px`;
552
+ this._pixiObject.dirty = true;
553
+ }
558
554
 
559
- const fontResourceName = properties.get('fontFamily').getValue();
555
+ const fontResourceName = object.content.fontFamily;
560
556
 
561
557
  if (this._fontResourceName !== fontResourceName) {
562
558
  this._fontResourceName = fontResourceName;
@@ -577,13 +573,13 @@ module.exports = {
577
573
  });
578
574
  }
579
575
 
580
- const wordWrap = properties.get('wordWrap').getValue() === 'true';
576
+ const wordWrap = object.content.wordWrap;
581
577
  if (wordWrap !== this._pixiObject._style.wordWrap) {
582
578
  this._pixiObject._style.wordWrap = wordWrap;
583
579
  this._pixiObject.dirty = true;
584
580
  }
585
581
 
586
- const align = properties.get('align').getValue();
582
+ const align = object.content.align;
587
583
  if (align !== this._pixiObject._style.align) {
588
584
  this._pixiObject._style.align = align;
589
585
  this._pixiObject.dirty = true;
@@ -607,6 +603,13 @@ module.exports = {
607
603
  this._pixiObject.dirty = true;
608
604
  }
609
605
  }
606
+
607
+ // Do not hide completely an object so it can still be manipulated
608
+ const alphaForDisplay = Math.max(
609
+ this._instance.getOpacity() / 255,
610
+ 0.5
611
+ );
612
+ this._pixiObject.alpha = alphaForDisplay;
610
613
  }
611
614
 
612
615
  /**
@@ -1,2 +1,2 @@
1
- var gdjs;(function(i){class n extends i.RuntimeObject{constructor(t,e){super(t,e);this._wrappingWidth=250;this._opacity=parseFloat(e.content.opacity),this._text=e.content.text,this._color=i.rgbOrHexToRGBColor(e.content.color),this._fontFamily=e.content.fontFamily,this._fontSize=parseFloat(e.content.fontSize),this._wordWrap=e.content.wordWrap,this._align=e.content.align,this._renderer=new i.BBTextRuntimeObjectRenderer(this,t),this.hidden=!e.content.visible,this.onCreated()}getRendererObject(){return this._renderer.getRendererObject()}updateFromObjectData(t,e){return t.content.opacity!==e.content.opacity&&this.setOpacity(e.content.opacity),t.content.visible!==e.content.visible&&this.hide(!e.content.visible),t.content.text!==e.content.text&&this.setBBText(e.content.text),t.content.color!==e.content.color&&(this._color=i.rgbOrHexToRGBColor(e.content.color),this._renderer.updateColor()),t.content.fontFamily!==e.content.fontFamily&&this.setFontFamily(e.content.fontFamily),t.content.fontSize!==e.content.fontSize&&this.setFontSize(e.content.fontSize),t.content.wordWrap!==e.content.wordWrap&&this.setWordWrap(e.content.wordWrap),t.content.align!==e.content.align&&this.setAlignment(e.content.align),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),text:this._text,o:this._opacity,c:this._color,ff:this._fontFamily,fs:this._fontSize,wwrap:this._wordWrap,wwidth:this._wrappingWidth,align:this._align,hidden:this.hidden}}updateFromNetworkSyncData(t){super.updateFromNetworkSyncData(t),this._text!==void 0&&this.setBBText(t.text),this._opacity!==void 0&&this.setOpacity(t.o),this._color!==void 0&&(this._color=t.c,this._renderer.updateColor()),this._fontFamily!==void 0&&this.setFontFamily(t.ff),this._fontSize!==void 0&&this.setFontSize(t.fs),this._wordWrap!==void 0&&this.setWordWrap(t.wwrap),this._wrappingWidth!==void 0&&this.setWrappingWidth(t.wwidth),this._align!==void 0&&this.setAlignment(t.align),this.hidden!==void 0&&this.hide(t.hidden)}extraInitializationFromInitialInstance(t){t.customSize?this.setWrappingWidth(t.width):this.setWrappingWidth(250)}onDestroyed(){super.onDestroyed(),this._renderer.destroy()}setBBText(t){this._text=t,this._renderer.updateText(),this.invalidateHitboxes()}getBBText(){return this._text}setColor(t){this._color=i.rgbOrHexToRGBColor(t),this._renderer.updateColor()}getColor(){return this._color[0]+";"+this._color[1]+";"+this._color[2]}setFontSize(t){this._fontSize=t,this._renderer.updateFontSize()}getFontSize(){return this._fontSize}setFontFamily(t){this._fontFamily=t,this._renderer.updateFontFamily()}getFontFamily(){return this._fontFamily}setAlignment(t){this._align=t,this._renderer.updateAlignment()}getAlignment(){return this._align}setX(t){super.setX(t),this._renderer.updatePosition()}setY(t){super.setY(t),this._renderer.updatePosition()}setAngle(t){super.setAngle(t),this._renderer.updateAngle()}setOpacity(t){t<0&&(t=0),t>255&&(t=255),this._opacity=t,this._renderer.updateOpacity()}getOpacity(){return this._opacity}setWrappingWidth(t){this._wrappingWidth!==t&&(this._wrappingWidth=t,this._renderer.updateWrappingWidth(),this.invalidateHitboxes())}getWrappingWidth(){return this._wrappingWidth}setWordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this._renderer.updateWordWrap(),this.invalidateHitboxes())}getWordWrap(){return this._wordWrap}getWidth(){return this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}}i.BBTextRuntimeObject=n,i.registerObject("BBText::BBText",i.BBTextRuntimeObject)})(gdjs||(gdjs={}));
1
+ var gdjs;(function(i){class n extends i.RuntimeObject{constructor(t,e){super(t,e);this._wrappingWidth=250;this._opacity=parseFloat(e.content.opacity),this._text=e.content.text,this._color=i.rgbOrHexToRGBColor(e.content.color),this._fontFamily=e.content.fontFamily,this._fontSize=parseFloat(e.content.fontSize),this._wordWrap=e.content.wordWrap,this._align=e.content.align,this._renderer=new i.BBTextRuntimeObjectRenderer(this,t),this.hidden=!e.content.visible,this.onCreated()}getRendererObject(){return this._renderer.getRendererObject()}updateFromObjectData(t,e){return t.content.opacity!==e.content.opacity&&this.setOpacity(e.content.opacity),t.content.visible!==e.content.visible&&this.hide(!e.content.visible),t.content.text!==e.content.text&&this.setBBText(e.content.text),t.content.color!==e.content.color&&(this._color=i.rgbOrHexToRGBColor(e.content.color),this._renderer.updateColor()),t.content.fontFamily!==e.content.fontFamily&&this.setFontFamily(e.content.fontFamily),t.content.fontSize!==e.content.fontSize&&this.setFontSize(e.content.fontSize),t.content.wordWrap!==e.content.wordWrap&&this.setWordWrap(e.content.wordWrap),t.content.align!==e.content.align&&this.setAlignment(e.content.align),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),text:this._text,o:this._opacity,c:this._color,ff:this._fontFamily,fs:this._fontSize,wwrap:this._wordWrap,wwidth:this._wrappingWidth,align:this._align,hidden:this.hidden}}updateFromNetworkSyncData(t){super.updateFromNetworkSyncData(t),this._text!==void 0&&this.setBBText(t.text),this._opacity!==void 0&&this.setOpacity(t.o),this._color!==void 0&&(this._color=t.c,this._renderer.updateColor()),this._fontFamily!==void 0&&this.setFontFamily(t.ff),this._fontSize!==void 0&&this.setFontSize(t.fs),this._wordWrap!==void 0&&this.setWordWrap(t.wwrap),this._wrappingWidth!==void 0&&this.setWrappingWidth(t.wwidth),this._align!==void 0&&this.setAlignment(t.align),this.hidden!==void 0&&this.hide(t.hidden)}extraInitializationFromInitialInstance(t){t.customSize?this.setWrappingWidth(t.width):this.setWrappingWidth(250),t.opacity!==void 0&&this.setOpacity(t.opacity)}onDestroyed(){super.onDestroyed(),this._renderer.destroy()}setBBText(t){this._text=t,this._renderer.updateText(),this.invalidateHitboxes()}getBBText(){return this._text}setColor(t){this._color=i.rgbOrHexToRGBColor(t),this._renderer.updateColor()}getColor(){return this._color[0]+";"+this._color[1]+";"+this._color[2]}setFontSize(t){this._fontSize=t,this._renderer.updateFontSize()}getFontSize(){return this._fontSize}setFontFamily(t){this._fontFamily=t,this._renderer.updateFontFamily()}getFontFamily(){return this._fontFamily}setAlignment(t){this._align=t,this._renderer.updateAlignment()}getAlignment(){return this._align}setX(t){super.setX(t),this._renderer.updatePosition()}setY(t){super.setY(t),this._renderer.updatePosition()}setAngle(t){super.setAngle(t),this._renderer.updateAngle()}setOpacity(t){t<0&&(t=0),t>255&&(t=255),this._opacity=t,this._renderer.updateOpacity()}getOpacity(){return this._opacity}setWrappingWidth(t){this._wrappingWidth!==t&&(this._wrappingWidth=t,this._renderer.updateWrappingWidth(),this.invalidateHitboxes())}getWrappingWidth(){return this._wrappingWidth}setWordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this._renderer.updateWordWrap(),this.invalidateHitboxes())}getWordWrap(){return this._wordWrap}getWidth(){return this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}}i.BBTextRuntimeObject=n,i.registerObject("BBText::BBText",i.BBTextRuntimeObject)})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=bbtextruntimeobject.js.map