@babylonjs/gui 7.5.0 → 7.6.1
Sign up to get free protection for your applications and to get access to all the features.
- package/2D/advancedDynamicTexture.d.ts +12 -6
- package/2D/advancedDynamicTexture.js +16 -10
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/container.d.ts +1 -1
- package/2D/controls/container.js +3 -3
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.d.ts +9 -4
- package/2D/controls/control.js +15 -8
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/image.js +3 -0
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/inputText.js +1 -1
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/inputTextArea.js +1 -1
- package/2D/controls/inputTextArea.js.map +1 -1
- package/2D/controls/textBlock.js +2 -2
- package/2D/controls/textBlock.js.map +1 -1
- package/package.json +2 -2
package/2D/controls/image.js
CHANGED
package/2D/controls/image.js.map
CHANGED
@@ -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;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;IAEe,OAAO;QACnB,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,C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AAE;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 override 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 override 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 override 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 override _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 override _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 override _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 override 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,O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BAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;;AA75BD;;GAEG;AACW,oBAAc,GAAG,IAAI,GAAG,EAA0G,AAApH,CAAqH;AA45BjJ,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;AAp4B9C;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;AAuLD;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 override 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._urlRewriter && value) {\r\n value = this._urlRewriter(value);\r\n }\r\n\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 override 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 override 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 override _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 override _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 override _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 override 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"]}
|
package/2D/controls/inputText.js
CHANGED
@@ -805,7 +805,7 @@ export class InputText extends Control {
|
|
805
805
|
context.shadowOffsetY = 0;
|
806
806
|
}
|
807
807
|
if (!this._fontOffset || this._wasDirty) {
|
808
|
-
this._fontOffset = Control._GetFontOffset(context.font);
|
808
|
+
this._fontOffset = Control._GetFontOffset(context.font, this._host.getScene()?.getEngine());
|
809
809
|
}
|
810
810
|
// Text
|
811
811
|
const clipTextLeft = this._currentMeasure.left + this._margin.getValueInPixel(this._host, this._tempParentMeasure.width);
|