@babylonjs/gui 6.39.0 → 6.41.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/2D/advancedDynamicTexture.d.ts +1 -1
  2. package/2D/advancedDynamicTexture.js +2 -1
  3. package/2D/advancedDynamicTexture.js.map +1 -1
  4. package/2D/controls/button.d.ts +2 -5
  5. package/2D/controls/button.js +6 -6
  6. package/2D/controls/button.js.map +1 -1
  7. package/2D/controls/checkbox.js +2 -1
  8. package/2D/controls/checkbox.js.map +1 -1
  9. package/2D/controls/container.d.ts +6 -1
  10. package/2D/controls/container.js +31 -5
  11. package/2D/controls/container.js.map +1 -1
  12. package/2D/controls/control.d.ts +9 -1
  13. package/2D/controls/control.js +16 -2
  14. package/2D/controls/control.js.map +1 -1
  15. package/2D/controls/focusableButton.d.ts +1 -1
  16. package/2D/controls/focusableButton.js +1 -1
  17. package/2D/controls/focusableButton.js.map +1 -1
  18. package/2D/controls/gradient/BaseGradient.d.ts +17 -5
  19. package/2D/controls/gradient/BaseGradient.js +17 -5
  20. package/2D/controls/gradient/BaseGradient.js.map +1 -1
  21. package/2D/controls/grid.d.ts +2 -1
  22. package/2D/controls/grid.js +6 -2
  23. package/2D/controls/grid.js.map +1 -1
  24. package/2D/controls/image.d.ts +2 -1
  25. package/2D/controls/image.js +2 -1
  26. package/2D/controls/image.js.map +1 -1
  27. package/2D/controls/stackPanel.d.ts +2 -1
  28. package/2D/controls/stackPanel.js +6 -2
  29. package/2D/controls/stackPanel.js.map +1 -1
  30. package/2D/xmlLoader.js +9 -0
  31. package/2D/xmlLoader.js.map +1 -1
  32. package/3D/controls/button3D.d.ts +1 -0
  33. package/3D/controls/button3D.js +1 -0
  34. package/3D/controls/button3D.js.map +1 -1
  35. package/3D/controls/control3D.d.ts +1 -1
  36. package/3D/controls/control3D.js +1 -1
  37. package/3D/controls/control3D.js.map +1 -1
  38. package/3D/controls/holographicSlate.d.ts +1 -1
  39. package/3D/controls/holographicSlate.js +1 -1
  40. package/3D/controls/holographicSlate.js.map +1 -1
  41. package/3D/controls/touchHolographicMenu.d.ts +2 -2
  42. package/3D/controls/touchHolographicMenu.js +2 -2
  43. package/3D/controls/touchHolographicMenu.js.map +1 -1
  44. package/3D/materials/fluent/fluentMaterial.js +5 -4
  45. package/3D/materials/fluent/fluentMaterial.js.map +1 -1
  46. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +4 -3
  47. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
  48. package/3D/materials/fluentButton/fluentButtonMaterial.js +4 -3
  49. package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
  50. package/3D/materials/mrdl/mrdlBackglowMaterial.js +4 -3
  51. package/3D/materials/mrdl/mrdlBackglowMaterial.js.map +1 -1
  52. package/3D/materials/mrdl/mrdlBackplateMaterial.js +4 -3
  53. package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
  54. package/3D/materials/mrdl/mrdlFrontplateMaterial.js +4 -3
  55. package/3D/materials/mrdl/mrdlFrontplateMaterial.js.map +1 -1
  56. package/3D/materials/mrdl/mrdlInnerquadMaterial.js +4 -3
  57. package/3D/materials/mrdl/mrdlInnerquadMaterial.js.map +1 -1
  58. package/3D/materials/mrdl/mrdlSliderBarMaterial.js +4 -3
  59. package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
  60. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +4 -3
  61. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
  62. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"image.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/image.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAClD,OAAO,EAAE,KAAK,EAAE,sCAAwB;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AA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BAAY,GAAG,CAAC,AAAJ,CAAK;AACxC,mBAAmB;AACI,kBAAY,GAAG,CAAC,AAAJ,CAAK;AACxC,sBAAsB;AACC,qBAAe,GAAG,CAAC,AAAJ,CAAK;AAC3C,qBAAqB;AACE,oBAAc,GAAG,CAAC,AAAJ,CAAK;AAC1C,iBAAiB;AACM,wBAAkB,GAAG,CAAC,AAAJ,CAAK;AA/3B9C;IADC,SAAS,EAAE;sDAGX;AAcD;IADC,SAAS,EAAE;sCAGX;AAgBD;IADC,SAAS,EAAE;uCAGX;AAgBD;IADC,SAAS,EAAE;qCAGX;AAgBD;IADC,SAAS,EAAE;wCAGX;AAgBD;IADC,SAAS,EAAE;uCAGX;AAgBD;IADC,SAAS,EAAE;sCAGX;AAgBD;IADC,SAAS,EAAE;wCAGX;AAgBD;IADC,SAAS,EAAE;yCAGX;AA8BD;IADC,SAAS,EAAE;6DAGX;AA6BD;IADC,SAAS,EAAE;sCAGX;AAgBD;IADC,SAAS,EAAE;oCAGX;AAsMD;IADC,SAAS,EAAE;mCAGX;AAkLD;IADC,SAAS,EAAE;sCAGX;AAeD;IADC,SAAS,EAAE;uCAGX;AAeD;IADC,SAAS,EAAE;mCAGX;AAkQL,aAAa,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Tools } from \"core/Misc/tools\";\r\n\r\nimport { Control } from \"./control\";\r\nimport type { Measure } from \"../measure\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvas, ICanvasRenderingContext, IImage } from \"core/Engines/ICanvas\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\n\r\n/**\r\n * Class used to create 2D images\r\n */\r\nexport class Image extends Control {\r\n /**\r\n * Specifies an alternate text for the image, if the image for some reason cannot be displayed.\r\n */\r\n public alt?: string;\r\n\r\n private _workingCanvas: Nullable<ICanvas> = null;\r\n\r\n private _domImage: IImage;\r\n private _imageWidth: number;\r\n private _imageHeight: number;\r\n private _loaded = false;\r\n private _stretch = Image.STRETCH_FILL;\r\n private _source: Nullable<string>;\r\n private _autoScale = false;\r\n\r\n private _sourceLeft = 0;\r\n private _sourceTop = 0;\r\n private _sourceWidth = 0;\r\n private _sourceHeight = 0;\r\n private _svgAttributesComputationCompleted: boolean = false;\r\n private _isSVG: boolean = false;\r\n\r\n private _cellWidth: number = 0;\r\n private _cellHeight: number = 0;\r\n private _cellId: number = -1;\r\n\r\n private _sliceLeft: number;\r\n private _sliceRight: number;\r\n private _sliceTop: number;\r\n private _sliceBottom: number;\r\n\r\n private _populateNinePatchSlicesFromImage = false;\r\n\r\n private _detectPointerOnOpaqueOnly: boolean;\r\n\r\n private _imageDataCache: {\r\n data: Uint8ClampedArray | null;\r\n key: string;\r\n } = { data: null, key: \"\" };\r\n\r\n /**\r\n * Cache of images to avoid loading the same image multiple times\r\n */\r\n public static SourceImgCache = new Map<string, { img: IImage; timesUsed: number; loaded: boolean; waitingForLoadCallback: Array<() => void> }>();\r\n\r\n /**\r\n * Observable notified when the content is loaded\r\n */\r\n public onImageLoadedObservable = new Observable<Image>();\r\n\r\n /**\r\n * Observable notified when _sourceLeft, _sourceTop, _sourceWidth and _sourceHeight are computed\r\n */\r\n public onSVGAttributesComputedObservable = new Observable<Image>();\r\n\r\n /**\r\n * Gets or sets the referrer policy to apply on the img element load request.\r\n * You should set referrerPolicy before set the source of the image if you want to ensure the header will be present on the xhr loading request\r\n */\r\n public referrerPolicy: Nullable<ReferrerPolicy>;\r\n\r\n /**\r\n * Gets a boolean indicating that the content is loaded\r\n */\r\n public get isLoaded(): boolean {\r\n return this._loaded;\r\n }\r\n\r\n public isReady(): boolean {\r\n return this.isLoaded;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if pointers should only be validated on pixels with alpha > 0.\r\n * Beware using this as this will consume more memory as the image has to be stored twice\r\n */\r\n @serialize()\r\n public get detectPointerOnOpaqueOnly(): boolean {\r\n return this._detectPointerOnOpaqueOnly;\r\n }\r\n\r\n public set detectPointerOnOpaqueOnly(value: boolean) {\r\n if (this._detectPointerOnOpaqueOnly === value) {\r\n return;\r\n }\r\n\r\n this._detectPointerOnOpaqueOnly = value;\r\n }\r\n\r\n /**\r\n * Gets or sets the left value for slicing (9-patch)\r\n */\r\n @serialize()\r\n public get sliceLeft(): number {\r\n return this._sliceLeft;\r\n }\r\n\r\n public set sliceLeft(value: number) {\r\n if (this._sliceLeft === value) {\r\n return;\r\n }\r\n\r\n this._sliceLeft = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the right value for slicing (9-patch)\r\n */\r\n @serialize()\r\n public get sliceRight(): number {\r\n return this._sliceRight;\r\n }\r\n\r\n public set sliceRight(value: number) {\r\n if (this._sliceRight === value) {\r\n return;\r\n }\r\n\r\n this._sliceRight = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the top value for slicing (9-patch)\r\n */\r\n @serialize()\r\n public get sliceTop(): number {\r\n return this._sliceTop;\r\n }\r\n\r\n public set sliceTop(value: number) {\r\n if (this._sliceTop === value) {\r\n return;\r\n }\r\n\r\n this._sliceTop = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the bottom value for slicing (9-patch)\r\n */\r\n @serialize()\r\n public get sliceBottom(): number {\r\n return this._sliceBottom;\r\n }\r\n\r\n public set sliceBottom(value: number) {\r\n if (this._sliceBottom === value) {\r\n return;\r\n }\r\n\r\n this._sliceBottom = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the left coordinate in the source image\r\n */\r\n @serialize()\r\n public get sourceLeft(): number {\r\n return this._sourceLeft;\r\n }\r\n\r\n public set sourceLeft(value: number) {\r\n if (this._sourceLeft === value) {\r\n return;\r\n }\r\n\r\n this._sourceLeft = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the top coordinate in the source image\r\n */\r\n @serialize()\r\n public get sourceTop(): number {\r\n return this._sourceTop;\r\n }\r\n\r\n public set sourceTop(value: number) {\r\n if (this._sourceTop === value) {\r\n return;\r\n }\r\n\r\n this._sourceTop = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the width to capture in the source image\r\n */\r\n @serialize()\r\n public get sourceWidth(): number {\r\n return this._sourceWidth;\r\n }\r\n\r\n public set sourceWidth(value: number) {\r\n if (this._sourceWidth === value) {\r\n return;\r\n }\r\n\r\n this._sourceWidth = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the height to capture in the source image\r\n */\r\n @serialize()\r\n public get sourceHeight(): number {\r\n return this._sourceHeight;\r\n }\r\n\r\n public set sourceHeight(value: number) {\r\n if (this._sourceHeight === value) {\r\n return;\r\n }\r\n\r\n this._sourceHeight = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the image width\r\n */\r\n public get imageWidth(): number {\r\n return this._imageWidth;\r\n }\r\n\r\n /**\r\n * Gets the image height\r\n */\r\n public get imageHeight(): number {\r\n return this._imageHeight;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data\r\n */\r\n @serialize()\r\n public get populateNinePatchSlicesFromImage(): boolean {\r\n return this._populateNinePatchSlicesFromImage;\r\n }\r\n\r\n public set populateNinePatchSlicesFromImage(value: boolean) {\r\n if (this._populateNinePatchSlicesFromImage === value) {\r\n return;\r\n }\r\n\r\n this._populateNinePatchSlicesFromImage = value;\r\n\r\n if (this._populateNinePatchSlicesFromImage && this._loaded) {\r\n this._extractNinePatchSliceDataFromImage();\r\n }\r\n }\r\n\r\n /** Indicates if the format of the image is SVG */\r\n public get isSVG(): boolean {\r\n return this._isSVG;\r\n }\r\n\r\n /** Gets the status of the SVG attributes computation (sourceLeft, sourceTop, sourceWidth, sourceHeight) */\r\n public get svgAttributesComputationCompleted(): boolean {\r\n return this._svgAttributesComputationCompleted;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the image can force its container to adapt its size\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#image\r\n */\r\n @serialize()\r\n public get autoScale(): boolean {\r\n return this._autoScale;\r\n }\r\n\r\n public set autoScale(value: boolean) {\r\n if (this._autoScale === value) {\r\n return;\r\n }\r\n\r\n this._autoScale = value;\r\n\r\n if (value && this._loaded) {\r\n this.synchronizeSizeWithContent();\r\n }\r\n }\r\n\r\n /** Gets or sets the stretching mode used by the image */\r\n @serialize()\r\n public get stretch(): number {\r\n return this._stretch;\r\n }\r\n\r\n public set stretch(value: number) {\r\n if (this._stretch === value) {\r\n return;\r\n }\r\n\r\n this._stretch = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _rotate90(n: number, preserveProperties: boolean = false): Image {\r\n const width = this._domImage.width;\r\n const height = this._domImage.height;\r\n\r\n // Should abstract platform instead of using LastCreatedEngine\r\n const engine = this._host?.getScene()?.getEngine() || EngineStore.LastCreatedEngine;\r\n if (!engine) {\r\n throw new Error(\"Invalid engine. Unable to create a canvas.\");\r\n }\r\n const canvas = engine.createCanvas(height, width);\r\n\r\n const context = canvas.getContext(\"2d\")!;\r\n\r\n context.translate(canvas.width / 2, canvas.height / 2);\r\n context.rotate((n * Math.PI) / 2);\r\n\r\n context.drawImage(this._domImage, 0, 0, width, height, -width / 2, -height / 2, width, height);\r\n\r\n const dataUrl: string = canvas.toDataURL(\"image/jpg\");\r\n const rotatedImage = new Image(this.name + \"rotated\", dataUrl);\r\n\r\n if (preserveProperties) {\r\n rotatedImage._stretch = this._stretch;\r\n rotatedImage._autoScale = this._autoScale;\r\n rotatedImage._cellId = this._cellId;\r\n rotatedImage._cellWidth = n % 1 ? this._cellHeight : this._cellWidth;\r\n rotatedImage._cellHeight = n % 1 ? this._cellWidth : this._cellHeight;\r\n }\r\n\r\n this._handleRotationForSVGImage(this, rotatedImage, n);\r\n\r\n this._imageDataCache.data = null;\r\n\r\n return rotatedImage;\r\n }\r\n\r\n private _handleRotationForSVGImage(srcImage: Image, dstImage: Image, n: number): void {\r\n if (!srcImage._isSVG) {\r\n return;\r\n }\r\n\r\n if (srcImage._svgAttributesComputationCompleted) {\r\n this._rotate90SourceProperties(srcImage, dstImage, n);\r\n this._markAsDirty();\r\n } else {\r\n srcImage.onSVGAttributesComputedObservable.addOnce(() => {\r\n this._rotate90SourceProperties(srcImage, dstImage, n);\r\n this._markAsDirty();\r\n });\r\n }\r\n }\r\n\r\n private _rotate90SourceProperties(srcImage: Image, dstImage: Image, n: number): void {\r\n let srcLeft = srcImage.sourceLeft,\r\n srcTop = srcImage.sourceTop,\r\n srcWidth = srcImage.domImage.width,\r\n srcHeight = srcImage.domImage.height;\r\n\r\n let dstLeft = srcLeft,\r\n dstTop = srcTop,\r\n dstWidth = srcImage.sourceWidth,\r\n dstHeight = srcImage.sourceHeight;\r\n\r\n if (n != 0) {\r\n const mult = n < 0 ? -1 : 1;\r\n n = n % 4;\r\n for (let i = 0; i < Math.abs(n); ++i) {\r\n dstLeft = -(srcTop - srcHeight / 2) * mult + srcHeight / 2;\r\n dstTop = (srcLeft - srcWidth / 2) * mult + srcWidth / 2;\r\n [dstWidth, dstHeight] = [dstHeight, dstWidth];\r\n if (n < 0) {\r\n dstTop -= dstHeight;\r\n } else {\r\n dstLeft -= dstWidth;\r\n }\r\n srcLeft = dstLeft;\r\n srcTop = dstTop;\r\n [srcWidth, srcHeight] = [srcHeight, srcWidth];\r\n }\r\n }\r\n\r\n dstImage.sourceLeft = dstLeft;\r\n dstImage.sourceTop = dstTop;\r\n dstImage.sourceWidth = dstWidth;\r\n dstImage.sourceHeight = dstHeight;\r\n }\r\n\r\n private _extractNinePatchSliceDataFromImage() {\r\n const width = this._domImage.width;\r\n const height = this._domImage.height;\r\n\r\n if (!this._workingCanvas) {\r\n const engine = this._host?.getScene()?.getEngine() || EngineStore.LastCreatedEngine;\r\n if (!engine) {\r\n throw new Error(\"Invalid engine. Unable to create a canvas.\");\r\n }\r\n this._workingCanvas = engine.createCanvas(width, height);\r\n }\r\n const canvas = this._workingCanvas;\r\n const context = canvas.getContext(\"2d\")!;\r\n\r\n context.drawImage(this._domImage, 0, 0, width, height);\r\n const imageData = context.getImageData(0, 0, width, height);\r\n\r\n // Left and right\r\n this._sliceLeft = -1;\r\n this._sliceRight = -1;\r\n for (let x = 0; x < width; x++) {\r\n const alpha = imageData.data[x * 4 + 3];\r\n\r\n if (alpha > 127 && this._sliceLeft === -1) {\r\n this._sliceLeft = x;\r\n continue;\r\n }\r\n\r\n if (alpha < 127 && this._sliceLeft > -1) {\r\n this._sliceRight = x;\r\n break;\r\n }\r\n }\r\n\r\n // top and bottom\r\n this._sliceTop = -1;\r\n this._sliceBottom = -1;\r\n for (let y = 0; y < height; y++) {\r\n const alpha = imageData.data[y * width * 4 + 3];\r\n\r\n if (alpha > 127 && this._sliceTop === -1) {\r\n this._sliceTop = y;\r\n continue;\r\n }\r\n\r\n if (alpha < 127 && this._sliceTop > -1) {\r\n this._sliceBottom = y;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the internal DOM image used to render the control\r\n */\r\n public set domImage(value: IImage) {\r\n this._domImage = value;\r\n this._loaded = false;\r\n this._imageDataCache.data = null;\r\n\r\n if (this._domImage.width) {\r\n this._onImageLoaded();\r\n } else {\r\n this._domImage.onload = () => {\r\n this._onImageLoaded();\r\n };\r\n }\r\n }\r\n\r\n public get domImage(): IImage {\r\n return this._domImage;\r\n }\r\n\r\n private _onImageLoaded(): void {\r\n this._imageDataCache.data = null;\r\n this._imageWidth = this._domImage.width;\r\n this._imageHeight = this._domImage.height;\r\n this._loaded = true;\r\n\r\n if (this._populateNinePatchSlicesFromImage) {\r\n this._extractNinePatchSliceDataFromImage();\r\n }\r\n\r\n if (this._autoScale) {\r\n this.synchronizeSizeWithContent();\r\n }\r\n\r\n this.onImageLoadedObservable.notifyObservers(this);\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the image source url\r\n */\r\n @serialize()\r\n public get source() {\r\n return this._source;\r\n }\r\n\r\n /**\r\n * Resets the internal Image Element cache. Can reduce memory usage.\r\n */\r\n public static ResetImageCache() {\r\n Image.SourceImgCache.clear();\r\n }\r\n\r\n private _removeCacheUsage(source: Nullable<string>) {\r\n const value = source && Image.SourceImgCache.get(source);\r\n if (value) {\r\n value.timesUsed -= 1;\r\n // Since the image isn't being used anymore, we can clean it from the cache\r\n if (value.timesUsed === 0) {\r\n Image.SourceImgCache.delete(source);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets image source url\r\n */\r\n public set source(value: Nullable<string>) {\r\n if (this._source === value) {\r\n return;\r\n }\r\n\r\n this._removeCacheUsage(this._source);\r\n\r\n this._loaded = false;\r\n this._source = value;\r\n this._imageDataCache.data = null;\r\n\r\n if (value) {\r\n value = this._svgCheck(value);\r\n }\r\n\r\n // Should abstract platform instead of using LastCreatedEngine\r\n const engine = this._host?.getScene()?.getEngine() || EngineStore.LastCreatedEngine;\r\n if (!engine) {\r\n throw new Error(\"Invalid engine. Unable to create a canvas.\");\r\n }\r\n if (value && Image.SourceImgCache.has(value)) {\r\n const cachedData = Image.SourceImgCache.get(value)!;\r\n this._domImage = cachedData.img;\r\n cachedData.timesUsed += 1;\r\n if (cachedData.loaded) {\r\n this._onImageLoaded();\r\n } else {\r\n cachedData.waitingForLoadCallback.push(this._onImageLoaded.bind(this));\r\n }\r\n return;\r\n }\r\n this._domImage = engine.createCanvasImage();\r\n if (value) {\r\n Image.SourceImgCache.set(value, { img: this._domImage, timesUsed: 1, loaded: false, waitingForLoadCallback: [this._onImageLoaded.bind(this)] });\r\n }\r\n\r\n this._domImage.onload = () => {\r\n if (value) {\r\n const cachedData = Image.SourceImgCache.get(value);\r\n if (cachedData) {\r\n cachedData.loaded = true;\r\n for (const waitingCallback of cachedData.waitingForLoadCallback) {\r\n waitingCallback();\r\n }\r\n cachedData.waitingForLoadCallback.length = 0;\r\n return;\r\n }\r\n }\r\n this._onImageLoaded();\r\n };\r\n if (value) {\r\n Tools.SetCorsBehavior(value, this._domImage);\r\n Tools.SetReferrerPolicyBehavior(this.referrerPolicy, this._domImage);\r\n this._domImage.src = value;\r\n }\r\n }\r\n\r\n /**\r\n * Checks for svg document with icon id present\r\n * @param value\r\n */\r\n private _svgCheck(value: string): string {\r\n if (window.SVGSVGElement && value.search(/.svg#/gi) !== -1 && value.indexOf(\"#\") === value.lastIndexOf(\"#\")) {\r\n this._isSVG = true;\r\n const svgsrc = value.split(\"#\")[0];\r\n const elemid = value.split(\"#\")[1];\r\n // check if object alr exist in document\r\n const svgExist = <HTMLObjectElement>document.body.querySelector('object[data=\"' + svgsrc + '\"]');\r\n if (svgExist) {\r\n const svgDoc = svgExist.contentDocument;\r\n // get viewbox width and height, get svg document width and height in px\r\n if (svgDoc && svgDoc.documentElement) {\r\n const vb = svgDoc.documentElement.getAttribute(\"viewBox\");\r\n const docwidth = Number(svgDoc.documentElement.getAttribute(\"width\"));\r\n const docheight = Number(svgDoc.documentElement.getAttribute(\"height\"));\r\n const elem = <SVGGraphicsElement>(<unknown>svgDoc.getElementById(elemid));\r\n if (elem && vb && docwidth && docheight) {\r\n this._getSVGAttribs(svgExist, elemid);\r\n return value;\r\n }\r\n }\r\n\r\n // wait for object to load\r\n svgExist.addEventListener(\"load\", () => {\r\n this._getSVGAttribs(svgExist, elemid);\r\n });\r\n } else {\r\n // create document object\r\n const svgImage = document.createElement(\"object\");\r\n svgImage.data = svgsrc;\r\n svgImage.type = \"image/svg+xml\";\r\n svgImage.width = \"0%\";\r\n svgImage.height = \"0%\";\r\n document.body.appendChild(svgImage);\r\n // when the object has loaded, get the element attribs\r\n svgImage.onload = () => {\r\n const svgobj = <HTMLObjectElement>document.body.querySelector('object[data=\"' + svgsrc + '\"]');\r\n if (svgobj) {\r\n this._getSVGAttribs(svgobj, elemid);\r\n }\r\n };\r\n }\r\n return svgsrc;\r\n } else {\r\n return value;\r\n }\r\n }\r\n\r\n /**\r\n * Sets sourceLeft, sourceTop, sourceWidth, sourceHeight automatically\r\n * given external svg file and icon id\r\n * @param svgsrc\r\n * @param elemid\r\n */\r\n private _getSVGAttribs(svgsrc: HTMLObjectElement, elemid: string) {\r\n const svgDoc = svgsrc.contentDocument;\r\n // get viewbox width and height, get svg document width and height in px\r\n if (svgDoc && svgDoc.documentElement) {\r\n const vb = svgDoc.documentElement.getAttribute(\"viewBox\");\r\n const docwidth = Number(svgDoc.documentElement.getAttribute(\"width\"));\r\n const docheight = Number(svgDoc.documentElement.getAttribute(\"height\"));\r\n // get element bbox and matrix transform\r\n const elem = svgDoc.getElementById(elemid) as Nullable<SVGGraphicsElement>;\r\n if (vb && docwidth && docheight && elem) {\r\n const vb_width = Number(vb.split(\" \")[2]);\r\n const vb_height = Number(vb.split(\" \")[3]);\r\n const elem_bbox = elem.getBBox();\r\n let elem_matrix_a = 1;\r\n let elem_matrix_d = 1;\r\n let elem_matrix_e = 0;\r\n let elem_matrix_f = 0;\r\n const mainMatrix = elem.transform.baseVal.consolidate()!.matrix;\r\n if (elem.transform && elem.transform.baseVal.consolidate()) {\r\n elem_matrix_a = mainMatrix.a;\r\n elem_matrix_d = mainMatrix.d;\r\n elem_matrix_e = mainMatrix.e;\r\n elem_matrix_f = mainMatrix.f;\r\n }\r\n\r\n // compute source coordinates and dimensions\r\n this.sourceLeft = ((elem_matrix_a * elem_bbox.x + elem_matrix_e) * docwidth) / vb_width;\r\n this.sourceTop = ((elem_matrix_d * elem_bbox.y + elem_matrix_f) * docheight) / vb_height;\r\n this.sourceWidth = elem_bbox.width * elem_matrix_a * (docwidth / vb_width);\r\n this.sourceHeight = elem_bbox.height * elem_matrix_d * (docheight / vb_height);\r\n this._svgAttributesComputationCompleted = true;\r\n this.onSVGAttributesComputedObservable.notifyObservers(this);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the cell width to use when animation sheet is enabled\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#image\r\n */\r\n @serialize()\r\n get cellWidth(): number {\r\n return this._cellWidth;\r\n }\r\n set cellWidth(value: number) {\r\n if (this._cellWidth === value) {\r\n return;\r\n }\r\n\r\n this._cellWidth = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the cell height to use when animation sheet is enabled\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#image\r\n */\r\n @serialize()\r\n get cellHeight(): number {\r\n return this._cellHeight;\r\n }\r\n set cellHeight(value: number) {\r\n if (this._cellHeight === value) {\r\n return;\r\n }\r\n\r\n this._cellHeight = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the cell id to use (this will turn on the animation sheet mode)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#image\r\n */\r\n @serialize()\r\n get cellId(): number {\r\n return this._cellId;\r\n }\r\n set cellId(value: number) {\r\n if (this._cellId === value) {\r\n return;\r\n }\r\n\r\n this._cellId = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Creates a new Image\r\n * @param name defines the control name\r\n * @param url defines the image url\r\n */\r\n constructor(\r\n public name?: string,\r\n url: Nullable<string> = null\r\n ) {\r\n super(name);\r\n this.source = url;\r\n }\r\n\r\n /**\r\n * Tests if a given coordinates belong to the current control\r\n * @param x defines x coordinate to test\r\n * @param y defines y coordinate to test\r\n * @returns true if the coordinates are inside the control\r\n */\r\n public contains(x: number, y: number): boolean {\r\n if (!super.contains(x, y)) {\r\n return false;\r\n }\r\n\r\n if (!this._detectPointerOnOpaqueOnly || !this._workingCanvas) {\r\n return true;\r\n }\r\n\r\n const width = this._currentMeasure.width | 0;\r\n const height = this._currentMeasure.height | 0;\r\n const key = width + \"_\" + height;\r\n\r\n let imageData = this._imageDataCache.data;\r\n\r\n if (!imageData || this._imageDataCache.key !== key) {\r\n const canvas = this._workingCanvas;\r\n const context = canvas.getContext(\"2d\")!;\r\n\r\n this._imageDataCache.data = imageData = context.getImageData(0, 0, width, height).data;\r\n this._imageDataCache.key = key;\r\n }\r\n\r\n x = (x - this._currentMeasure.left) | 0;\r\n y = (y - this._currentMeasure.top) | 0;\r\n\r\n const pickedPixel = imageData[(x + y * width) * 4 + 3];\r\n\r\n return pickedPixel > 0;\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Image\";\r\n }\r\n\r\n /** Force the control to synchronize with its content */\r\n public synchronizeSizeWithContent() {\r\n if (!this._loaded) {\r\n return;\r\n }\r\n\r\n this.width = this._domImage.width + \"px\";\r\n this.height = this._domImage.height + \"px\";\r\n }\r\n\r\n protected _processMeasures(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n if (this._loaded) {\r\n switch (this._stretch) {\r\n case Image.STRETCH_NONE:\r\n break;\r\n case Image.STRETCH_FILL:\r\n break;\r\n case Image.STRETCH_UNIFORM:\r\n break;\r\n case Image.STRETCH_NINE_PATCH:\r\n break;\r\n case Image.STRETCH_EXTEND:\r\n if (this._autoScale) {\r\n this.synchronizeSizeWithContent();\r\n }\r\n if (this.parent && this.parent.parent) {\r\n // Will update root size if root is not the top root\r\n this.parent.adaptWidthToChildren = true;\r\n this.parent.adaptHeightToChildren = true;\r\n }\r\n break;\r\n }\r\n }\r\n\r\n super._processMeasures(parentMeasure, context);\r\n }\r\n\r\n private _prepareWorkingCanvasForOpaqueDetection() {\r\n if (!this._detectPointerOnOpaqueOnly) {\r\n return;\r\n }\r\n\r\n const width = this._currentMeasure.width;\r\n const height = this._currentMeasure.height;\r\n\r\n if (!this._workingCanvas) {\r\n const engine = this._host?.getScene()?.getEngine() || EngineStore.LastCreatedEngine;\r\n if (!engine) {\r\n throw new Error(\"Invalid engine. Unable to create a canvas.\");\r\n }\r\n this._workingCanvas = engine.createCanvas(width, height);\r\n }\r\n const canvas = this._workingCanvas;\r\n\r\n const context = canvas.getContext(\"2d\")!;\r\n\r\n context.clearRect(0, 0, width, height);\r\n }\r\n\r\n private _drawImage(context: ICanvasRenderingContext, sx: number, sy: number, sw: number, sh: number, tx: number, ty: number, tw: number, th: number) {\r\n context.drawImage(this._domImage, sx, sy, sw, sh, tx, ty, tw, th);\r\n\r\n if (!this._detectPointerOnOpaqueOnly) {\r\n return;\r\n }\r\n\r\n const transform = context.getTransform();\r\n\r\n const canvas = this._workingCanvas!;\r\n const workingCanvasContext = canvas.getContext(\"2d\")!;\r\n workingCanvasContext.save();\r\n const ttx = tx - this._currentMeasure.left;\r\n const tty = ty - this._currentMeasure.top;\r\n workingCanvasContext.setTransform(transform.a, transform.b, transform.c, transform.d, (ttx + tw) / 2, (tty + th) / 2);\r\n workingCanvasContext.translate(-(ttx + tw) / 2, -(tty + th) / 2);\r\n\r\n workingCanvasContext.drawImage(this._domImage, sx, sy, sw, sh, ttx, tty, tw, th);\r\n workingCanvasContext.restore();\r\n }\r\n\r\n public _draw(context: ICanvasRenderingContext): void {\r\n context.save();\r\n\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n\r\n let x, y, width, height;\r\n if (this.cellId == -1) {\r\n x = this._sourceLeft;\r\n y = this._sourceTop;\r\n\r\n width = this._sourceWidth ? this._sourceWidth : this._imageWidth;\r\n height = this._sourceHeight ? this._sourceHeight : this._imageHeight;\r\n } else {\r\n const rowCount = this._domImage.naturalWidth / this.cellWidth;\r\n const column = (this.cellId / rowCount) >> 0;\r\n const row = this.cellId % rowCount;\r\n\r\n x = this.cellWidth * row;\r\n y = this.cellHeight * column;\r\n width = this.cellWidth;\r\n height = this.cellHeight;\r\n }\r\n\r\n this._prepareWorkingCanvasForOpaqueDetection();\r\n\r\n this._applyStates(context);\r\n if (this._loaded) {\r\n switch (this._stretch) {\r\n case Image.STRETCH_NONE:\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n break;\r\n case Image.STRETCH_FILL:\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n break;\r\n case Image.STRETCH_UNIFORM: {\r\n const hRatio = this._currentMeasure.width / width;\r\n const vRatio = this._currentMeasure.height / height;\r\n const ratio = Math.min(hRatio, vRatio);\r\n const centerX = (this._currentMeasure.width - width * ratio) / 2;\r\n const centerY = (this._currentMeasure.height - height * ratio) / 2;\r\n\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left + centerX, this._currentMeasure.top + centerY, width * ratio, height * ratio);\r\n break;\r\n }\r\n case Image.STRETCH_EXTEND:\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n break;\r\n case Image.STRETCH_NINE_PATCH:\r\n this._renderNinePatch(context, x, y, width, height);\r\n break;\r\n }\r\n }\r\n\r\n context.restore();\r\n }\r\n\r\n private _renderNinePatch(context: ICanvasRenderingContext, sx: number, sy: number, sw: number, sh: number): void {\r\n const leftWidth = this._sliceLeft;\r\n const topHeight = this._sliceTop;\r\n const bottomHeight = sh - this._sliceBottom;\r\n const rightWidth = sw - this._sliceRight;\r\n const centerWidth = this._sliceRight - this._sliceLeft;\r\n const centerHeight = this._sliceBottom - this._sliceTop;\r\n const targetCenterWidth = this._currentMeasure.width - rightWidth - leftWidth + 2;\r\n const targetCenterHeight = this._currentMeasure.height - bottomHeight - topHeight + 2;\r\n const centerLeftOffset = this._currentMeasure.left + leftWidth - 1;\r\n const centerTopOffset = this._currentMeasure.top + topHeight - 1;\r\n const rightOffset = this._currentMeasure.left + this._currentMeasure.width - rightWidth;\r\n const bottomOffset = this._currentMeasure.top + this._currentMeasure.height - bottomHeight;\r\n\r\n //Top Left\r\n this._drawImage(context, sx, sy, leftWidth, topHeight, this._currentMeasure.left, this._currentMeasure.top, leftWidth, topHeight);\r\n //Top\r\n this._drawImage(context, sx + this._sliceLeft, sy, centerWidth, topHeight, centerLeftOffset + 1, this._currentMeasure.top, targetCenterWidth - 2, topHeight);\r\n //Top Right\r\n this._drawImage(context, sx + this._sliceRight, sy, rightWidth, topHeight, rightOffset, this._currentMeasure.top, rightWidth, topHeight);\r\n //Left\r\n this._drawImage(context, sx, sy + this._sliceTop, leftWidth, centerHeight, this._currentMeasure.left, centerTopOffset + 1, leftWidth, targetCenterHeight - 2);\r\n // Center\r\n this._drawImage(context, sx + this._sliceLeft, sy + this._sliceTop, centerWidth, centerHeight, centerLeftOffset, centerTopOffset, targetCenterWidth, targetCenterHeight);\r\n //Right\r\n this._drawImage(context, sx + this._sliceRight, sy + this._sliceTop, rightWidth, centerHeight, rightOffset, centerTopOffset + 1, rightWidth, targetCenterHeight - 2);\r\n //Bottom Left\r\n this._drawImage(context, sx, sy + this._sliceBottom, leftWidth, bottomHeight, this._currentMeasure.left, bottomOffset, leftWidth, bottomHeight);\r\n //Bottom\r\n this._drawImage(context, sx + this.sliceLeft, sy + this._sliceBottom, centerWidth, bottomHeight, centerLeftOffset + 1, bottomOffset, targetCenterWidth - 2, bottomHeight);\r\n //Bottom Right\r\n this._drawImage(context, sx + this._sliceRight, sy + this._sliceBottom, rightWidth, bottomHeight, rightOffset, bottomOffset, rightWidth, bottomHeight);\r\n }\r\n\r\n public dispose() {\r\n super.dispose();\r\n this.onImageLoadedObservable.clear();\r\n this.onSVGAttributesComputedObservable.clear();\r\n this._removeCacheUsage(this._source);\r\n }\r\n\r\n // Static\r\n /** STRETCH_NONE */\r\n public static readonly STRETCH_NONE = 0;\r\n /** STRETCH_FILL */\r\n public static readonly STRETCH_FILL = 1;\r\n /** STRETCH_UNIFORM */\r\n public static readonly STRETCH_UNIFORM = 2;\r\n /** STRETCH_EXTEND */\r\n public static readonly STRETCH_EXTEND = 3;\r\n /** NINE_PATCH */\r\n public static readonly STRETCH_NINE_PATCH = 4;\r\n}\r\nRegisterClass(\"BABYLON.GUI.Image\", Image);\r\n"]}
1
+ {"version":3,"file":"image.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/image.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAClD,OAAO,EAAE,KAAK,EAAE,sCAAwB;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAEjD,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,OAAO;IA8D9B;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAEM,OAAO;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;;OAGG;IAEH,IAAW,yBAAyB;QAChC,OAAO,IAAI,CAAC,0BAA0B,CAAC;IAC3C,CAAC;IAED,IAAW,yBAAyB,CAAC,KAAc;QAC/C,IAAI,IAAI,CAAC,0BAA0B,KAAK,KAAK,EAAE;YAC3C,OAAO;SACV;QAED,IAAI,CAAC,0BAA0B,GAAG,KAAK,CAAC;IAC5C,CAAC;IAED;;OAEG;IAEH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,IAAW,SAAS,CAAC,KAAa;QAC9B,IAAI,IAAI,CAAC,UAAU,KAAK,KAAK,EAAE;YAC3B,OAAO;SACV;QAED,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAExB,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IAEH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAW,UAAU,CAAC,KAAa;QAC/B,IAAI,IAAI,CAAC,WAA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,YAAY,CAAC,CAAC;IAC3J,CAAC;IAEM,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,iCAAiC,CAAC,KAAK,EAAE,CAAC;QAC/C,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;;AAz5BD;;GAEG;AACW,oBAAc,GAAG,IAAI,GAAG,EAA0G,AAApH,CAAqH;AAw5BjJ,SAAS;AACT,mBAAmB;AACI,kBAAY,GAAG,CAAC,AAAJ,CAAK;AACxC,mBAAmB;AACI,kBAAY,GAAG,CAAC,AAAJ,CAAK;AACxC,sBAAsB;AACC,qBAAe,GAAG,CAAC,AAAJ,CAAK;AAC3C,qBAAqB;AACE,oBAAc,GAAG,CAAC,AAAJ,CAAK;AAC1C,iBAAiB;AACM,wBAAkB,GAAG,CAAC,AAAJ,CAAK;AAh4B9C;IADC,SAAS,EAAE;sDAGX;AAcD;IADC,SAAS,EAAE;sCAGX;AAgBD;IADC,SAAS,EAAE;uCAGX;AAgBD;IADC,SAAS,EAAE;qCAGX;AAgBD;IADC,SAAS,EAAE;wCAGX;AAgBD;IADC,SAAS,EAAE;uCAGX;AAgBD;IADC,SAAS,EAAE;sCAGX;AAgBD;IADC,SAAS,EAAE;wCAGX;AAgBD;IADC,SAAS,EAAE;yCAGX;AA8BD;IADC,SAAS,EAAE;6DAGX;AA6BD;IADC,SAAS,EAAE;sCAGX;AAgBD;IADC,SAAS,EAAE;oCAGX;AAsMD;IADC,SAAS,EAAE;mCAGX;AAmLD;IADC,SAAS,EAAE;sCAGX;AAeD;IADC,SAAS,EAAE;uCAGX;AAeD;IADC,SAAS,EAAE;mCAGX;AAkQL,aAAa,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Tools } from \"core/Misc/tools\";\r\n\r\nimport { Control } from \"./control\";\r\nimport type { Measure } from \"../measure\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvas, ICanvasRenderingContext, IImage } from \"core/Engines/ICanvas\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\n\r\n/**\r\n * Class used to create 2D images\r\n */\r\nexport class Image extends Control {\r\n /**\r\n * Specifies an alternate text for the image, if the image for some reason cannot be displayed.\r\n */\r\n public alt?: string;\r\n\r\n private _workingCanvas: Nullable<ICanvas> = null;\r\n\r\n private _domImage: IImage;\r\n private _imageWidth: number;\r\n private _imageHeight: number;\r\n private _loaded = false;\r\n private _stretch = Image.STRETCH_FILL;\r\n private _source: Nullable<string>;\r\n private _autoScale = false;\r\n\r\n private _sourceLeft = 0;\r\n private _sourceTop = 0;\r\n private _sourceWidth = 0;\r\n private _sourceHeight = 0;\r\n private _svgAttributesComputationCompleted: boolean = false;\r\n private _isSVG: boolean = false;\r\n\r\n private _cellWidth: number = 0;\r\n private _cellHeight: number = 0;\r\n private _cellId: number = -1;\r\n\r\n private _sliceLeft: number;\r\n private _sliceRight: number;\r\n private _sliceTop: number;\r\n private _sliceBottom: number;\r\n\r\n private _populateNinePatchSlicesFromImage = false;\r\n\r\n private _detectPointerOnOpaqueOnly: boolean;\r\n\r\n private _imageDataCache: {\r\n data: Uint8ClampedArray | null;\r\n key: string;\r\n } = { data: null, key: \"\" };\r\n\r\n /**\r\n * Cache of images to avoid loading the same image multiple times\r\n */\r\n public static SourceImgCache = new Map<string, { img: IImage; timesUsed: number; loaded: boolean; waitingForLoadCallback: Array<() => void> }>();\r\n\r\n /**\r\n * Observable notified when the content is loaded\r\n */\r\n public onImageLoadedObservable = new Observable<Image>();\r\n\r\n /**\r\n * Observable notified when _sourceLeft, _sourceTop, _sourceWidth and _sourceHeight are computed\r\n */\r\n public onSVGAttributesComputedObservable = new Observable<Image>();\r\n\r\n /**\r\n * Gets or sets the referrer policy to apply on the img element load request.\r\n * You should set referrerPolicy before set the source of the image if you want to ensure the header will be present on the xhr loading request\r\n */\r\n public referrerPolicy: Nullable<ReferrerPolicy>;\r\n\r\n /**\r\n * Gets a boolean indicating that the content is loaded\r\n */\r\n public get isLoaded(): boolean {\r\n return this._loaded;\r\n }\r\n\r\n public isReady(): boolean {\r\n return this.isLoaded;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if pointers should only be validated on pixels with alpha > 0.\r\n * Beware using this as this will consume more memory as the image has to be stored twice\r\n */\r\n @serialize()\r\n public get detectPointerOnOpaqueOnly(): boolean {\r\n return this._detectPointerOnOpaqueOnly;\r\n }\r\n\r\n public set detectPointerOnOpaqueOnly(value: boolean) {\r\n if (this._detectPointerOnOpaqueOnly === value) {\r\n return;\r\n }\r\n\r\n this._detectPointerOnOpaqueOnly = value;\r\n }\r\n\r\n /**\r\n * Gets or sets the left value for slicing (9-patch)\r\n */\r\n @serialize()\r\n public get sliceLeft(): number {\r\n return this._sliceLeft;\r\n }\r\n\r\n public set sliceLeft(value: number) {\r\n if (this._sliceLeft === value) {\r\n return;\r\n }\r\n\r\n this._sliceLeft = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the right value for slicing (9-patch)\r\n */\r\n @serialize()\r\n public get sliceRight(): number {\r\n return this._sliceRight;\r\n }\r\n\r\n public set sliceRight(value: number) {\r\n if (this._sliceRight === value) {\r\n return;\r\n }\r\n\r\n this._sliceRight = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the top value for slicing (9-patch)\r\n */\r\n @serialize()\r\n public get sliceTop(): number {\r\n return this._sliceTop;\r\n }\r\n\r\n public set sliceTop(value: number) {\r\n if (this._sliceTop === value) {\r\n return;\r\n }\r\n\r\n this._sliceTop = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the bottom value for slicing (9-patch)\r\n */\r\n @serialize()\r\n public get sliceBottom(): number {\r\n return this._sliceBottom;\r\n }\r\n\r\n public set sliceBottom(value: number) {\r\n if (this._sliceBottom === value) {\r\n return;\r\n }\r\n\r\n this._sliceBottom = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the left coordinate in the source image\r\n */\r\n @serialize()\r\n public get sourceLeft(): number {\r\n return this._sourceLeft;\r\n }\r\n\r\n public set sourceLeft(value: number) {\r\n if (this._sourceLeft === value) {\r\n return;\r\n }\r\n\r\n this._sourceLeft = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the top coordinate in the source image\r\n */\r\n @serialize()\r\n public get sourceTop(): number {\r\n return this._sourceTop;\r\n }\r\n\r\n public set sourceTop(value: number) {\r\n if (this._sourceTop === value) {\r\n return;\r\n }\r\n\r\n this._sourceTop = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the width to capture in the source image\r\n */\r\n @serialize()\r\n public get sourceWidth(): number {\r\n return this._sourceWidth;\r\n }\r\n\r\n public set sourceWidth(value: number) {\r\n if (this._sourceWidth === value) {\r\n return;\r\n }\r\n\r\n this._sourceWidth = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the height to capture in the source image\r\n */\r\n @serialize()\r\n public get sourceHeight(): number {\r\n return this._sourceHeight;\r\n }\r\n\r\n public set sourceHeight(value: number) {\r\n if (this._sourceHeight === value) {\r\n return;\r\n }\r\n\r\n this._sourceHeight = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the image width\r\n */\r\n public get imageWidth(): number {\r\n return this._imageWidth;\r\n }\r\n\r\n /**\r\n * Gets the image height\r\n */\r\n public get imageHeight(): number {\r\n return this._imageHeight;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if nine patch slices (left, top, right, bottom) should be read from image data\r\n */\r\n @serialize()\r\n public get populateNinePatchSlicesFromImage(): boolean {\r\n return this._populateNinePatchSlicesFromImage;\r\n }\r\n\r\n public set populateNinePatchSlicesFromImage(value: boolean) {\r\n if (this._populateNinePatchSlicesFromImage === value) {\r\n return;\r\n }\r\n\r\n this._populateNinePatchSlicesFromImage = value;\r\n\r\n if (this._populateNinePatchSlicesFromImage && this._loaded) {\r\n this._extractNinePatchSliceDataFromImage();\r\n }\r\n }\r\n\r\n /** Indicates if the format of the image is SVG */\r\n public get isSVG(): boolean {\r\n return this._isSVG;\r\n }\r\n\r\n /** Gets the status of the SVG attributes computation (sourceLeft, sourceTop, sourceWidth, sourceHeight) */\r\n public get svgAttributesComputationCompleted(): boolean {\r\n return this._svgAttributesComputationCompleted;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the image can force its container to adapt its size\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#image\r\n */\r\n @serialize()\r\n public get autoScale(): boolean {\r\n return this._autoScale;\r\n }\r\n\r\n public set autoScale(value: boolean) {\r\n if (this._autoScale === value) {\r\n return;\r\n }\r\n\r\n this._autoScale = value;\r\n\r\n if (value && this._loaded) {\r\n this.synchronizeSizeWithContent();\r\n }\r\n }\r\n\r\n /** Gets or sets the stretching mode used by the image */\r\n @serialize()\r\n public get stretch(): number {\r\n return this._stretch;\r\n }\r\n\r\n public set stretch(value: number) {\r\n if (this._stretch === value) {\r\n return;\r\n }\r\n\r\n this._stretch = value;\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _rotate90(n: number, preserveProperties: boolean = false): Image {\r\n const width = this._domImage.width;\r\n const height = this._domImage.height;\r\n\r\n // Should abstract platform instead of using LastCreatedEngine\r\n const engine = this._host?.getScene()?.getEngine() || EngineStore.LastCreatedEngine;\r\n if (!engine) {\r\n throw new Error(\"Invalid engine. Unable to create a canvas.\");\r\n }\r\n const canvas = engine.createCanvas(height, width);\r\n\r\n const context = canvas.getContext(\"2d\")!;\r\n\r\n context.translate(canvas.width / 2, canvas.height / 2);\r\n context.rotate((n * Math.PI) / 2);\r\n\r\n context.drawImage(this._domImage, 0, 0, width, height, -width / 2, -height / 2, width, height);\r\n\r\n const dataUrl: string = canvas.toDataURL(\"image/jpg\");\r\n const rotatedImage = new Image(this.name + \"rotated\", dataUrl);\r\n\r\n if (preserveProperties) {\r\n rotatedImage._stretch = this._stretch;\r\n rotatedImage._autoScale = this._autoScale;\r\n rotatedImage._cellId = this._cellId;\r\n rotatedImage._cellWidth = n % 1 ? this._cellHeight : this._cellWidth;\r\n rotatedImage._cellHeight = n % 1 ? this._cellWidth : this._cellHeight;\r\n }\r\n\r\n this._handleRotationForSVGImage(this, rotatedImage, n);\r\n\r\n this._imageDataCache.data = null;\r\n\r\n return rotatedImage;\r\n }\r\n\r\n private _handleRotationForSVGImage(srcImage: Image, dstImage: Image, n: number): void {\r\n if (!srcImage._isSVG) {\r\n return;\r\n }\r\n\r\n if (srcImage._svgAttributesComputationCompleted) {\r\n this._rotate90SourceProperties(srcImage, dstImage, n);\r\n this._markAsDirty();\r\n } else {\r\n srcImage.onSVGAttributesComputedObservable.addOnce(() => {\r\n this._rotate90SourceProperties(srcImage, dstImage, n);\r\n this._markAsDirty();\r\n });\r\n }\r\n }\r\n\r\n private _rotate90SourceProperties(srcImage: Image, dstImage: Image, n: number): void {\r\n let srcLeft = srcImage.sourceLeft,\r\n srcTop = srcImage.sourceTop,\r\n srcWidth = srcImage.domImage.width,\r\n srcHeight = srcImage.domImage.height;\r\n\r\n let dstLeft = srcLeft,\r\n dstTop = srcTop,\r\n dstWidth = srcImage.sourceWidth,\r\n dstHeight = srcImage.sourceHeight;\r\n\r\n if (n != 0) {\r\n const mult = n < 0 ? -1 : 1;\r\n n = n % 4;\r\n for (let i = 0; i < Math.abs(n); ++i) {\r\n dstLeft = -(srcTop - srcHeight / 2) * mult + srcHeight / 2;\r\n dstTop = (srcLeft - srcWidth / 2) * mult + srcWidth / 2;\r\n [dstWidth, dstHeight] = [dstHeight, dstWidth];\r\n if (n < 0) {\r\n dstTop -= dstHeight;\r\n } else {\r\n dstLeft -= dstWidth;\r\n }\r\n srcLeft = dstLeft;\r\n srcTop = dstTop;\r\n [srcWidth, srcHeight] = [srcHeight, srcWidth];\r\n }\r\n }\r\n\r\n dstImage.sourceLeft = dstLeft;\r\n dstImage.sourceTop = dstTop;\r\n dstImage.sourceWidth = dstWidth;\r\n dstImage.sourceHeight = dstHeight;\r\n }\r\n\r\n private _extractNinePatchSliceDataFromImage() {\r\n const width = this._domImage.width;\r\n const height = this._domImage.height;\r\n\r\n if (!this._workingCanvas) {\r\n const engine = this._host?.getScene()?.getEngine() || EngineStore.LastCreatedEngine;\r\n if (!engine) {\r\n throw new Error(\"Invalid engine. Unable to create a canvas.\");\r\n }\r\n this._workingCanvas = engine.createCanvas(width, height);\r\n }\r\n const canvas = this._workingCanvas;\r\n const context = canvas.getContext(\"2d\")!;\r\n\r\n context.drawImage(this._domImage, 0, 0, width, height);\r\n const imageData = context.getImageData(0, 0, width, height);\r\n\r\n // Left and right\r\n this._sliceLeft = -1;\r\n this._sliceRight = -1;\r\n for (let x = 0; x < width; x++) {\r\n const alpha = imageData.data[x * 4 + 3];\r\n\r\n if (alpha > 127 && this._sliceLeft === -1) {\r\n this._sliceLeft = x;\r\n continue;\r\n }\r\n\r\n if (alpha < 127 && this._sliceLeft > -1) {\r\n this._sliceRight = x;\r\n break;\r\n }\r\n }\r\n\r\n // top and bottom\r\n this._sliceTop = -1;\r\n this._sliceBottom = -1;\r\n for (let y = 0; y < height; y++) {\r\n const alpha = imageData.data[y * width * 4 + 3];\r\n\r\n if (alpha > 127 && this._sliceTop === -1) {\r\n this._sliceTop = y;\r\n continue;\r\n }\r\n\r\n if (alpha < 127 && this._sliceTop > -1) {\r\n this._sliceBottom = y;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the internal DOM image used to render the control\r\n */\r\n public set domImage(value: IImage) {\r\n this._domImage = value;\r\n this._loaded = false;\r\n this._imageDataCache.data = null;\r\n\r\n if (this._domImage.width) {\r\n this._onImageLoaded();\r\n } else {\r\n this._domImage.onload = () => {\r\n this._onImageLoaded();\r\n };\r\n }\r\n }\r\n\r\n public get domImage(): IImage {\r\n return this._domImage;\r\n }\r\n\r\n private _onImageLoaded(): void {\r\n this._imageDataCache.data = null;\r\n this._imageWidth = this._domImage.width;\r\n this._imageHeight = this._domImage.height;\r\n this._loaded = true;\r\n\r\n if (this._populateNinePatchSlicesFromImage) {\r\n this._extractNinePatchSliceDataFromImage();\r\n }\r\n\r\n if (this._autoScale) {\r\n this.synchronizeSizeWithContent();\r\n }\r\n\r\n this.onImageLoadedObservable.notifyObservers(this);\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets the image source url\r\n */\r\n @serialize()\r\n public get source() {\r\n return this._source;\r\n }\r\n\r\n /**\r\n * Resets the internal Image Element cache. Can reduce memory usage.\r\n */\r\n public static ResetImageCache() {\r\n Image.SourceImgCache.clear();\r\n }\r\n\r\n private _removeCacheUsage(source: Nullable<string>) {\r\n const value = source && Image.SourceImgCache.get(source);\r\n if (value) {\r\n value.timesUsed -= 1;\r\n // Since the image isn't being used anymore, we can clean it from the cache\r\n if (value.timesUsed === 0) {\r\n Image.SourceImgCache.delete(source);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets image source url\r\n */\r\n public set source(value: Nullable<string>) {\r\n if (this._source === value) {\r\n return;\r\n }\r\n\r\n this._removeCacheUsage(this._source);\r\n\r\n this._loaded = false;\r\n this._source = value;\r\n this._imageDataCache.data = null;\r\n\r\n if (value) {\r\n value = this._svgCheck(value);\r\n }\r\n\r\n // Should abstract platform instead of using LastCreatedEngine\r\n const engine = this._host?.getScene()?.getEngine() || EngineStore.LastCreatedEngine;\r\n if (!engine) {\r\n throw new Error(\"Invalid engine. Unable to create a canvas.\");\r\n }\r\n if (value && Image.SourceImgCache.has(value)) {\r\n const cachedData = Image.SourceImgCache.get(value)!;\r\n this._domImage = cachedData.img;\r\n cachedData.timesUsed += 1;\r\n if (cachedData.loaded) {\r\n this._onImageLoaded();\r\n } else {\r\n cachedData.waitingForLoadCallback.push(this._onImageLoaded.bind(this));\r\n }\r\n return;\r\n }\r\n this._domImage = engine.createCanvasImage();\r\n if (value) {\r\n Image.SourceImgCache.set(value, { img: this._domImage, timesUsed: 1, loaded: false, waitingForLoadCallback: [this._onImageLoaded.bind(this)] });\r\n }\r\n\r\n this._domImage.onload = () => {\r\n if (value) {\r\n const cachedData = Image.SourceImgCache.get(value);\r\n if (cachedData) {\r\n cachedData.loaded = true;\r\n for (const waitingCallback of cachedData.waitingForLoadCallback) {\r\n waitingCallback();\r\n }\r\n cachedData.waitingForLoadCallback.length = 0;\r\n return;\r\n }\r\n }\r\n this._onImageLoaded();\r\n };\r\n if (value) {\r\n Tools.SetCorsBehavior(value, this._domImage);\r\n Tools.SetReferrerPolicyBehavior(this.referrerPolicy, this._domImage);\r\n this._domImage.src = value;\r\n }\r\n }\r\n\r\n /**\r\n * Checks for svg document with icon id present\r\n * @param value the source svg\r\n * @returns the svg\r\n */\r\n private _svgCheck(value: string): string {\r\n if (window.SVGSVGElement && value.search(/.svg#/gi) !== -1 && value.indexOf(\"#\") === value.lastIndexOf(\"#\")) {\r\n this._isSVG = true;\r\n const svgsrc = value.split(\"#\")[0];\r\n const elemid = value.split(\"#\")[1];\r\n // check if object alr exist in document\r\n const svgExist = <HTMLObjectElement>document.body.querySelector('object[data=\"' + svgsrc + '\"]');\r\n if (svgExist) {\r\n const svgDoc = svgExist.contentDocument;\r\n // get viewbox width and height, get svg document width and height in px\r\n if (svgDoc && svgDoc.documentElement) {\r\n const vb = svgDoc.documentElement.getAttribute(\"viewBox\");\r\n const docwidth = Number(svgDoc.documentElement.getAttribute(\"width\"));\r\n const docheight = Number(svgDoc.documentElement.getAttribute(\"height\"));\r\n const elem = <SVGGraphicsElement>(<unknown>svgDoc.getElementById(elemid));\r\n if (elem && vb && docwidth && docheight) {\r\n this._getSVGAttribs(svgExist, elemid);\r\n return value;\r\n }\r\n }\r\n\r\n // wait for object to load\r\n svgExist.addEventListener(\"load\", () => {\r\n this._getSVGAttribs(svgExist, elemid);\r\n });\r\n } else {\r\n // create document object\r\n const svgImage = document.createElement(\"object\");\r\n svgImage.data = svgsrc;\r\n svgImage.type = \"image/svg+xml\";\r\n svgImage.width = \"0%\";\r\n svgImage.height = \"0%\";\r\n document.body.appendChild(svgImage);\r\n // when the object has loaded, get the element attribs\r\n svgImage.onload = () => {\r\n const svgobj = <HTMLObjectElement>document.body.querySelector('object[data=\"' + svgsrc + '\"]');\r\n if (svgobj) {\r\n this._getSVGAttribs(svgobj, elemid);\r\n }\r\n };\r\n }\r\n return svgsrc;\r\n } else {\r\n return value;\r\n }\r\n }\r\n\r\n /**\r\n * Sets sourceLeft, sourceTop, sourceWidth, sourceHeight automatically\r\n * given external svg file and icon id\r\n * @param svgsrc\r\n * @param elemid\r\n */\r\n private _getSVGAttribs(svgsrc: HTMLObjectElement, elemid: string) {\r\n const svgDoc = svgsrc.contentDocument;\r\n // get viewbox width and height, get svg document width and height in px\r\n if (svgDoc && svgDoc.documentElement) {\r\n const vb = svgDoc.documentElement.getAttribute(\"viewBox\");\r\n const docwidth = Number(svgDoc.documentElement.getAttribute(\"width\"));\r\n const docheight = Number(svgDoc.documentElement.getAttribute(\"height\"));\r\n // get element bbox and matrix transform\r\n const elem = svgDoc.getElementById(elemid) as Nullable<SVGGraphicsElement>;\r\n if (vb && docwidth && docheight && elem) {\r\n const vb_width = Number(vb.split(\" \")[2]);\r\n const vb_height = Number(vb.split(\" \")[3]);\r\n const elem_bbox = elem.getBBox();\r\n let elem_matrix_a = 1;\r\n let elem_matrix_d = 1;\r\n let elem_matrix_e = 0;\r\n let elem_matrix_f = 0;\r\n const mainMatrix = elem.transform.baseVal.consolidate()!.matrix;\r\n if (elem.transform && elem.transform.baseVal.consolidate()) {\r\n elem_matrix_a = mainMatrix.a;\r\n elem_matrix_d = mainMatrix.d;\r\n elem_matrix_e = mainMatrix.e;\r\n elem_matrix_f = mainMatrix.f;\r\n }\r\n\r\n // compute source coordinates and dimensions\r\n this.sourceLeft = ((elem_matrix_a * elem_bbox.x + elem_matrix_e) * docwidth) / vb_width;\r\n this.sourceTop = ((elem_matrix_d * elem_bbox.y + elem_matrix_f) * docheight) / vb_height;\r\n this.sourceWidth = elem_bbox.width * elem_matrix_a * (docwidth / vb_width);\r\n this.sourceHeight = elem_bbox.height * elem_matrix_d * (docheight / vb_height);\r\n this._svgAttributesComputationCompleted = true;\r\n this.onSVGAttributesComputedObservable.notifyObservers(this);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the cell width to use when animation sheet is enabled\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#image\r\n */\r\n @serialize()\r\n get cellWidth(): number {\r\n return this._cellWidth;\r\n }\r\n set cellWidth(value: number) {\r\n if (this._cellWidth === value) {\r\n return;\r\n }\r\n\r\n this._cellWidth = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the cell height to use when animation sheet is enabled\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#image\r\n */\r\n @serialize()\r\n get cellHeight(): number {\r\n return this._cellHeight;\r\n }\r\n set cellHeight(value: number) {\r\n if (this._cellHeight === value) {\r\n return;\r\n }\r\n\r\n this._cellHeight = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the cell id to use (this will turn on the animation sheet mode)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#image\r\n */\r\n @serialize()\r\n get cellId(): number {\r\n return this._cellId;\r\n }\r\n set cellId(value: number) {\r\n if (this._cellId === value) {\r\n return;\r\n }\r\n\r\n this._cellId = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Creates a new Image\r\n * @param name defines the control name\r\n * @param url defines the image url\r\n */\r\n constructor(\r\n public name?: string,\r\n url: Nullable<string> = null\r\n ) {\r\n super(name);\r\n this.source = url;\r\n }\r\n\r\n /**\r\n * Tests if a given coordinates belong to the current control\r\n * @param x defines x coordinate to test\r\n * @param y defines y coordinate to test\r\n * @returns true if the coordinates are inside the control\r\n */\r\n public contains(x: number, y: number): boolean {\r\n if (!super.contains(x, y)) {\r\n return false;\r\n }\r\n\r\n if (!this._detectPointerOnOpaqueOnly || !this._workingCanvas) {\r\n return true;\r\n }\r\n\r\n const width = this._currentMeasure.width | 0;\r\n const height = this._currentMeasure.height | 0;\r\n const key = width + \"_\" + height;\r\n\r\n let imageData = this._imageDataCache.data;\r\n\r\n if (!imageData || this._imageDataCache.key !== key) {\r\n const canvas = this._workingCanvas;\r\n const context = canvas.getContext(\"2d\")!;\r\n\r\n this._imageDataCache.data = imageData = context.getImageData(0, 0, width, height).data;\r\n this._imageDataCache.key = key;\r\n }\r\n\r\n x = (x - this._currentMeasure.left) | 0;\r\n y = (y - this._currentMeasure.top) | 0;\r\n\r\n const pickedPixel = imageData[(x + y * width) * 4 + 3];\r\n\r\n return pickedPixel > 0;\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Image\";\r\n }\r\n\r\n /** Force the control to synchronize with its content */\r\n public synchronizeSizeWithContent() {\r\n if (!this._loaded) {\r\n return;\r\n }\r\n\r\n this.width = this._domImage.width + \"px\";\r\n this.height = this._domImage.height + \"px\";\r\n }\r\n\r\n protected _processMeasures(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n if (this._loaded) {\r\n switch (this._stretch) {\r\n case Image.STRETCH_NONE:\r\n break;\r\n case Image.STRETCH_FILL:\r\n break;\r\n case Image.STRETCH_UNIFORM:\r\n break;\r\n case Image.STRETCH_NINE_PATCH:\r\n break;\r\n case Image.STRETCH_EXTEND:\r\n if (this._autoScale) {\r\n this.synchronizeSizeWithContent();\r\n }\r\n if (this.parent && this.parent.parent) {\r\n // Will update root size if root is not the top root\r\n this.parent.adaptWidthToChildren = true;\r\n this.parent.adaptHeightToChildren = true;\r\n }\r\n break;\r\n }\r\n }\r\n\r\n super._processMeasures(parentMeasure, context);\r\n }\r\n\r\n private _prepareWorkingCanvasForOpaqueDetection() {\r\n if (!this._detectPointerOnOpaqueOnly) {\r\n return;\r\n }\r\n\r\n const width = this._currentMeasure.width;\r\n const height = this._currentMeasure.height;\r\n\r\n if (!this._workingCanvas) {\r\n const engine = this._host?.getScene()?.getEngine() || EngineStore.LastCreatedEngine;\r\n if (!engine) {\r\n throw new Error(\"Invalid engine. Unable to create a canvas.\");\r\n }\r\n this._workingCanvas = engine.createCanvas(width, height);\r\n }\r\n const canvas = this._workingCanvas;\r\n\r\n const context = canvas.getContext(\"2d\")!;\r\n\r\n context.clearRect(0, 0, width, height);\r\n }\r\n\r\n private _drawImage(context: ICanvasRenderingContext, sx: number, sy: number, sw: number, sh: number, tx: number, ty: number, tw: number, th: number) {\r\n context.drawImage(this._domImage, sx, sy, sw, sh, tx, ty, tw, th);\r\n\r\n if (!this._detectPointerOnOpaqueOnly) {\r\n return;\r\n }\r\n\r\n const transform = context.getTransform();\r\n\r\n const canvas = this._workingCanvas!;\r\n const workingCanvasContext = canvas.getContext(\"2d\")!;\r\n workingCanvasContext.save();\r\n const ttx = tx - this._currentMeasure.left;\r\n const tty = ty - this._currentMeasure.top;\r\n workingCanvasContext.setTransform(transform.a, transform.b, transform.c, transform.d, (ttx + tw) / 2, (tty + th) / 2);\r\n workingCanvasContext.translate(-(ttx + tw) / 2, -(tty + th) / 2);\r\n\r\n workingCanvasContext.drawImage(this._domImage, sx, sy, sw, sh, ttx, tty, tw, th);\r\n workingCanvasContext.restore();\r\n }\r\n\r\n public _draw(context: ICanvasRenderingContext): void {\r\n context.save();\r\n\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n\r\n let x, y, width, height;\r\n if (this.cellId == -1) {\r\n x = this._sourceLeft;\r\n y = this._sourceTop;\r\n\r\n width = this._sourceWidth ? this._sourceWidth : this._imageWidth;\r\n height = this._sourceHeight ? this._sourceHeight : this._imageHeight;\r\n } else {\r\n const rowCount = this._domImage.naturalWidth / this.cellWidth;\r\n const column = (this.cellId / rowCount) >> 0;\r\n const row = this.cellId % rowCount;\r\n\r\n x = this.cellWidth * row;\r\n y = this.cellHeight * column;\r\n width = this.cellWidth;\r\n height = this.cellHeight;\r\n }\r\n\r\n this._prepareWorkingCanvasForOpaqueDetection();\r\n\r\n this._applyStates(context);\r\n if (this._loaded) {\r\n switch (this._stretch) {\r\n case Image.STRETCH_NONE:\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n break;\r\n case Image.STRETCH_FILL:\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n break;\r\n case Image.STRETCH_UNIFORM: {\r\n const hRatio = this._currentMeasure.width / width;\r\n const vRatio = this._currentMeasure.height / height;\r\n const ratio = Math.min(hRatio, vRatio);\r\n const centerX = (this._currentMeasure.width - width * ratio) / 2;\r\n const centerY = (this._currentMeasure.height - height * ratio) / 2;\r\n\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left + centerX, this._currentMeasure.top + centerY, width * ratio, height * ratio);\r\n break;\r\n }\r\n case Image.STRETCH_EXTEND:\r\n this._drawImage(context, x, y, width, height, this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n break;\r\n case Image.STRETCH_NINE_PATCH:\r\n this._renderNinePatch(context, x, y, width, height);\r\n break;\r\n }\r\n }\r\n\r\n context.restore();\r\n }\r\n\r\n private _renderNinePatch(context: ICanvasRenderingContext, sx: number, sy: number, sw: number, sh: number): void {\r\n const leftWidth = this._sliceLeft;\r\n const topHeight = this._sliceTop;\r\n const bottomHeight = sh - this._sliceBottom;\r\n const rightWidth = sw - this._sliceRight;\r\n const centerWidth = this._sliceRight - this._sliceLeft;\r\n const centerHeight = this._sliceBottom - this._sliceTop;\r\n const targetCenterWidth = this._currentMeasure.width - rightWidth - leftWidth + 2;\r\n const targetCenterHeight = this._currentMeasure.height - bottomHeight - topHeight + 2;\r\n const centerLeftOffset = this._currentMeasure.left + leftWidth - 1;\r\n const centerTopOffset = this._currentMeasure.top + topHeight - 1;\r\n const rightOffset = this._currentMeasure.left + this._currentMeasure.width - rightWidth;\r\n const bottomOffset = this._currentMeasure.top + this._currentMeasure.height - bottomHeight;\r\n\r\n //Top Left\r\n this._drawImage(context, sx, sy, leftWidth, topHeight, this._currentMeasure.left, this._currentMeasure.top, leftWidth, topHeight);\r\n //Top\r\n this._drawImage(context, sx + this._sliceLeft, sy, centerWidth, topHeight, centerLeftOffset + 1, this._currentMeasure.top, targetCenterWidth - 2, topHeight);\r\n //Top Right\r\n this._drawImage(context, sx + this._sliceRight, sy, rightWidth, topHeight, rightOffset, this._currentMeasure.top, rightWidth, topHeight);\r\n //Left\r\n this._drawImage(context, sx, sy + this._sliceTop, leftWidth, centerHeight, this._currentMeasure.left, centerTopOffset + 1, leftWidth, targetCenterHeight - 2);\r\n // Center\r\n this._drawImage(context, sx + this._sliceLeft, sy + this._sliceTop, centerWidth, centerHeight, centerLeftOffset, centerTopOffset, targetCenterWidth, targetCenterHeight);\r\n //Right\r\n this._drawImage(context, sx + this._sliceRight, sy + this._sliceTop, rightWidth, centerHeight, rightOffset, centerTopOffset + 1, rightWidth, targetCenterHeight - 2);\r\n //Bottom Left\r\n this._drawImage(context, sx, sy + this._sliceBottom, leftWidth, bottomHeight, this._currentMeasure.left, bottomOffset, leftWidth, bottomHeight);\r\n //Bottom\r\n this._drawImage(context, sx + this.sliceLeft, sy + this._sliceBottom, centerWidth, bottomHeight, centerLeftOffset + 1, bottomOffset, targetCenterWidth - 2, bottomHeight);\r\n //Bottom Right\r\n this._drawImage(context, sx + this._sliceRight, sy + this._sliceBottom, rightWidth, bottomHeight, rightOffset, bottomOffset, rightWidth, bottomHeight);\r\n }\r\n\r\n public dispose() {\r\n super.dispose();\r\n this.onImageLoadedObservable.clear();\r\n this.onSVGAttributesComputedObservable.clear();\r\n this._removeCacheUsage(this._source);\r\n }\r\n\r\n // Static\r\n /** STRETCH_NONE */\r\n public static readonly STRETCH_NONE = 0;\r\n /** STRETCH_FILL */\r\n public static readonly STRETCH_FILL = 1;\r\n /** STRETCH_UNIFORM */\r\n public static readonly STRETCH_UNIFORM = 2;\r\n /** STRETCH_EXTEND */\r\n public static readonly STRETCH_EXTEND = 3;\r\n /** NINE_PATCH */\r\n public static readonly STRETCH_NINE_PATCH = 4;\r\n}\r\nRegisterClass(\"BABYLON.GUI.Image\", Image);\r\n"]}
@@ -53,8 +53,9 @@ export declare class StackPanel extends Container {
53
53
  /**
54
54
  * Serializes the current control
55
55
  * @param serializationObject defined the JSON serialized object
56
+ * @param force force serialization even if isSerializable === false
56
57
  */
57
- serialize(serializationObject: any): void;
58
+ serialize(serializationObject: any, force: boolean): void;
58
59
  /**
59
60
  * @internal
60
61
  */
@@ -203,9 +203,13 @@ export class StackPanel extends Container {
203
203
  /**
204
204
  * Serializes the current control
205
205
  * @param serializationObject defined the JSON serialized object
206
+ * @param force force serialization even if isSerializable === false
206
207
  */
207
- serialize(serializationObject) {
208
- super.serialize(serializationObject);
208
+ serialize(serializationObject, force) {
209
+ super.serialize(serializationObject, force);
210
+ if (!this.isSerializable && !force) {
211
+ return;
212
+ }
209
213
  serializationObject.manualWidth = this._manualWidth;
210
214
  serializationObject.manualHeight = this._manualHeight;
211
215
  }
@@ -1 +1 @@
1
- {"version":3,"file":"stackPanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/stackPanel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAA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AU,CAAC,CAAC","sourcesContent":["import { Container } from \"./container\";\r\nimport type { Measure } from \"../measure\";\r\nimport { Control } from \"./control\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Class used to create a 2D stack panel container\r\n */\r\nexport class StackPanel extends Container {\r\n private _isVertical = true;\r\n private _manualWidth = false;\r\n private _manualHeight = false;\r\n private _doNotTrackManualChanges = false;\r\n private _spacing = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that layout warnings should be ignored\r\n */\r\n @serialize()\r\n public ignoreLayoutWarnings = false;\r\n\r\n /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/\r\n @serialize()\r\n public get isVertical(): boolean {\r\n return this._isVertical;\r\n }\r\n\r\n public set isVertical(value: boolean) {\r\n if (this._isVertical === value) {\r\n return;\r\n }\r\n\r\n this._isVertical = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the spacing (in pixels) between each child.\r\n */\r\n @serialize()\r\n public get spacing(): number {\r\n return this._spacing;\r\n }\r\n\r\n public set spacing(value: number) {\r\n if (this._spacing === value) {\r\n return;\r\n }\r\n\r\n this._spacing = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets panel width.\r\n * This value should not be set when in horizontal mode as it will be computed automatically\r\n */\r\n @serialize()\r\n public set width(value: string | number) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualWidth = true;\r\n }\r\n\r\n if (this._width.toString(this._host) === value) {\r\n return;\r\n }\r\n\r\n if (this._width.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n public get width(): string | number {\r\n return this._width.toString(this._host);\r\n }\r\n\r\n /**\r\n * Gets or sets panel height.\r\n * This value should not be set when in vertical mode as it will be computed automatically\r\n */\r\n @serialize()\r\n public set height(value: string | number) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualHeight = true;\r\n }\r\n\r\n if (this._height.toString(this._host) === value) {\r\n return;\r\n }\r\n\r\n if (this._height.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n public get height(): string | number {\r\n return this._height.toString(this._host);\r\n }\r\n\r\n /**\r\n * Creates a new StackPanel\r\n * @param name defines control name\r\n */\r\n constructor(public name?: string) {\r\n super(name);\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"StackPanel\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _preMeasure(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n for (const child of this._children) {\r\n if (this._isVertical) {\r\n child.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n } else {\r\n child.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n }\r\n }\r\n\r\n super._preMeasure(parentMeasure, context);\r\n }\r\n\r\n protected _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n super._additionalProcessing(parentMeasure, context);\r\n\r\n this._measureForChildren.copyFrom(parentMeasure);\r\n\r\n this._measureForChildren.left = this._currentMeasure.left;\r\n this._measureForChildren.top = this._currentMeasure.top;\r\n\r\n if (!this.isVertical || this._manualWidth) {\r\n this._measureForChildren.width = this._currentMeasure.width;\r\n }\r\n\r\n if (this.isVertical || this._manualHeight) {\r\n this._measureForChildren.height = this._currentMeasure.height;\r\n }\r\n }\r\n\r\n protected _postMeasure(): void {\r\n let stackWidth = 0;\r\n let stackHeight = 0;\r\n const childrenCount = this._children.length;\r\n for (let index = 0; index < childrenCount; index++) {\r\n const child = this._children[index];\r\n if (!child.isVisible || child.notRenderable) {\r\n continue;\r\n }\r\n\r\n if (this._isVertical) {\r\n if (child.top !== stackHeight + \"px\") {\r\n child.top = stackHeight + \"px\";\r\n this._rebuildLayout = true;\r\n child._top.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined(\"height\")) {\r\n Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using height in percentage mode inside a vertical StackPanel`, 1);\r\n } else {\r\n stackHeight += child._currentMeasure.height + child._paddingTopInPixels + child._paddingBottomInPixels + (index < childrenCount - 1 ? this._spacing : 0);\r\n }\r\n } else {\r\n if (child.left !== stackWidth + \"px\") {\r\n child.left = stackWidth + \"px\";\r\n this._rebuildLayout = true;\r\n child._left.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined(\"width\")) {\r\n Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using width in percentage mode inside a horizontal StackPanel`, 1);\r\n } else {\r\n stackWidth += child._currentMeasure.width + child._paddingLeftInPixels + child._paddingRightInPixels + (index < childrenCount - 1 ? this._spacing : 0);\r\n }\r\n }\r\n }\r\n\r\n stackWidth += this._paddingLeftInPixels + this._paddingRightInPixels;\r\n stackHeight += this._paddingTopInPixels + this._paddingBottomInPixels;\r\n\r\n this._doNotTrackManualChanges = true;\r\n\r\n // Let stack panel width or height default to stackHeight and stackWidth if dimensions are not specified.\r\n // User can now define their own height and width for stack panel.\r\n\r\n let panelWidthChanged = false;\r\n let panelHeightChanged = false;\r\n\r\n if ((!this._manualHeight || this.adaptHeightToChildren) && this._isVertical) {\r\n // do not specify height if strictly defined by user\r\n const previousHeight = this.height;\r\n this.height = stackHeight + \"px\";\r\n panelHeightChanged = previousHeight !== this.height || !this._height.ignoreAdaptiveScaling;\r\n }\r\n if ((!this._manualWidth || this.adaptWidthToChildren) && !this._isVertical) {\r\n // do not specify width if strictly defined by user\r\n const previousWidth = this.width;\r\n this.width = stackWidth + \"px\";\r\n panelWidthChanged = previousWidth !== this.width || !this._width.ignoreAdaptiveScaling;\r\n }\r\n\r\n if (panelHeightChanged) {\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (panelWidthChanged) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n this._doNotTrackManualChanges = false;\r\n\r\n if (panelWidthChanged || panelHeightChanged) {\r\n this._rebuildLayout = true;\r\n }\r\n\r\n super._postMeasure();\r\n }\r\n\r\n private _getManualDim(dim: \"width\" | \"height\") {\r\n if (dim === \"width\") {\r\n return this._manualWidth;\r\n } else {\r\n return this._manualHeight;\r\n }\r\n }\r\n\r\n public isDimensionFullyDefined(dim: \"width\" | \"height\"): boolean {\r\n if (dim === \"height\" ? this.isVertical : !this.isVertical && !this._getManualDim(dim)) {\r\n for (const child of this._children) {\r\n if (!child.isDimensionFullyDefined(dim)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n return this.getDimension(dim).isPixel || this._getAdaptDimTo(dim);\r\n }\r\n\r\n /**\r\n * Serializes the current control\r\n * @param serializationObject defined the JSON serialized object\r\n */\r\n public serialize(serializationObject: any) {\r\n super.serialize(serializationObject);\r\n serializationObject.manualWidth = this._manualWidth;\r\n serializationObject.manualHeight = this._manualHeight;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n this._manualWidth = serializedObject.manualWidth;\r\n this._manualHeight = serializedObject.manualHeight;\r\n\r\n super._parseFromContent(serializedObject, host);\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.StackPanel\", StackPanel);\r\n"]}
1
+ {"version":3,"file":"stackPanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/stackPanel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAGjD,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAE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AA6KL,aAAa,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { Container } from \"./container\";\r\nimport type { Measure } from \"../measure\";\r\nimport { Control } from \"./control\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Class used to create a 2D stack panel container\r\n */\r\nexport class StackPanel extends Container {\r\n private _isVertical = true;\r\n private _manualWidth = false;\r\n private _manualHeight = false;\r\n private _doNotTrackManualChanges = false;\r\n private _spacing = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that layout warnings should be ignored\r\n */\r\n @serialize()\r\n public ignoreLayoutWarnings = false;\r\n\r\n /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/\r\n @serialize()\r\n public get isVertical(): boolean {\r\n return this._isVertical;\r\n }\r\n\r\n public set isVertical(value: boolean) {\r\n if (this._isVertical === value) {\r\n return;\r\n }\r\n\r\n this._isVertical = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the spacing (in pixels) between each child.\r\n */\r\n @serialize()\r\n public get spacing(): number {\r\n return this._spacing;\r\n }\r\n\r\n public set spacing(value: number) {\r\n if (this._spacing === value) {\r\n return;\r\n }\r\n\r\n this._spacing = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets panel width.\r\n * This value should not be set when in horizontal mode as it will be computed automatically\r\n */\r\n @serialize()\r\n public set width(value: string | number) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualWidth = true;\r\n }\r\n\r\n if (this._width.toString(this._host) === value) {\r\n return;\r\n }\r\n\r\n if (this._width.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n public get width(): string | number {\r\n return this._width.toString(this._host);\r\n }\r\n\r\n /**\r\n * Gets or sets panel height.\r\n * This value should not be set when in vertical mode as it will be computed automatically\r\n */\r\n @serialize()\r\n public set height(value: string | number) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualHeight = true;\r\n }\r\n\r\n if (this._height.toString(this._host) === value) {\r\n return;\r\n }\r\n\r\n if (this._height.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n public get height(): string | number {\r\n return this._height.toString(this._host);\r\n }\r\n\r\n /**\r\n * Creates a new StackPanel\r\n * @param name defines control name\r\n */\r\n constructor(public name?: string) {\r\n super(name);\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"StackPanel\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _preMeasure(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n for (const child of this._children) {\r\n if (this._isVertical) {\r\n child.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n } else {\r\n child.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n }\r\n }\r\n\r\n super._preMeasure(parentMeasure, context);\r\n }\r\n\r\n protected _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n super._additionalProcessing(parentMeasure, context);\r\n\r\n this._measureForChildren.copyFrom(parentMeasure);\r\n\r\n this._measureForChildren.left = this._currentMeasure.left;\r\n this._measureForChildren.top = this._currentMeasure.top;\r\n\r\n if (!this.isVertical || this._manualWidth) {\r\n this._measureForChildren.width = this._currentMeasure.width;\r\n }\r\n\r\n if (this.isVertical || this._manualHeight) {\r\n this._measureForChildren.height = this._currentMeasure.height;\r\n }\r\n }\r\n\r\n protected _postMeasure(): void {\r\n let stackWidth = 0;\r\n let stackHeight = 0;\r\n const childrenCount = this._children.length;\r\n for (let index = 0; index < childrenCount; index++) {\r\n const child = this._children[index];\r\n if (!child.isVisible || child.notRenderable) {\r\n continue;\r\n }\r\n\r\n if (this._isVertical) {\r\n if (child.top !== stackHeight + \"px\") {\r\n child.top = stackHeight + \"px\";\r\n this._rebuildLayout = true;\r\n child._top.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined(\"height\")) {\r\n Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using height in percentage mode inside a vertical StackPanel`, 1);\r\n } else {\r\n stackHeight += child._currentMeasure.height + child._paddingTopInPixels + child._paddingBottomInPixels + (index < childrenCount - 1 ? this._spacing : 0);\r\n }\r\n } else {\r\n if (child.left !== stackWidth + \"px\") {\r\n child.left = stackWidth + \"px\";\r\n this._rebuildLayout = true;\r\n child._left.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined(\"width\")) {\r\n Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using width in percentage mode inside a horizontal StackPanel`, 1);\r\n } else {\r\n stackWidth += child._currentMeasure.width + child._paddingLeftInPixels + child._paddingRightInPixels + (index < childrenCount - 1 ? this._spacing : 0);\r\n }\r\n }\r\n }\r\n\r\n stackWidth += this._paddingLeftInPixels + this._paddingRightInPixels;\r\n stackHeight += this._paddingTopInPixels + this._paddingBottomInPixels;\r\n\r\n this._doNotTrackManualChanges = true;\r\n\r\n // Let stack panel width or height default to stackHeight and stackWidth if dimensions are not specified.\r\n // User can now define their own height and width for stack panel.\r\n\r\n let panelWidthChanged = false;\r\n let panelHeightChanged = false;\r\n\r\n if ((!this._manualHeight || this.adaptHeightToChildren) && this._isVertical) {\r\n // do not specify height if strictly defined by user\r\n const previousHeight = this.height;\r\n this.height = stackHeight + \"px\";\r\n panelHeightChanged = previousHeight !== this.height || !this._height.ignoreAdaptiveScaling;\r\n }\r\n if ((!this._manualWidth || this.adaptWidthToChildren) && !this._isVertical) {\r\n // do not specify width if strictly defined by user\r\n const previousWidth = this.width;\r\n this.width = stackWidth + \"px\";\r\n panelWidthChanged = previousWidth !== this.width || !this._width.ignoreAdaptiveScaling;\r\n }\r\n\r\n if (panelHeightChanged) {\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (panelWidthChanged) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n this._doNotTrackManualChanges = false;\r\n\r\n if (panelWidthChanged || panelHeightChanged) {\r\n this._rebuildLayout = true;\r\n }\r\n\r\n super._postMeasure();\r\n }\r\n\r\n private _getManualDim(dim: \"width\" | \"height\") {\r\n if (dim === \"width\") {\r\n return this._manualWidth;\r\n } else {\r\n return this._manualHeight;\r\n }\r\n }\r\n\r\n public isDimensionFullyDefined(dim: \"width\" | \"height\"): boolean {\r\n if (dim === \"height\" ? this.isVertical : !this.isVertical && !this._getManualDim(dim)) {\r\n for (const child of this._children) {\r\n if (!child.isDimensionFullyDefined(dim)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n return this.getDimension(dim).isPixel || this._getAdaptDimTo(dim);\r\n }\r\n\r\n /**\r\n * Serializes the current control\r\n * @param serializationObject defined the JSON serialized object\r\n * @param force force serialization even if isSerializable === false\r\n */\r\n public serialize(serializationObject: any, force: boolean) {\r\n super.serialize(serializationObject, force);\r\n if (!this.isSerializable && !force) {\r\n return;\r\n }\r\n serializationObject.manualWidth = this._manualWidth;\r\n serializationObject.manualHeight = this._manualHeight;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n this._manualWidth = serializedObject.manualWidth;\r\n this._manualHeight = serializedObject.manualHeight;\r\n\r\n super._parseFromContent(serializedObject, host);\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.StackPanel\", StackPanel);\r\n"]}
package/2D/xmlLoader.js CHANGED
@@ -96,11 +96,13 @@ export class XmlLoader {
96
96
  this._nodes[id] = guiNode;
97
97
  }
98
98
  else {
99
+ // eslint-disable-next-line no-throw-literal
99
100
  throw "XmlLoader Exception : Duplicate ID, every element should have an unique ID attribute";
100
101
  }
101
102
  return guiNode;
102
103
  }
103
104
  catch (exception) {
105
+ // eslint-disable-next-line no-throw-literal
104
106
  throw "XmlLoader Exception : Error parsing Control " + node.nodeName + "," + exception + ".";
105
107
  }
106
108
  }
@@ -120,11 +122,13 @@ export class XmlLoader {
120
122
  continue;
121
123
  }
122
124
  if (rows[i].nodeName != "Row") {
125
+ // eslint-disable-next-line no-throw-literal
123
126
  throw "XmlLoader Exception : Expecting Row node, received " + rows[i].nodeName;
124
127
  }
125
128
  rowNumber += 1;
126
129
  columns = rows[i].children;
127
130
  if (!rows[i].attributes.getNamedItem("height")) {
131
+ // eslint-disable-next-line no-throw-literal
128
132
  throw "XmlLoader Exception : Height must be defined for grid rows";
129
133
  }
130
134
  height = Number(rows[i].attributes.getNamedItem("height").nodeValue);
@@ -135,14 +139,17 @@ export class XmlLoader {
135
139
  continue;
136
140
  }
137
141
  if (columns[j].nodeName != "Column") {
142
+ // eslint-disable-next-line no-throw-literal
138
143
  throw "XmlLoader Exception : Expecting Column node, received " + columns[j].nodeName;
139
144
  }
140
145
  columnNumber += 1;
141
146
  if (rowNumber > 0 && columnNumber > totalColumnsNumber) {
147
+ // eslint-disable-next-line no-throw-literal
142
148
  throw "XmlLoader Exception : In the Grid element, the number of columns is defined in the first row, do not add more columns in the subsequent rows.";
143
149
  }
144
150
  if (rowNumber == 0) {
145
151
  if (!columns[j].attributes.getNamedItem("width")) {
152
+ // eslint-disable-next-line no-throw-literal
146
153
  throw "XmlLoader Exception : Width must be defined for all the grid columns in the first row";
147
154
  }
148
155
  width = Number(columns[j].attributes.getNamedItem("width").nodeValue);
@@ -192,12 +199,14 @@ export class XmlLoader {
192
199
  _parseElementsFromSource(node, guiNode, parent) {
193
200
  const dataSource = node.attributes.getNamedItem("dataSource").value;
194
201
  if (!dataSource.includes(" in ")) {
202
+ // eslint-disable-next-line no-throw-literal
195
203
  throw "XmlLoader Exception : Malformed XML, Data Source must include an in";
196
204
  }
197
205
  else {
198
206
  let isArray = true;
199
207
  const splittedSource = dataSource.split(" in ");
200
208
  if (splittedSource.length < 2) {
209
+ // eslint-disable-next-line no-throw-literal
201
210
  throw "XmlLoader Exception : Malformed XML, Data Source must have an iterator and a source";
202
211
  }
203
212
  let source = splittedSource[1];
@@ -1 +1 @@
1
- {"version":3,"file":"xmlLoader.js","sourceRoot":"","sources":["../../../../dev/gui/src/2D/xmlLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,0CAA4B;AAG/C,MAAM,cAAc,GAAG,2DAA2D,CAAC;AAEnF;;GAEG;AACH,MAAM,OAAO,SAAS;IAuBlB;;;OAGG;IACH,YAAY,cAAmB,IAAI;QA1B3B,WAAM,GAAQ,EAAE,CAAC;QAEjB,eAAU,GAAQ;YACtB,OAAO,EAAE,CAAC;YACV,SAAS,EAAE,CAAC;YACZ,IAAI,EAAE,CAAC;SACV,CAAC;QAEM,cAAS,GAAY,KAAK,CAAC;QAE3B,sBAAiB,GAAQ;YAC7B,uBAAuB,EAAE,CAAC;YAC1B,qBAAqB,EAAE,CAAC;YACxB,mBAAmB,EAAE,CAAC;YACtB,iBAAiB,EAAE,CAAC;YACpB,OAAO,EAAE,CAAC;SACb,CAAC;QAWE,IAAI,WAAW,EAAE;YACb,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;SACnC;IACL,CAAC;IAEO,gBAAgB,CAAC,cAAmB;QACxC,IAAI,OAAO,GAAQ,MAAM,CAAC;QAE1B,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC;SAC/B;QACD,IAAI,KAAK,GAAG,cAAc,CAAC;QAC3B,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SAC/B;QACD,OAAO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K,CAAC,MAAM,GAAG,GAAG,EAAE;YAChB,IAAI,KAAK,CAAC,UAAU,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,EAAE;gBAChD,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;oBACpB,IAAI,OAAO,EAAE;wBACT,OAAO,CAAC,cAAc,CAAC,CAAC;wBACxB,OAAO;qBACV;yBAAM;wBACH,MAAM,cAAc,CAAC;qBACxB;iBACJ;gBAED,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC;gBACjD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;gBAC5C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;gBAEtB,IAAI,SAAS,EAAE;oBACX,SAAS,EAAE,CAAC;iBACf;aACJ;QACL,CAAC,CAAC;QAEF,KAAK,CAAC,OAAO,GAAG;YACZ,IAAI,OAAO,EAAE;gBACT,OAAO,CAAC,6CAA6C,CAAC,CAAC;aAC1D;QACL,CAAC,CAAC;QAEF,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QACjC,KAAK,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC;IACD;;;;;OAKG;IACI,KAAK,CAAC,eAAe,CAAC,OAAY,EAAE,QAAa;QACpD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAY,EAAE,MAAW,EAAE,EAAE;YAC7C,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import { GetClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nconst XmlLoaderError = \"XmlLoader Exception : XML file is malformed or corrupted.\";\r\n\r\n/**\r\n * Class used to load GUI via XML.\r\n */\r\nexport class XmlLoader {\r\n private _nodes: any = {};\r\n\r\n private _nodeTypes: any = {\r\n element: 1,\r\n attribute: 2,\r\n text: 3,\r\n };\r\n\r\n private _isLoaded: boolean = false;\r\n\r\n private _objectAttributes: any = {\r\n textHorizontalAlignment: 1,\r\n textVerticalAlignment: 2,\r\n horizontalAlignment: 3,\r\n verticalAlignment: 4,\r\n stretch: 5,\r\n };\r\n\r\n private _rootNode: any;\r\n\r\n private _parentClass: any;\r\n\r\n /**\r\n * Create a new xml loader\r\n * @param parentClass Sets the class context. Used when the loader is instanced inside a class and not in a global context\r\n */\r\n constructor(parentClass: any = null) {\r\n if (parentClass) {\r\n this._parentClass = parentClass;\r\n }\r\n }\r\n\r\n private _getChainElement(attributeValue: any): any {\r\n let element: any = window;\r\n\r\n if (this._parentClass) {\r\n element = this._parentClass;\r\n }\r\n let value = attributeValue;\r\n value = value.split(\".\");\r\n\r\n for (let i = 0; i < value.length; i++) {\r\n element = element[value[i]];\r\n }\r\n return element;\r\n }\r\n\r\n private _getClassAttribute(attributeName: string): any {\r\n const attribute = attributeName.split(\".\");\r\n const className = GetClass(\"BABYLON.GUI.\" + attribute[0]);\r\n return className[attribute[1]];\r\n }\r\n\r\n private _createGuiElement(node: any, parent: any, linkParent: boolean = true): void {\r\n try {\r\n const className = GetClass(\"BABYLON.GUI.\" + node.nodeName);\r\n const guiNode = new className();\r\n\r\n if (parent && linkParent) {\r\n parent.addControl(guiNode);\r\n }\r\n\r\n for (let i = 0; i < node.attributes.length; i++) {\r\n if (node.attributes[i].name.toLowerCase().includes(\"datasource\")) {\r\n continue;\r\n }\r\n\r\n if (node.attributes[i].name.toLowerCase().includes(\"observable\")) {\r\n const element = this._getChainElement(node.attributes[i].value);\r\n guiNode[node.attributes[i].name].add(element);\r\n\r\n continue;\r\n } else if (node.attributes[i].name == \"linkWithMesh\") {\r\n if (this._parentClass) {\r\n guiNode.linkWithMesh(this._parentClass[node.attributes[i].value]);\r\n } else {\r\n guiNode.linkWithMesh(window[node.attributes[i].value]);\r\n }\r\n } else if (node.attributes[i].value.startsWith(\"{{\") && node.attributes[i].value.endsWith(\"}}\")) {\r\n const element = this._getChainElement(node.attributes[i].value.substring(2, node.attributes[i].value.length - 2));\r\n guiNode[node.attributes[i].name] = element;\r\n } else if (!this._objectAttributes[node.attributes[i].name]) {\r\n if (node.attributes[i].value == \"true\" || node.attributes[i].value == \"false\") {\r\n guiNode[node.attributes[i].name] = node.attributes[i].value == \"true\";\r\n } else {\r\n guiNode[node.attributes[i].name] = !isNaN(Number(node.attributes[i].value)) ? Number(node.attributes[i].value) : node.attributes[i].value;\r\n }\r\n } else {\r\n guiNode[node.attributes[i].name] = this._getClassAttribute(node.attributes[i].value);\r\n }\r\n }\r\n\r\n if (!node.attributes.getNamedItem(\"id\")) {\r\n this._nodes[node.nodeName + Object.keys(this._nodes).length + \"_gen\"] = guiNode;\r\n return guiNode;\r\n }\r\n\r\n let id = node.attributes.getNamedItem(\"id\").value;\r\n if (id.startsWith(\"{{\") && id.endsWith(\"}}\")) {\r\n id = this._getChainElement(id.substring(2, id.length - 2));\r\n }\r\n\r\n if (!this._nodes[id]) {\r\n this._nodes[id] = guiNode;\r\n } else {\r\n throw \"XmlLoader Exception : Duplicate ID, every element should have an unique ID attribute\";\r\n }\r\n return guiNode;\r\n } catch (exception) {\r\n throw \"XmlLoader Exception : Error parsing Control \" + node.nodeName + \",\" + exception + \".\";\r\n }\r\n }\r\n\r\n private _parseGrid(node: any, guiNode: any, parent: any): void {\r\n let width;\r\n let height;\r\n let columns;\r\n const rows = node.children;\r\n let cells;\r\n let isPixel = false;\r\n let cellNode;\r\n let rowNumber = -1;\r\n let columnNumber = -1;\r\n let totalColumnsNumber = 0;\r\n\r\n for (let i = 0; i < rows.length; i++) {\r\n if (rows[i].nodeType != this._nodeTypes.element) {\r\n continue;\r\n }\r\n if (rows[i].nodeName != \"Row\") {\r\n throw \"XmlLoader Exception : Expecting Row node, received \" + rows[i].nodeName;\r\n }\r\n rowNumber += 1;\r\n columns = rows[i].children;\r\n\r\n if (!rows[i].attributes.getNamedItem(\"height\")) {\r\n throw \"XmlLoader Exception : Height must be defined for grid rows\";\r\n }\r\n height = Number(rows[i].attributes.getNamedItem(\"height\").nodeValue);\r\n isPixel = rows[i].attributes.getNamedItem(\"isPixel\") ? JSON.parse(rows[i].attributes.getNamedItem(\"isPixel\").nodeValue) : false;\r\n guiNode.addRowDefinition(height, isPixel);\r\n\r\n for (let j = 0; j < columns.length; j++) {\r\n if (columns[j].nodeType != this._nodeTypes.element) {\r\n continue;\r\n }\r\n if (columns[j].nodeName != \"Column\") {\r\n throw \"XmlLoader Exception : Expecting Column node, received \" + columns[j].nodeName;\r\n }\r\n columnNumber += 1;\r\n if (rowNumber > 0 && columnNumber > totalColumnsNumber) {\r\n throw \"XmlLoader Exception : In the Grid element, the number of columns is defined in the first row, do not add more columns in the subsequent rows.\";\r\n }\r\n\r\n if (rowNumber == 0) {\r\n if (!columns[j].attributes.getNamedItem(\"width\")) {\r\n throw \"XmlLoader Exception : Width must be defined for all the grid columns in the first row\";\r\n }\r\n width = Number(columns[j].attributes.getNamedItem(\"width\").nodeValue);\r\n isPixel = columns[j].attributes.getNamedItem(\"isPixel\") ? JSON.parse(columns[j].attributes.getNamedItem(\"isPixel\").nodeValue) : false;\r\n guiNode.addColumnDefinition(width, isPixel);\r\n }\r\n\r\n cells = columns[j].children;\r\n\r\n for (let k = 0; k < cells.length; k++) {\r\n if (cells[k].nodeType != this._nodeTypes.element) {\r\n continue;\r\n }\r\n cellNode = this._createGuiElement(cells[k], guiNode, false);\r\n guiNode.addControl(cellNode, rowNumber, columnNumber);\r\n if (cells[k].firstChild) {\r\n this._parseXml(cells[k].firstChild, cellNode);\r\n }\r\n }\r\n }\r\n if (rowNumber == 0) {\r\n totalColumnsNumber = columnNumber;\r\n }\r\n columnNumber = -1;\r\n }\r\n\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent);\r\n }\r\n }\r\n\r\n private _parseElement(node: any, guiNode: any, parent: any): void {\r\n if (node.firstChild) {\r\n this._parseXml(node.firstChild, guiNode);\r\n }\r\n\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent);\r\n }\r\n }\r\n\r\n private _prepareSourceElement(node: any, guiNode: any, variable: any, source: any, iterator: any): void {\r\n if (this._parentClass) {\r\n this._parentClass[variable] = source[iterator];\r\n } else {\r\n window[variable] = source[iterator];\r\n }\r\n\r\n if (node.firstChild) {\r\n this._parseXml(node.firstChild, guiNode, true);\r\n }\r\n }\r\n\r\n private _parseElementsFromSource(node: any, guiNode: any, parent: any): void {\r\n const dataSource = node.attributes.getNamedItem(\"dataSource\").value;\r\n\r\n if (!dataSource.includes(\" in \")) {\r\n throw \"XmlLoader Exception : Malformed XML, Data Source must include an in\";\r\n } else {\r\n let isArray = true;\r\n const splittedSource = dataSource.split(\" in \");\r\n if (splittedSource.length < 2) {\r\n throw \"XmlLoader Exception : Malformed XML, Data Source must have an iterator and a source\";\r\n }\r\n let source = splittedSource[1];\r\n if (source.startsWith(\"{\") && source.endsWith(\"}\")) {\r\n isArray = false;\r\n }\r\n\r\n if (!isArray || (source.startsWith(\"[\") && source.endsWith(\"]\"))) {\r\n source = source.substring(1, source.length - 1);\r\n }\r\n\r\n if (this._parentClass) {\r\n source = this._parentClass[source];\r\n } else {\r\n source = window[source];\r\n }\r\n\r\n if (isArray) {\r\n for (let i = 0; i < source.length; i++) {\r\n this._prepareSourceElement(node, guiNode, splittedSource[0], source, i);\r\n }\r\n } else {\r\n for (const i in source) {\r\n this._prepareSourceElement(node, guiNode, splittedSource[0], source, i);\r\n }\r\n }\r\n\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent);\r\n }\r\n }\r\n }\r\n\r\n private _parseXml(node: any, parent: any, generated: boolean = false): void {\r\n if (node.nodeType != this._nodeTypes.element) {\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent, generated);\r\n }\r\n return;\r\n }\r\n\r\n if (generated) {\r\n node.setAttribute(\"id\", parent.id + (parent._children.length + 1));\r\n }\r\n\r\n const guiNode = this._createGuiElement(node, parent);\r\n\r\n if (!this._rootNode) {\r\n this._rootNode = guiNode;\r\n }\r\n\r\n if (node.nodeName == \"Grid\") {\r\n this._parseGrid(node, guiNode, parent);\r\n } else if (!node.attributes.getNamedItem(\"dataSource\")) {\r\n this._parseElement(node, guiNode, parent);\r\n } else {\r\n this._parseElementsFromSource(node, guiNode, parent);\r\n }\r\n }\r\n\r\n /**\r\n * Gets if the loading has finished.\r\n * @returns whether the loading has finished or not\r\n */\r\n public isLoaded(): boolean {\r\n return this._isLoaded;\r\n }\r\n\r\n /**\r\n * Gets a loaded node / control by id.\r\n * @param id the Controls id set in the xml\r\n * @returns element of type Control\r\n */\r\n public getNodeById(id: string): any {\r\n return this._nodes[id];\r\n }\r\n\r\n /**\r\n * Gets all loaded nodes / controls\r\n * @returns Array of controls\r\n */\r\n public getNodes(): any {\r\n return this._nodes;\r\n }\r\n /**\r\n * Disposes the loaded layout\r\n */\r\n public dispose(): void {\r\n if (this._rootNode) {\r\n this._rootNode.dispose();\r\n this._rootNode = null;\r\n this._nodes = {};\r\n }\r\n }\r\n\r\n /**\r\n * Initiates the xml layout loading\r\n * @param xmlFile defines the xml layout to load\r\n * @param rootNode defines the node / control to use as a parent for the loaded layout controls.\r\n * @param onSuccess defines the callback called on layout load successfully.\r\n * @param onError defines the callback called on layout load failure.\r\n */\r\n public loadLayout(xmlFile: any, rootNode: any, onSuccess: Nullable<() => void> = null, onError: Nullable<(error: string) => void> = null): void {\r\n const xhttp = new XMLHttpRequest();\r\n xhttp.onload = () => {\r\n if (xhttp.readyState === 4 && xhttp.status === 200) {\r\n if (!xhttp.responseXML) {\r\n if (onError) {\r\n onError(XmlLoaderError);\r\n return;\r\n } else {\r\n throw XmlLoaderError;\r\n }\r\n }\r\n\r\n const xmlDoc = xhttp.responseXML.documentElement;\r\n this._parseXml(xmlDoc.firstChild, rootNode);\r\n this._isLoaded = true;\r\n\r\n if (onSuccess) {\r\n onSuccess();\r\n }\r\n }\r\n };\r\n\r\n xhttp.onerror = function () {\r\n if (onError) {\r\n onError(\"an error occurred during loading the layout\");\r\n }\r\n };\r\n\r\n xhttp.open(\"GET\", xmlFile, true);\r\n xhttp.send();\r\n }\r\n /**\r\n * Initiates the xml layout loading asynchronously\r\n * @param xmlFile defines the xml layout to load\r\n * @param rootNode defines the node / control to use as a parent for the loaded layout controls.\r\n * @returns Promise\r\n */\r\n public async loadLayoutAsync(xmlFile: any, rootNode: any): Promise<any> {\r\n return new Promise((resolve: any, reject: any) => {\r\n this.loadLayout(xmlFile, rootNode, resolve, reject);\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"xmlLoader.js","sourceRoot":"","sources":["../../../../dev/gui/src/2D/xmlLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,0CAA4B;AAG/C,MAAM,cAAc,GAAG,2DAA2D,CAAC;AAEnF;;GAEG;AACH,MAAM,OAAO,SAAS;IAuBlB;;;OAGG;IACH,YAAY,cAAmB,IAAI;QA1B3B,WAAM,GAAQ,EAAE,CAAC;QAEjB,eAAU,GAAQ;YACtB,OAAO,EAAE,CAAC;YACV,SAAS,EAAE,CAAC;YACZ,IAAI,EAAE,CAAC;SACV,CAAC;QAEM,cAAS,GAAY,KAAK,CAAC;QAE3B,sBAAiB,GAAQ;YAC7B,uBAAuB,EAAE,CAAC;YAC1B,qBAAqB,EAAE,CAAC;YACxB,mBAAmB,EAAE,CAAC;YACtB,iBAAiB,EAAE,CAAC;YACpB,OAAO,EAAE,CAAC;SACb,CAAC;QAWE,IAAI,WAAW,EAAE;YACb,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;SACnC;IACL,CAAC;IAEO,gBAAgB,CAAC,cAAmB;QACxC,IAAI,OAAO,GAAQ,MAAM,CAAC;QAE1B,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC;SAC/B;QACD,IAAI,KAAK,GAA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OAAY,EAAE,QAAa;QACpD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAY,EAAE,MAAW,EAAE,EAAE;YAC7C,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import { GetClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nconst XmlLoaderError = \"XmlLoader Exception : XML file is malformed or corrupted.\";\r\n\r\n/**\r\n * Class used to load GUI via XML.\r\n */\r\nexport class XmlLoader {\r\n private _nodes: any = {};\r\n\r\n private _nodeTypes: any = {\r\n element: 1,\r\n attribute: 2,\r\n text: 3,\r\n };\r\n\r\n private _isLoaded: boolean = false;\r\n\r\n private _objectAttributes: any = {\r\n textHorizontalAlignment: 1,\r\n textVerticalAlignment: 2,\r\n horizontalAlignment: 3,\r\n verticalAlignment: 4,\r\n stretch: 5,\r\n };\r\n\r\n private _rootNode: any;\r\n\r\n private _parentClass: any;\r\n\r\n /**\r\n * Create a new xml loader\r\n * @param parentClass Sets the class context. Used when the loader is instanced inside a class and not in a global context\r\n */\r\n constructor(parentClass: any = null) {\r\n if (parentClass) {\r\n this._parentClass = parentClass;\r\n }\r\n }\r\n\r\n private _getChainElement(attributeValue: any): any {\r\n let element: any = window;\r\n\r\n if (this._parentClass) {\r\n element = this._parentClass;\r\n }\r\n let value = attributeValue;\r\n value = value.split(\".\");\r\n\r\n for (let i = 0; i < value.length; i++) {\r\n element = element[value[i]];\r\n }\r\n return element;\r\n }\r\n\r\n private _getClassAttribute(attributeName: string): any {\r\n const attribute = attributeName.split(\".\");\r\n const className = GetClass(\"BABYLON.GUI.\" + attribute[0]);\r\n return className[attribute[1]];\r\n }\r\n\r\n private _createGuiElement(node: any, parent: any, linkParent: boolean = true): void {\r\n try {\r\n const className = GetClass(\"BABYLON.GUI.\" + node.nodeName);\r\n const guiNode = new className();\r\n\r\n if (parent && linkParent) {\r\n parent.addControl(guiNode);\r\n }\r\n\r\n for (let i = 0; i < node.attributes.length; i++) {\r\n if (node.attributes[i].name.toLowerCase().includes(\"datasource\")) {\r\n continue;\r\n }\r\n\r\n if (node.attributes[i].name.toLowerCase().includes(\"observable\")) {\r\n const element = this._getChainElement(node.attributes[i].value);\r\n guiNode[node.attributes[i].name].add(element);\r\n\r\n continue;\r\n } else if (node.attributes[i].name == \"linkWithMesh\") {\r\n if (this._parentClass) {\r\n guiNode.linkWithMesh(this._parentClass[node.attributes[i].value]);\r\n } else {\r\n guiNode.linkWithMesh(window[node.attributes[i].value]);\r\n }\r\n } else if (node.attributes[i].value.startsWith(\"{{\") && node.attributes[i].value.endsWith(\"}}\")) {\r\n const element = this._getChainElement(node.attributes[i].value.substring(2, node.attributes[i].value.length - 2));\r\n guiNode[node.attributes[i].name] = element;\r\n } else if (!this._objectAttributes[node.attributes[i].name]) {\r\n if (node.attributes[i].value == \"true\" || node.attributes[i].value == \"false\") {\r\n guiNode[node.attributes[i].name] = node.attributes[i].value == \"true\";\r\n } else {\r\n guiNode[node.attributes[i].name] = !isNaN(Number(node.attributes[i].value)) ? Number(node.attributes[i].value) : node.attributes[i].value;\r\n }\r\n } else {\r\n guiNode[node.attributes[i].name] = this._getClassAttribute(node.attributes[i].value);\r\n }\r\n }\r\n\r\n if (!node.attributes.getNamedItem(\"id\")) {\r\n this._nodes[node.nodeName + Object.keys(this._nodes).length + \"_gen\"] = guiNode;\r\n return guiNode;\r\n }\r\n\r\n let id = node.attributes.getNamedItem(\"id\").value;\r\n if (id.startsWith(\"{{\") && id.endsWith(\"}}\")) {\r\n id = this._getChainElement(id.substring(2, id.length - 2));\r\n }\r\n\r\n if (!this._nodes[id]) {\r\n this._nodes[id] = guiNode;\r\n } else {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Duplicate ID, every element should have an unique ID attribute\";\r\n }\r\n return guiNode;\r\n } catch (exception) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Error parsing Control \" + node.nodeName + \",\" + exception + \".\";\r\n }\r\n }\r\n\r\n private _parseGrid(node: any, guiNode: any, parent: any): void {\r\n let width;\r\n let height;\r\n let columns;\r\n const rows = node.children;\r\n let cells;\r\n let isPixel = false;\r\n let cellNode;\r\n let rowNumber = -1;\r\n let columnNumber = -1;\r\n let totalColumnsNumber = 0;\r\n\r\n for (let i = 0; i < rows.length; i++) {\r\n if (rows[i].nodeType != this._nodeTypes.element) {\r\n continue;\r\n }\r\n if (rows[i].nodeName != \"Row\") {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Expecting Row node, received \" + rows[i].nodeName;\r\n }\r\n rowNumber += 1;\r\n columns = rows[i].children;\r\n\r\n if (!rows[i].attributes.getNamedItem(\"height\")) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Height must be defined for grid rows\";\r\n }\r\n height = Number(rows[i].attributes.getNamedItem(\"height\").nodeValue);\r\n isPixel = rows[i].attributes.getNamedItem(\"isPixel\") ? JSON.parse(rows[i].attributes.getNamedItem(\"isPixel\").nodeValue) : false;\r\n guiNode.addRowDefinition(height, isPixel);\r\n\r\n for (let j = 0; j < columns.length; j++) {\r\n if (columns[j].nodeType != this._nodeTypes.element) {\r\n continue;\r\n }\r\n if (columns[j].nodeName != \"Column\") {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Expecting Column node, received \" + columns[j].nodeName;\r\n }\r\n columnNumber += 1;\r\n if (rowNumber > 0 && columnNumber > totalColumnsNumber) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : In the Grid element, the number of columns is defined in the first row, do not add more columns in the subsequent rows.\";\r\n }\r\n\r\n if (rowNumber == 0) {\r\n if (!columns[j].attributes.getNamedItem(\"width\")) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Width must be defined for all the grid columns in the first row\";\r\n }\r\n width = Number(columns[j].attributes.getNamedItem(\"width\").nodeValue);\r\n isPixel = columns[j].attributes.getNamedItem(\"isPixel\") ? JSON.parse(columns[j].attributes.getNamedItem(\"isPixel\").nodeValue) : false;\r\n guiNode.addColumnDefinition(width, isPixel);\r\n }\r\n\r\n cells = columns[j].children;\r\n\r\n for (let k = 0; k < cells.length; k++) {\r\n if (cells[k].nodeType != this._nodeTypes.element) {\r\n continue;\r\n }\r\n cellNode = this._createGuiElement(cells[k], guiNode, false);\r\n guiNode.addControl(cellNode, rowNumber, columnNumber);\r\n if (cells[k].firstChild) {\r\n this._parseXml(cells[k].firstChild, cellNode);\r\n }\r\n }\r\n }\r\n if (rowNumber == 0) {\r\n totalColumnsNumber = columnNumber;\r\n }\r\n columnNumber = -1;\r\n }\r\n\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent);\r\n }\r\n }\r\n\r\n private _parseElement(node: any, guiNode: any, parent: any): void {\r\n if (node.firstChild) {\r\n this._parseXml(node.firstChild, guiNode);\r\n }\r\n\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent);\r\n }\r\n }\r\n\r\n private _prepareSourceElement(node: any, guiNode: any, variable: any, source: any, iterator: any): void {\r\n if (this._parentClass) {\r\n this._parentClass[variable] = source[iterator];\r\n } else {\r\n window[variable] = source[iterator];\r\n }\r\n\r\n if (node.firstChild) {\r\n this._parseXml(node.firstChild, guiNode, true);\r\n }\r\n }\r\n\r\n private _parseElementsFromSource(node: any, guiNode: any, parent: any): void {\r\n const dataSource = node.attributes.getNamedItem(\"dataSource\").value;\r\n\r\n if (!dataSource.includes(\" in \")) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Malformed XML, Data Source must include an in\";\r\n } else {\r\n let isArray = true;\r\n const splittedSource = dataSource.split(\" in \");\r\n if (splittedSource.length < 2) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"XmlLoader Exception : Malformed XML, Data Source must have an iterator and a source\";\r\n }\r\n let source = splittedSource[1];\r\n if (source.startsWith(\"{\") && source.endsWith(\"}\")) {\r\n isArray = false;\r\n }\r\n\r\n if (!isArray || (source.startsWith(\"[\") && source.endsWith(\"]\"))) {\r\n source = source.substring(1, source.length - 1);\r\n }\r\n\r\n if (this._parentClass) {\r\n source = this._parentClass[source];\r\n } else {\r\n source = window[source];\r\n }\r\n\r\n if (isArray) {\r\n for (let i = 0; i < source.length; i++) {\r\n this._prepareSourceElement(node, guiNode, splittedSource[0], source, i);\r\n }\r\n } else {\r\n for (const i in source) {\r\n this._prepareSourceElement(node, guiNode, splittedSource[0], source, i);\r\n }\r\n }\r\n\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent);\r\n }\r\n }\r\n }\r\n\r\n private _parseXml(node: any, parent: any, generated: boolean = false): void {\r\n if (node.nodeType != this._nodeTypes.element) {\r\n if (node.nextSibling) {\r\n this._parseXml(node.nextSibling, parent, generated);\r\n }\r\n return;\r\n }\r\n\r\n if (generated) {\r\n node.setAttribute(\"id\", parent.id + (parent._children.length + 1));\r\n }\r\n\r\n const guiNode = this._createGuiElement(node, parent);\r\n\r\n if (!this._rootNode) {\r\n this._rootNode = guiNode;\r\n }\r\n\r\n if (node.nodeName == \"Grid\") {\r\n this._parseGrid(node, guiNode, parent);\r\n } else if (!node.attributes.getNamedItem(\"dataSource\")) {\r\n this._parseElement(node, guiNode, parent);\r\n } else {\r\n this._parseElementsFromSource(node, guiNode, parent);\r\n }\r\n }\r\n\r\n /**\r\n * Gets if the loading has finished.\r\n * @returns whether the loading has finished or not\r\n */\r\n public isLoaded(): boolean {\r\n return this._isLoaded;\r\n }\r\n\r\n /**\r\n * Gets a loaded node / control by id.\r\n * @param id the Controls id set in the xml\r\n * @returns element of type Control\r\n */\r\n public getNodeById(id: string): any {\r\n return this._nodes[id];\r\n }\r\n\r\n /**\r\n * Gets all loaded nodes / controls\r\n * @returns Array of controls\r\n */\r\n public getNodes(): any {\r\n return this._nodes;\r\n }\r\n /**\r\n * Disposes the loaded layout\r\n */\r\n public dispose(): void {\r\n if (this._rootNode) {\r\n this._rootNode.dispose();\r\n this._rootNode = null;\r\n this._nodes = {};\r\n }\r\n }\r\n\r\n /**\r\n * Initiates the xml layout loading\r\n * @param xmlFile defines the xml layout to load\r\n * @param rootNode defines the node / control to use as a parent for the loaded layout controls.\r\n * @param onSuccess defines the callback called on layout load successfully.\r\n * @param onError defines the callback called on layout load failure.\r\n */\r\n public loadLayout(xmlFile: any, rootNode: any, onSuccess: Nullable<() => void> = null, onError: Nullable<(error: string) => void> = null): void {\r\n const xhttp = new XMLHttpRequest();\r\n xhttp.onload = () => {\r\n if (xhttp.readyState === 4 && xhttp.status === 200) {\r\n if (!xhttp.responseXML) {\r\n if (onError) {\r\n onError(XmlLoaderError);\r\n return;\r\n } else {\r\n throw XmlLoaderError;\r\n }\r\n }\r\n\r\n const xmlDoc = xhttp.responseXML.documentElement;\r\n this._parseXml(xmlDoc.firstChild, rootNode);\r\n this._isLoaded = true;\r\n\r\n if (onSuccess) {\r\n onSuccess();\r\n }\r\n }\r\n };\r\n\r\n xhttp.onerror = function () {\r\n if (onError) {\r\n onError(\"an error occurred during loading the layout\");\r\n }\r\n };\r\n\r\n xhttp.open(\"GET\", xmlFile, true);\r\n xhttp.send();\r\n }\r\n /**\r\n * Initiates the xml layout loading asynchronously\r\n * @param xmlFile defines the xml layout to load\r\n * @param rootNode defines the node / control to use as a parent for the loaded layout controls.\r\n * @returns Promise\r\n */\r\n public async loadLayoutAsync(xmlFile: any, rootNode: any): Promise<any> {\r\n return new Promise((resolve: any, reject: any) => {\r\n this.loadLayout(xmlFile, rootNode, resolve, reject);\r\n });\r\n }\r\n}\r\n"]}