@babylonjs/gui 7.34.3 → 7.35.0
Sign up to get free protection for your applications and to get access to all the features.
- package/2D/FrameGraph/guiTask.js.map +1 -1
- package/2D/FrameGraph/renderGraphGUIBlock.js.map +1 -1
- package/2D/adtInstrumentation.js.map +1 -1
- package/2D/advancedDynamicTexture.d.ts +1 -1
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/button.js.map +1 -1
- package/2D/controls/checkbox.js.map +1 -1
- package/2D/controls/colorpicker.js.map +1 -1
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/displayGrid.js.map +1 -1
- package/2D/controls/ellipse.js.map +1 -1
- package/2D/controls/focusableButton.js.map +1 -1
- package/2D/controls/gradient/BaseGradient.js.map +1 -1
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/inputPassword.js.map +1 -1
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/inputTextArea.js.map +1 -1
- package/2D/controls/line.js.map +1 -1
- package/2D/controls/multiLine.js.map +1 -1
- package/2D/controls/radioButton.js.map +1 -1
- package/2D/controls/rectangle.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
- package/2D/controls/selector.js.map +1 -1
- package/2D/controls/sliders/baseSlider.js.map +1 -1
- package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
- package/2D/controls/sliders/imageScrollBar.js.map +1 -1
- package/2D/controls/sliders/scrollBar.js.map +1 -1
- package/2D/controls/sliders/slider.js.map +1 -1
- package/2D/controls/stackPanel.js.map +1 -1
- package/2D/controls/statics.js.map +1 -1
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/controls/textWrapper.js.map +1 -1
- package/2D/controls/toggleButton.js.map +1 -1
- package/2D/controls/virtualKeyboard.js.map +1 -1
- package/2D/math2D.js.map +1 -1
- package/2D/measure.js.map +1 -1
- package/2D/multiLinePoint.js.map +1 -1
- package/2D/style.js.map +1 -1
- package/2D/valueAndUnit.js.map +1 -1
- package/2D/xmlLoader.js.map +1 -1
- package/3D/behaviors/defaultBehavior.js.map +1 -1
- package/3D/controls/MRTK3/touchHolographicButton.js.map +1 -1
- package/3D/controls/button3D.js.map +1 -1
- package/3D/controls/container3D.js.map +1 -1
- package/3D/controls/contentDisplay3D.js.map +1 -1
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/cylinderPanel.js.map +1 -1
- package/3D/controls/holographicBackplate.js.map +1 -1
- package/3D/controls/holographicButton.js.map +1 -1
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/meshButton3D.js.map +1 -1
- package/3D/controls/nearMenu.js.map +1 -1
- package/3D/controls/planePanel.js.map +1 -1
- package/3D/controls/scatterPanel.js.map +1 -1
- package/3D/controls/slider3D.js.map +1 -1
- package/3D/controls/spherePanel.js.map +1 -1
- package/3D/controls/stackPanel3D.js.map +1 -1
- package/3D/controls/touchButton3D.js.map +1 -1
- package/3D/controls/touchHolographicButton.js.map +1 -1
- package/3D/controls/touchHolographicMenu.js.map +1 -1
- package/3D/controls/touchMeshButton3D.js.map +1 -1
- package/3D/controls/volumeBasedPanel.js.map +1 -1
- package/3D/gizmos/gizmoHandle.js.map +1 -1
- package/3D/gizmos/slateGizmo.js.map +1 -1
- package/3D/gui3DManager.js.map +1 -1
- package/3D/materials/fluent/fluentMaterial.js.map +1 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
- package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
- package/3D/materials/handle/handleMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackglowMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlFrontplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlInnerquadMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
- package/legacy/legacy.js.map +1 -1
- package/package.json +2 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"multiLine.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/multiLine.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,+CAAiC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAGjD;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,OAAO;IAUlC;;;OAGG;IACH,YAA4B,IAAa;QACrC,KAAK,CAAC,IAAI,CAAC,CAAC;QADY,SAAI,GAAJ,IAAI,CAAS;QAbjC,eAAU,GAAW,CAAC,CAAC;QAqD/B,8CAA8C;QACvC,kBAAa,GAAG,GAAS,EAAE;YAC9B,IAAI,CAAC,YAAY,EAAE,CAAC;QACxB,CAAC,CAAC;QAxCE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC9B,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,yBAAyB,CAAC;QAC9D,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,sBAAsB,CAAC;QAEzD,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;IAED,gCAAgC;IAEhC,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IAAW,IAAI,CAAC,KAAoB;QAChC,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,EAAE;YACtB,OAAO;SACV;QAED,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,EA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e,OAAO;QACnB,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AAvPG;IADC,SAAS,EAAE;qCAGX;AAsPL,aAAa,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\n\r\nimport { Control } from \"./control\";\r\nimport { MultiLinePoint } from \"../multiLinePoint\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\n\r\n/**\r\n * Class used to create multi line control\r\n */\r\nexport class MultiLine extends Control {\r\n private _lineWidth: number = 1;\r\n private _dash: number[];\r\n private _points: Nullable<MultiLinePoint>[];\r\n\r\n private _minX: Nullable<number>;\r\n private _minY: Nullable<number>;\r\n private _maxX: Nullable<number>;\r\n private _maxY: Nullable<number>;\r\n\r\n /**\r\n * Creates a new MultiLine\r\n * @param name defines the control name\r\n */\r\n constructor(public override name?: string) {\r\n super(name);\r\n\r\n this._automaticSize = true;\r\n this.isHitTestVisible = false;\r\n this._horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n\r\n this._dash = [];\r\n this._points = [];\r\n }\r\n\r\n /** Gets or sets dash pattern */\r\n @serialize()\r\n public get dash(): Array<number> {\r\n return this._dash;\r\n }\r\n\r\n public set dash(value: Array<number>) {\r\n if (this._dash === value) {\r\n return;\r\n }\r\n\r\n this._dash = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets point stored at specified index\r\n * @param index defines the index to look for\r\n * @returns the requested point if found\r\n */\r\n public getAt(index: number): MultiLinePoint {\r\n if (!this._points[index]) {\r\n this._points[index] = new MultiLinePoint(this);\r\n }\r\n\r\n return this._points[index] as MultiLinePoint;\r\n }\r\n\r\n /** Function called when a point is updated */\r\n public onPointUpdate = (): void => {\r\n this._markAsDirty();\r\n };\r\n\r\n /**\r\n * Adds new points to the point collection\r\n * @param items defines the list of items (mesh, control or 2d coordinates) to add\r\n * @returns the list of created MultiLinePoint\r\n */\r\n public add(...items: (AbstractMesh | Control | { x: string | number; y: string | number })[]): MultiLinePoint[] {\r\n return items.map((item) => this.push(item));\r\n }\r\n\r\n /**\r\n * Adds a new point to the point collection\r\n * @param item defines the item (mesh, control or 2d coordinates) to add\r\n * @returns the created MultiLinePoint\r\n */\r\n public push(item?: AbstractMesh | Control | { x: string | number; y: string | number }): MultiLinePoint {\r\n const point: MultiLinePoint = this.getAt(this._points.length);\r\n\r\n if (item == null) {\r\n return point;\r\n }\r\n\r\n if (item instanceof AbstractMesh) {\r\n point.mesh = item;\r\n } else if (item instanceof Control) {\r\n point.control = item;\r\n } else if (item.x != null && item.y != null) {\r\n point.x = item.x;\r\n point.y = item.y;\r\n }\r\n\r\n return point;\r\n }\r\n\r\n /**\r\n * Remove a specific value or point from the active point collection\r\n * @param value defines the value or point to remove\r\n */\r\n public remove(value: number | MultiLinePoint): void {\r\n let index: number;\r\n\r\n if (value instanceof MultiLinePoint) {\r\n index = this._points.indexOf(value);\r\n\r\n if (index === -1) {\r\n return;\r\n }\r\n } else {\r\n index = value;\r\n }\r\n\r\n const point: Nullable<MultiLinePoint> = this._points[index];\r\n\r\n if (!point) {\r\n return;\r\n }\r\n\r\n point.dispose();\r\n\r\n this._points.splice(index, 1);\r\n }\r\n\r\n /**\r\n * Resets this object to initial state (no point)\r\n */\r\n public reset(): void {\r\n while (this._points.length > 0) {\r\n this.remove(this._points.length - 1);\r\n }\r\n }\r\n\r\n /**\r\n * Resets all links\r\n */\r\n public resetLinks(): void {\r\n this._points.forEach((point) => {\r\n if (point != null) {\r\n point.resetLinks();\r\n }\r\n });\r\n }\r\n\r\n /** Gets or sets line width */\r\n public get lineWidth(): number {\r\n return this._lineWidth;\r\n }\r\n\r\n public set lineWidth(value: number) {\r\n if (this._lineWidth === value) {\r\n return;\r\n }\r\n\r\n this._lineWidth = value;\r\n this._markAsDirty();\r\n }\r\n\r\n public override set horizontalAlignment(value: number) {\r\n return;\r\n }\r\n\r\n public override set verticalAlignment(value: number) {\r\n return;\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"MultiLine\";\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 this._applyStates(context);\r\n\r\n context.strokeStyle = this.color;\r\n context.lineWidth = this._lineWidth;\r\n context.setLineDash(this._dash);\r\n\r\n context.beginPath();\r\n\r\n let first: boolean = true; //first index is not necessarily 0\r\n let previousPoint: Vector3;\r\n\r\n this._points.forEach((point) => {\r\n if (!point) {\r\n return;\r\n }\r\n\r\n if (first) {\r\n context.moveTo(point._point.x, point._point.y);\r\n\r\n first = false;\r\n } else {\r\n if (point._point.z < 1 && previousPoint.z < 1) {\r\n context.lineTo(point._point.x, point._point.y);\r\n } else {\r\n context.moveTo(point._point.x, point._point.y);\r\n }\r\n }\r\n previousPoint = point._point;\r\n });\r\n\r\n context.stroke();\r\n\r\n context.restore();\r\n }\r\n\r\n protected override _additionalProcessing(): void {\r\n this._minX = null;\r\n this._minY = null;\r\n this._maxX = null;\r\n this._maxY = null;\r\n\r\n this._points.forEach((point) => {\r\n if (!point) {\r\n return;\r\n }\r\n\r\n point.translate();\r\n\r\n if (this._minX == null || point._point.x < this._minX) {\r\n this._minX = point._point.x;\r\n }\r\n if (this._minY == null || point._point.y < this._minY) {\r\n this._minY = point._point.y;\r\n }\r\n if (this._maxX == null || point._point.x > this._maxX) {\r\n this._maxX = point._point.x;\r\n }\r\n if (this._maxY == null || point._point.y > this._maxY) {\r\n this._maxY = point._point.y;\r\n }\r\n });\r\n\r\n if (this._minX == null) {\r\n this._minX = 0;\r\n }\r\n if (this._minY == null) {\r\n this._minY = 0;\r\n }\r\n if (this._maxX == null) {\r\n this._maxX = 0;\r\n }\r\n if (this._maxY == null) {\r\n this._maxY = 0;\r\n }\r\n }\r\n\r\n public override _measure(): void {\r\n if (this._minX == null || this._maxX == null || this._minY == null || this._maxY == null) {\r\n return;\r\n }\r\n\r\n this._currentMeasure.width = Math.abs(this._maxX - this._minX) + this._lineWidth;\r\n this._currentMeasure.height = Math.abs(this._maxY - this._minY) + this._lineWidth;\r\n }\r\n\r\n protected override _computeAlignment(): void {\r\n if (this._minX == null || this._minY == null) {\r\n return;\r\n }\r\n\r\n this._currentMeasure.left = this._minX - this._lineWidth / 2;\r\n this._currentMeasure.top = this._minY - this._lineWidth / 2;\r\n }\r\n\r\n public override dispose(): void {\r\n this.reset();\r\n\r\n super.dispose();\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.MultiLine\", MultiLine);\r\n"]}
|
1
|
+
{"version":3,"file":"multiLine.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/multiLine.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,+CAAiC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAGjD;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,OAAO;IAUlC;;;OAGG;IACH,YAA4B,IAAa;QACrC,KAAK,CAAC,IAAI,CAAC,CAAC;QADY,SAAI,GAAJ,IAAI,CAAS;QAbjC,eAAU,GAAW,CAAC,CAAC;QAqD/B,8CAA8C;QACvC,kBAAa,GAAG,GAAS,EAAE;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\"./control\";\r\nimport { MultiLinePoint } from \"../multiLinePoint\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\n\r\n/**\r\n * Class used to create multi line control\r\n */\r\nexport class MultiLine extends Control {\r\n private _lineWidth: number = 1;\r\n private _dash: number[];\r\n private _points: Nullable<MultiLinePoint>[];\r\n\r\n private _minX: Nullable<number>;\r\n private _minY: Nullable<number>;\r\n private _maxX: Nullable<number>;\r\n private _maxY: Nullable<number>;\r\n\r\n /**\r\n * Creates a new MultiLine\r\n * @param name defines the control name\r\n */\r\n constructor(public override name?: string) {\r\n super(name);\r\n\r\n this._automaticSize = true;\r\n this.isHitTestVisible = false;\r\n this._horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n\r\n this._dash = [];\r\n this._points = [];\r\n }\r\n\r\n /** Gets or sets dash pattern */\r\n @serialize()\r\n public get dash(): Array<number> {\r\n return this._dash;\r\n }\r\n\r\n public set dash(value: Array<number>) {\r\n if (this._dash === value) {\r\n return;\r\n }\r\n\r\n this._dash = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets point stored at specified index\r\n * @param index defines the index to look for\r\n * @returns the requested point if found\r\n */\r\n public getAt(index: number): MultiLinePoint {\r\n if (!this._points[index]) {\r\n this._points[index] = new MultiLinePoint(this);\r\n }\r\n\r\n return this._points[index] as MultiLinePoint;\r\n }\r\n\r\n /** Function called when a point is updated */\r\n public onPointUpdate = (): void => {\r\n this._markAsDirty();\r\n };\r\n\r\n /**\r\n * Adds new points to the point collection\r\n * @param items defines the list of items (mesh, control or 2d coordinates) to add\r\n * @returns the list of created MultiLinePoint\r\n */\r\n public add(...items: (AbstractMesh | Control | { x: string | number; y: string | number })[]): MultiLinePoint[] {\r\n return items.map((item) => this.push(item));\r\n }\r\n\r\n /**\r\n * Adds a new point to the point collection\r\n * @param item defines the item (mesh, control or 2d coordinates) to add\r\n * @returns the created MultiLinePoint\r\n */\r\n public push(item?: AbstractMesh | Control | { x: string | number; y: string | number }): MultiLinePoint {\r\n const point: MultiLinePoint = this.getAt(this._points.length);\r\n\r\n if (item == null) {\r\n return point;\r\n }\r\n\r\n if (item instanceof AbstractMesh) {\r\n point.mesh = item;\r\n } else if (item instanceof Control) {\r\n point.control = item;\r\n } else if (item.x != null && item.y != null) {\r\n point.x = item.x;\r\n point.y = item.y;\r\n }\r\n\r\n return point;\r\n }\r\n\r\n /**\r\n * Remove a specific value or point from the active point collection\r\n * @param value defines the value or point to remove\r\n */\r\n public remove(value: number | MultiLinePoint): void {\r\n let index: number;\r\n\r\n if (value instanceof MultiLinePoint) {\r\n index = this._points.indexOf(value);\r\n\r\n if (index === -1) {\r\n return;\r\n }\r\n } else {\r\n index = value;\r\n }\r\n\r\n const point: Nullable<MultiLinePoint> = this._points[index];\r\n\r\n if (!point) {\r\n return;\r\n }\r\n\r\n point.dispose();\r\n\r\n this._points.splice(index, 1);\r\n }\r\n\r\n /**\r\n * Resets this object to initial state (no point)\r\n */\r\n public reset(): void {\r\n while (this._points.length > 0) {\r\n this.remove(this._points.length - 1);\r\n }\r\n }\r\n\r\n /**\r\n * Resets all links\r\n */\r\n public resetLinks(): void {\r\n this._points.forEach((point) => {\r\n if (point != null) {\r\n point.resetLinks();\r\n }\r\n });\r\n }\r\n\r\n /** Gets or sets line width */\r\n public get lineWidth(): number {\r\n return this._lineWidth;\r\n }\r\n\r\n public set lineWidth(value: number) {\r\n if (this._lineWidth === value) {\r\n return;\r\n }\r\n\r\n this._lineWidth = value;\r\n this._markAsDirty();\r\n }\r\n\r\n public override set horizontalAlignment(value: number) {\r\n return;\r\n }\r\n\r\n public override set verticalAlignment(value: number) {\r\n return;\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"MultiLine\";\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 this._applyStates(context);\r\n\r\n context.strokeStyle = this.color;\r\n context.lineWidth = this._lineWidth;\r\n context.setLineDash(this._dash);\r\n\r\n context.beginPath();\r\n\r\n let first: boolean = true; //first index is not necessarily 0\r\n let previousPoint: Vector3;\r\n\r\n this._points.forEach((point) => {\r\n if (!point) {\r\n return;\r\n }\r\n\r\n if (first) {\r\n context.moveTo(point._point.x, point._point.y);\r\n\r\n first = false;\r\n } else {\r\n if (point._point.z < 1 && previousPoint.z < 1) {\r\n context.lineTo(point._point.x, point._point.y);\r\n } else {\r\n context.moveTo(point._point.x, point._point.y);\r\n }\r\n }\r\n previousPoint = point._point;\r\n });\r\n\r\n context.stroke();\r\n\r\n context.restore();\r\n }\r\n\r\n protected override _additionalProcessing(): void {\r\n this._minX = null;\r\n this._minY = null;\r\n this._maxX = null;\r\n this._maxY = null;\r\n\r\n this._points.forEach((point) => {\r\n if (!point) {\r\n return;\r\n }\r\n\r\n point.translate();\r\n\r\n if (this._minX == null || point._point.x < this._minX) {\r\n this._minX = point._point.x;\r\n }\r\n if (this._minY == null || point._point.y < this._minY) {\r\n this._minY = point._point.y;\r\n }\r\n if (this._maxX == null || point._point.x > this._maxX) {\r\n this._maxX = point._point.x;\r\n }\r\n if (this._maxY == null || point._point.y > this._maxY) {\r\n this._maxY = point._point.y;\r\n }\r\n });\r\n\r\n if (this._minX == null) {\r\n this._minX = 0;\r\n }\r\n if (this._minY == null) {\r\n this._minY = 0;\r\n }\r\n if (this._maxX == null) {\r\n this._maxX = 0;\r\n }\r\n if (this._maxY == null) {\r\n this._maxY = 0;\r\n }\r\n }\r\n\r\n public override _measure(): void {\r\n if (this._minX == null || this._maxX == null || this._minY == null || this._maxY == null) {\r\n return;\r\n }\r\n\r\n this._currentMeasure.width = Math.abs(this._maxX - this._minX) + this._lineWidth;\r\n this._currentMeasure.height = Math.abs(this._maxY - this._minY) + this._lineWidth;\r\n }\r\n\r\n protected override _computeAlignment(): void {\r\n if (this._minX == null || this._minY == null) {\r\n return;\r\n }\r\n\r\n this._currentMeasure.left = this._minX - this._lineWidth / 2;\r\n this._currentMeasure.top = this._minY - this._lineWidth / 2;\r\n }\r\n\r\n public override dispose(): void {\r\n this.reset();\r\n\r\n super.dispose();\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.MultiLine\", MultiLine);\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radioButton.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/radioButton.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAGlD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAGjD;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAO;IAMpC,oCAAoC;IAEpC,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;QACxB,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IASD,oFAAoF;IAEpF,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED,IAAW,cAAc,CAAC,KAAa;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CAAC,4BAA4B,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QAChF,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAExB,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;QAC/B,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC;QACpB,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC;QACvB,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,MAAM,CAAC,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,CAAC;QACnE,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC;QACvB,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAEzB,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA/MG;IADC,SAAS,EAAE;4CAGX;AAaM;IADN,SAAS,EAAE;0CACM;AAOlB;IADC,SAAS,EAAE;iDAGX;AAeD;IADC,SAAS,EAAE;6CAGX;AAaD;IADC,SAAS,EAAE;4CAGX;AAwJL,aAAa,CAAC,yBAAyB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { Observable } from \"core/Misc/observable\";\r\nimport type { Vector2 } from \"core/Maths/math.vector\";\r\n\r\nimport { Control } from \"./control\";\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { TextBlock } from \"./textBlock\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { PointerInfoBase } from \"core/Events/pointerEvents\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\n\r\n/**\r\n * Class used to create radio button controls\r\n */\r\nexport class RadioButton extends Control {\r\n private _isChecked = false;\r\n private _background = \"black\";\r\n private _checkSizeRatio = 0.8;\r\n private _thickness = 1;\r\n\r\n /** Gets or sets border thickness */\r\n @serialize()\r\n public get thickness(): number {\r\n return this._thickness;\r\n }\r\n\r\n public set thickness(value: number) {\r\n if (this._thickness === value) {\r\n return;\r\n }\r\n\r\n this._thickness = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets group name */\r\n @serialize()\r\n public group = \"\";\r\n\r\n /** Observable raised when isChecked is changed */\r\n public onIsCheckedChangedObservable = new Observable<boolean>();\r\n\r\n /** Gets or sets a value indicating the ratio between overall size and check size */\r\n @serialize()\r\n public get checkSizeRatio(): number {\r\n return this._checkSizeRatio;\r\n }\r\n\r\n public set checkSizeRatio(value: number) {\r\n value = Math.max(Math.min(1, value), 0);\r\n\r\n if (this._checkSizeRatio === value) {\r\n return;\r\n }\r\n\r\n this._checkSizeRatio = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets background color */\r\n @serialize()\r\n public get background(): string {\r\n return this._background;\r\n }\r\n\r\n public set background(value: string) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n\r\n this._background = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets a boolean indicating if the checkbox is checked or not */\r\n @serialize()\r\n public get isChecked(): boolean {\r\n return this._isChecked;\r\n }\r\n\r\n public set isChecked(value: boolean) {\r\n if (this._isChecked === value) {\r\n return;\r\n }\r\n\r\n this._isChecked = value;\r\n this._markAsDirty();\r\n\r\n this.onIsCheckedChangedObservable.notifyObservers(value);\r\n\r\n if (this._isChecked && this._host) {\r\n // Update all controls from same group\r\n this._host.executeOnAllControls((control) => {\r\n if (control === this) {\r\n return;\r\n }\r\n\r\n if ((<any>control).group === undefined) {\r\n return;\r\n }\r\n const childRadio = <RadioButton>control;\r\n if (childRadio.group === this.group) {\r\n childRadio.isChecked = false;\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new RadioButton\r\n * @param name defines the control name\r\n */\r\n constructor(public override name?: string) {\r\n super(name);\r\n\r\n this.isPointerBlocker = true;\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"RadioButton\";\r\n }\r\n\r\n public override _draw(context: ICanvasRenderingContext): void {\r\n context.save();\r\n\r\n this._applyStates(context);\r\n const actualWidth = this._currentMeasure.width - this._thickness;\r\n const actualHeight = this._currentMeasure.height - this._thickness;\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 // Outer\r\n Control.drawEllipse(\r\n this._currentMeasure.left + this._currentMeasure.width / 2,\r\n this._currentMeasure.top + this._currentMeasure.height / 2,\r\n this._currentMeasure.width / 2 - this._thickness / 2,\r\n this._currentMeasure.height / 2 - this._thickness / 2,\r\n 1,\r\n context\r\n );\r\n\r\n context.fillStyle = this._isEnabled ? this._background : this._disabledColor;\r\n context.fill();\r\n\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n\r\n context.strokeStyle = this.color;\r\n context.lineWidth = this._thickness;\r\n\r\n context.stroke();\r\n\r\n // Inner\r\n if (this._isChecked) {\r\n context.fillStyle = this._isEnabled ? this.color : this._disabledColor;\r\n const offsetWidth = actualWidth * this._checkSizeRatio;\r\n const offseHeight = actualHeight * this._checkSizeRatio;\r\n\r\n Control.drawEllipse(\r\n this._currentMeasure.left + this._currentMeasure.width / 2,\r\n this._currentMeasure.top + this._currentMeasure.height / 2,\r\n offsetWidth / 2 - this._thickness / 2,\r\n offseHeight / 2 - this._thickness / 2,\r\n 1,\r\n context\r\n );\r\n\r\n context.fill();\r\n }\r\n context.restore();\r\n }\r\n\r\n // Events\r\n public override _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean {\r\n if (!super._onPointerDown(target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n\r\n if (this.isReadOnly) {\r\n return true;\r\n }\r\n\r\n if (!this.isChecked) {\r\n this.isChecked = true;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Utility function to easily create a radio button with a header\r\n * @param title defines the label to use for the header\r\n * @param group defines the group to use for the radio button\r\n * @param isChecked defines the initial state of the radio button\r\n * @param onValueChanged defines the callback to call when value changes\r\n * @returns a StackPanel containing the radio button and a textBlock\r\n */\r\n public static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel {\r\n const panel = new StackPanel();\r\n panel.isVertical = false;\r\n panel.height = \"30px\";\r\n\r\n const radio = new RadioButton();\r\n radio.width = \"20px\";\r\n radio.height = \"20px\";\r\n radio.isChecked = isChecked;\r\n radio.color = \"green\";\r\n radio.group = group;\r\n radio.onIsCheckedChangedObservable.add((value) => onValueChanged(radio, value));\r\n panel.addControl(radio);\r\n\r\n const header = new TextBlock();\r\n header.text = title;\r\n header.width = \"180px\";\r\n header.paddingLeft = \"5px\";\r\n header.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n header.color = \"white\";\r\n panel.addControl(header);\r\n\r\n return panel;\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.RadioButton\", RadioButton);\r\n"]}
|
1
|
+
{"version":3,"file":"radioButton.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/radioButton.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAGlD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAGjD;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAO;IAMpC,oCAAoC;IAEpC,IAAW,SAAS;QAChB,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,CAAC","sourcesContent":["import { Observable } from \"core/Misc/observable\";\r\nimport type { Vector2 } from \"core/Maths/math.vector\";\r\n\r\nimport { Control } from \"./control\";\r\nimport { StackPanel } from \"./stackPanel\";\r\nimport { TextBlock } from \"./textBlock\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { PointerInfoBase } from \"core/Events/pointerEvents\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\n\r\n/**\r\n * Class used to create radio button controls\r\n */\r\nexport class RadioButton extends Control {\r\n private _isChecked = false;\r\n private _background = \"black\";\r\n private _checkSizeRatio = 0.8;\r\n private _thickness = 1;\r\n\r\n /** Gets or sets border thickness */\r\n @serialize()\r\n public get thickness(): number {\r\n return this._thickness;\r\n }\r\n\r\n public set thickness(value: number) {\r\n if (this._thickness === value) {\r\n return;\r\n }\r\n\r\n this._thickness = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets group name */\r\n @serialize()\r\n public group = \"\";\r\n\r\n /** Observable raised when isChecked is changed */\r\n public onIsCheckedChangedObservable = new Observable<boolean>();\r\n\r\n /** Gets or sets a value indicating the ratio between overall size and check size */\r\n @serialize()\r\n public get checkSizeRatio(): number {\r\n return this._checkSizeRatio;\r\n }\r\n\r\n public set checkSizeRatio(value: number) {\r\n value = Math.max(Math.min(1, value), 0);\r\n\r\n if (this._checkSizeRatio === value) {\r\n return;\r\n }\r\n\r\n this._checkSizeRatio = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets background color */\r\n @serialize()\r\n public get background(): string {\r\n return this._background;\r\n }\r\n\r\n public set background(value: string) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n\r\n this._background = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets a boolean indicating if the checkbox is checked or not */\r\n @serialize()\r\n public get isChecked(): boolean {\r\n return this._isChecked;\r\n }\r\n\r\n public set isChecked(value: boolean) {\r\n if (this._isChecked === value) {\r\n return;\r\n }\r\n\r\n this._isChecked = value;\r\n this._markAsDirty();\r\n\r\n this.onIsCheckedChangedObservable.notifyObservers(value);\r\n\r\n if (this._isChecked && this._host) {\r\n // Update all controls from same group\r\n this._host.executeOnAllControls((control) => {\r\n if (control === this) {\r\n return;\r\n }\r\n\r\n if ((<any>control).group === undefined) {\r\n return;\r\n }\r\n const childRadio = <RadioButton>control;\r\n if (childRadio.group === this.group) {\r\n childRadio.isChecked = false;\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new RadioButton\r\n * @param name defines the control name\r\n */\r\n constructor(public override name?: string) {\r\n super(name);\r\n\r\n this.isPointerBlocker = true;\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"RadioButton\";\r\n }\r\n\r\n public override _draw(context: ICanvasRenderingContext): void {\r\n context.save();\r\n\r\n this._applyStates(context);\r\n const actualWidth = this._currentMeasure.width - this._thickness;\r\n const actualHeight = this._currentMeasure.height - this._thickness;\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 // Outer\r\n Control.drawEllipse(\r\n this._currentMeasure.left + this._currentMeasure.width / 2,\r\n this._currentMeasure.top + this._currentMeasure.height / 2,\r\n this._currentMeasure.width / 2 - this._thickness / 2,\r\n this._currentMeasure.height / 2 - this._thickness / 2,\r\n 1,\r\n context\r\n );\r\n\r\n context.fillStyle = this._isEnabled ? this._background : this._disabledColor;\r\n context.fill();\r\n\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n\r\n context.strokeStyle = this.color;\r\n context.lineWidth = this._thickness;\r\n\r\n context.stroke();\r\n\r\n // Inner\r\n if (this._isChecked) {\r\n context.fillStyle = this._isEnabled ? this.color : this._disabledColor;\r\n const offsetWidth = actualWidth * this._checkSizeRatio;\r\n const offseHeight = actualHeight * this._checkSizeRatio;\r\n\r\n Control.drawEllipse(\r\n this._currentMeasure.left + this._currentMeasure.width / 2,\r\n this._currentMeasure.top + this._currentMeasure.height / 2,\r\n offsetWidth / 2 - this._thickness / 2,\r\n offseHeight / 2 - this._thickness / 2,\r\n 1,\r\n context\r\n );\r\n\r\n context.fill();\r\n }\r\n context.restore();\r\n }\r\n\r\n // Events\r\n public override _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean {\r\n if (!super._onPointerDown(target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n\r\n if (this.isReadOnly) {\r\n return true;\r\n }\r\n\r\n if (!this.isChecked) {\r\n this.isChecked = true;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Utility function to easily create a radio button with a header\r\n * @param title defines the label to use for the header\r\n * @param group defines the group to use for the radio button\r\n * @param isChecked defines the initial state of the radio button\r\n * @param onValueChanged defines the callback to call when value changes\r\n * @returns a StackPanel containing the radio button and a textBlock\r\n */\r\n public static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel {\r\n const panel = new StackPanel();\r\n panel.isVertical = false;\r\n panel.height = \"30px\";\r\n\r\n const radio = new RadioButton();\r\n radio.width = \"20px\";\r\n radio.height = \"20px\";\r\n radio.isChecked = isChecked;\r\n radio.color = \"green\";\r\n radio.group = group;\r\n radio.onIsCheckedChangedObservable.add((value) => onValueChanged(radio, value));\r\n panel.addControl(radio);\r\n\r\n const header = new TextBlock();\r\n header.text = title;\r\n header.width = \"180px\";\r\n header.paddingLeft = \"5px\";\r\n header.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n header.color = \"white\";\r\n panel.addControl(header);\r\n\r\n return panel;\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.RadioButton\", RadioButton);\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rectangle.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/rectangle.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAGjD,+CAA+C;AAC/C,MAAM,OAAO,SAAU,SAAQ,SAAS;IAKpC,oCAAoC;IAEpC,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;QACxB,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED,mDAAmD;IAEnD,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IAED,IAAW,YAAY,CAAC,KAAa;QACjC,IAAI,KAAK,GAAG,CAAC,EAAE;YACX,KAAK,GAAG,CAAC,CAAC;SACb;QAED,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE;YAC1I,OAAO;SACV;QAED,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,G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CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACrH,OAAO,CAAC,SAAS,EAAE,CAAC;IACxB,CAAC;IAEkB,gBAAgB,CAAC,OAAgC;QAChE,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;YAC1H,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAChD,OAAO,CAAC,IAAI,EAAE,CAAC;SAClB;IACL,CAAC;CACJ;AArNG;IADC,SAAS,EAAE;0CAGX;AAaD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;8CAGX;AAWD;IADC,SAAS,EAAE;8CAGX;AAWD;IADC,SAAS,EAAE;8CAGX;AAWD;IADC,SAAS,EAAE;8CAGX;AA2IL,aAAa,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { Container } from \"./container\";\r\nimport type { Measure } from \"../measure\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\n\r\n/** Class used to create rectangle container */\r\nexport class Rectangle extends Container {\r\n private _thickness = 1;\r\n private _cornerRadius = [0, 0, 0, 0];\r\n private _cachedRadius = [0, 0, 0, 0];\r\n\r\n /** Gets or sets border thickness */\r\n @serialize()\r\n public get thickness(): number {\r\n return this._thickness;\r\n }\r\n\r\n public set thickness(value: number) {\r\n if (this._thickness === value) {\r\n return;\r\n }\r\n\r\n this._thickness = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets the corner radius of all angles */\r\n @serialize()\r\n public get cornerRadius(): number {\r\n return this._cornerRadius[0];\r\n }\r\n\r\n public set cornerRadius(value: number) {\r\n if (value < 0) {\r\n value = 0;\r\n }\r\n\r\n if (this._cornerRadius[0] === value && this._cornerRadius[1] === value && this._cornerRadius[2] === value && this._cornerRadius[3] === value) {\r\n return;\r\n }\r\n\r\n this._cornerRadius[0] = this._cornerRadius[1] = this._cornerRadius[2] = this._cornerRadius[3] = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets the corner radius top left angle */\r\n @serialize()\r\n public get cornerRadiusX(): number {\r\n return this._cornerRadius[0];\r\n }\r\n\r\n public set cornerRadiusX(value: number) {\r\n if (this._cornerRadius[0] === value) {\r\n return;\r\n }\r\n this._cornerRadius[0] = value;\r\n }\r\n\r\n /** Gets or sets the corner radius top right angle */\r\n @serialize()\r\n public get cornerRadiusY(): number {\r\n return this._cornerRadius[1];\r\n }\r\n\r\n public set cornerRadiusY(value: number) {\r\n if (this._cornerRadius[1] === value) {\r\n return;\r\n }\r\n this._cornerRadius[1] = value;\r\n }\r\n\r\n /** Gets or sets the corner radius bottom left angle */\r\n @serialize()\r\n public get cornerRadiusZ(): number {\r\n return this._cornerRadius[2];\r\n }\r\n\r\n public set cornerRadiusZ(value: number) {\r\n if (this._cornerRadius[2] === value) {\r\n return;\r\n }\r\n this._cornerRadius[2] = value;\r\n }\r\n\r\n /** Gets or sets the corner radius bottom right angle */\r\n @serialize()\r\n public get cornerRadiusW(): number {\r\n return this._cornerRadius[3];\r\n }\r\n\r\n public set cornerRadiusW(value: number) {\r\n if (this._cornerRadius[3] === value) {\r\n return;\r\n }\r\n this._cornerRadius[3] = value;\r\n }\r\n\r\n /**\r\n * Creates a new Rectangle\r\n * @param name defines the control name\r\n */\r\n constructor(public override name?: string) {\r\n super(name);\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"Rectangle\";\r\n }\r\n\r\n /** @internal */\r\n protected override _computeAdditionalOffsetX() {\r\n let additionalWidth = 0;\r\n if (this._cornerRadius[0] !== 0 || this._cornerRadius[1] !== 0 || this._cornerRadius[2] !== 0 || this._cornerRadius[3] !== 0) {\r\n // Take in account the aliasing\r\n additionalWidth += 1;\r\n }\r\n if (this.thickness) {\r\n additionalWidth += this.thickness / 2;\r\n }\r\n return additionalWidth;\r\n }\r\n\r\n /** @internal */\r\n protected override _computeAdditionalOffsetY() {\r\n let additionalHeight = 0;\r\n if (this._cornerRadius[0] !== 0 || this._cornerRadius[1] !== 0 || this._cornerRadius[2] !== 0 || this._cornerRadius[3] !== 0) {\r\n // Take in account the aliasing\r\n additionalHeight += 1;\r\n }\r\n if (this.thickness) {\r\n additionalHeight += this.thickness / 2;\r\n }\r\n return additionalHeight;\r\n }\r\n\r\n protected _getRectangleFill(context: ICanvasRenderingContext) {\r\n return this._getBackgroundColor(context);\r\n }\r\n\r\n protected override _localDraw(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 if (this._background || this._backgroundGradient) {\r\n context.fillStyle = this._getRectangleFill(context);\r\n\r\n if (this._cornerRadius[0] !== 0 || this._cornerRadius[1] !== 0 || this._cornerRadius[2] !== 0 || this._cornerRadius[3] !== 0) {\r\n this._drawRoundedRect(context, this._thickness / 2);\r\n context.fill();\r\n } else {\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n }\r\n\r\n if (this._thickness) {\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n\r\n if (this.color || this.gradient) {\r\n context.strokeStyle = this.gradient ? this.gradient.getCanvasGradient(context) : this.color;\r\n }\r\n context.lineWidth = this._thickness;\r\n\r\n if (this._cornerRadius[0] !== 0 || this._cornerRadius[1] !== 0 || this._cornerRadius[2] !== 0 || this._cornerRadius[3] !== 0) {\r\n this._drawRoundedRect(context, this._thickness / 2);\r\n context.stroke();\r\n } else {\r\n context.strokeRect(\r\n this._currentMeasure.left + this._thickness / 2,\r\n this._currentMeasure.top + this._thickness / 2,\r\n this._currentMeasure.width - this._thickness,\r\n this._currentMeasure.height - this._thickness\r\n );\r\n }\r\n }\r\n\r\n context.restore();\r\n }\r\n\r\n protected override _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n super._additionalProcessing(parentMeasure, context);\r\n\r\n this._measureForChildren.width -= 2 * this._thickness;\r\n this._measureForChildren.height -= 2 * this._thickness;\r\n this._measureForChildren.left += this._thickness;\r\n this._measureForChildren.top += this._thickness;\r\n }\r\n\r\n private _drawRoundedRect(context: ICanvasRenderingContext, offset: number = 0): void {\r\n const x = this._currentMeasure.left + offset;\r\n const y = this._currentMeasure.top + offset;\r\n const width = this._currentMeasure.width - offset * 2;\r\n const height = this._currentMeasure.height - offset * 2;\r\n\r\n for (let index = 0; index < this._cornerRadius.length; index++) {\r\n this._cachedRadius[index] = Math.abs(Math.min(height / 2, Math.min(width / 2, this._cornerRadius[index])));\r\n }\r\n\r\n context.beginPath();\r\n context.moveTo(x + this._cachedRadius[0], y);\r\n context.lineTo(x + width - this._cachedRadius[1], y);\r\n context.arc(x + width - this._cachedRadius[1], y + this._cachedRadius[1], this._cachedRadius[1], (3 * Math.PI) / 2, Math.PI * 2);\r\n context.lineTo(x + width, y + height - this._cachedRadius[2]);\r\n context.arc(x + width - this._cachedRadius[2], y + height - this._cachedRadius[2], this._cachedRadius[2], 0, Math.PI / 2);\r\n context.lineTo(x + this._cachedRadius[3], y + height);\r\n context.arc(x + this._cachedRadius[3], y + height - this._cachedRadius[3], this._cachedRadius[3], Math.PI / 2, Math.PI);\r\n context.lineTo(x, y + this._cachedRadius[0]);\r\n context.arc(x + this._cachedRadius[0], y + this._cachedRadius[0], this._cachedRadius[0], Math.PI, (3 * Math.PI) / 2);\r\n context.closePath();\r\n }\r\n\r\n protected override _clipForChildren(context: ICanvasRenderingContext) {\r\n if (this._cornerRadius[0] !== 0 || this._cornerRadius[1] !== 0 || this._cornerRadius[2] !== 0 || this._cornerRadius[3] !== 0) {\r\n this._drawRoundedRect(context, this._thickness);\r\n context.clip();\r\n }\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.Rectangle\", Rectangle);\r\n"]}
|
1
|
+
{"version":3,"file":"rectangle.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/rectangle.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAGjD,+CAA+C;AAC/C,MAAM,OAAO,SAAU,SAAQ,SAAS;IAKpC,oCAAoC;IAEpC,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,IAAW,SAAS,CAAC,KAAa;QAC9B,IAAI,IAAI,CAAC,UAAU,KAAK,KAAK,EAAE,CAAC;YAC5B,OAAO;QACX,CAAC;QAED,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAED,mDAAmD;IAEnD,IAAW,YAAY;QACnB,OAAO,IAAI,CAA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OAAgC;QAChE,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3H,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAChD,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC;IACL,CAAC;CACJ;AArNG;IADC,SAAS,EAAE;0CAGX;AAaD;IADC,SAAS,EAAE;6CAGX;AAiBD;IADC,SAAS,EAAE;8CAGX;AAWD;IADC,SAAS,EAAE;8CAGX;AAWD;IADC,SAAS,EAAE;8CAGX;AAWD;IADC,SAAS,EAAE;8CAGX;AA2IL,aAAa,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import { Container } from \"./container\";\r\nimport type { Measure } from \"../measure\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\n\r\n/** Class used to create rectangle container */\r\nexport class Rectangle extends Container {\r\n private _thickness = 1;\r\n private _cornerRadius = [0, 0, 0, 0];\r\n private _cachedRadius = [0, 0, 0, 0];\r\n\r\n /** Gets or sets border thickness */\r\n @serialize()\r\n public get thickness(): number {\r\n return this._thickness;\r\n }\r\n\r\n public set thickness(value: number) {\r\n if (this._thickness === value) {\r\n return;\r\n }\r\n\r\n this._thickness = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets the corner radius of all angles */\r\n @serialize()\r\n public get cornerRadius(): number {\r\n return this._cornerRadius[0];\r\n }\r\n\r\n public set cornerRadius(value: number) {\r\n if (value < 0) {\r\n value = 0;\r\n }\r\n\r\n if (this._cornerRadius[0] === value && this._cornerRadius[1] === value && this._cornerRadius[2] === value && this._cornerRadius[3] === value) {\r\n return;\r\n }\r\n\r\n this._cornerRadius[0] = this._cornerRadius[1] = this._cornerRadius[2] = this._cornerRadius[3] = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets the corner radius top left angle */\r\n @serialize()\r\n public get cornerRadiusX(): number {\r\n return this._cornerRadius[0];\r\n }\r\n\r\n public set cornerRadiusX(value: number) {\r\n if (this._cornerRadius[0] === value) {\r\n return;\r\n }\r\n this._cornerRadius[0] = value;\r\n }\r\n\r\n /** Gets or sets the corner radius top right angle */\r\n @serialize()\r\n public get cornerRadiusY(): number {\r\n return this._cornerRadius[1];\r\n }\r\n\r\n public set cornerRadiusY(value: number) {\r\n if (this._cornerRadius[1] === value) {\r\n return;\r\n }\r\n this._cornerRadius[1] = value;\r\n }\r\n\r\n /** Gets or sets the corner radius bottom left angle */\r\n @serialize()\r\n public get cornerRadiusZ(): number {\r\n return this._cornerRadius[2];\r\n }\r\n\r\n public set cornerRadiusZ(value: number) {\r\n if (this._cornerRadius[2] === value) {\r\n return;\r\n }\r\n this._cornerRadius[2] = value;\r\n }\r\n\r\n /** Gets or sets the corner radius bottom right angle */\r\n @serialize()\r\n public get cornerRadiusW(): number {\r\n return this._cornerRadius[3];\r\n }\r\n\r\n public set cornerRadiusW(value: number) {\r\n if (this._cornerRadius[3] === value) {\r\n return;\r\n }\r\n this._cornerRadius[3] = value;\r\n }\r\n\r\n /**\r\n * Creates a new Rectangle\r\n * @param name defines the control name\r\n */\r\n constructor(public override name?: string) {\r\n super(name);\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"Rectangle\";\r\n }\r\n\r\n /** @internal */\r\n protected override _computeAdditionalOffsetX() {\r\n let additionalWidth = 0;\r\n if (this._cornerRadius[0] !== 0 || this._cornerRadius[1] !== 0 || this._cornerRadius[2] !== 0 || this._cornerRadius[3] !== 0) {\r\n // Take in account the aliasing\r\n additionalWidth += 1;\r\n }\r\n if (this.thickness) {\r\n additionalWidth += this.thickness / 2;\r\n }\r\n return additionalWidth;\r\n }\r\n\r\n /** @internal */\r\n protected override _computeAdditionalOffsetY() {\r\n let additionalHeight = 0;\r\n if (this._cornerRadius[0] !== 0 || this._cornerRadius[1] !== 0 || this._cornerRadius[2] !== 0 || this._cornerRadius[3] !== 0) {\r\n // Take in account the aliasing\r\n additionalHeight += 1;\r\n }\r\n if (this.thickness) {\r\n additionalHeight += this.thickness / 2;\r\n }\r\n return additionalHeight;\r\n }\r\n\r\n protected _getRectangleFill(context: ICanvasRenderingContext) {\r\n return this._getBackgroundColor(context);\r\n }\r\n\r\n protected override _localDraw(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 if (this._background || this._backgroundGradient) {\r\n context.fillStyle = this._getRectangleFill(context);\r\n\r\n if (this._cornerRadius[0] !== 0 || this._cornerRadius[1] !== 0 || this._cornerRadius[2] !== 0 || this._cornerRadius[3] !== 0) {\r\n this._drawRoundedRect(context, this._thickness / 2);\r\n context.fill();\r\n } else {\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n }\r\n\r\n if (this._thickness) {\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowBlur = 0;\r\n context.shadowOffsetX = 0;\r\n context.shadowOffsetY = 0;\r\n }\r\n\r\n if (this.color || this.gradient) {\r\n context.strokeStyle = this.gradient ? this.gradient.getCanvasGradient(context) : this.color;\r\n }\r\n context.lineWidth = this._thickness;\r\n\r\n if (this._cornerRadius[0] !== 0 || this._cornerRadius[1] !== 0 || this._cornerRadius[2] !== 0 || this._cornerRadius[3] !== 0) {\r\n this._drawRoundedRect(context, this._thickness / 2);\r\n context.stroke();\r\n } else {\r\n context.strokeRect(\r\n this._currentMeasure.left + this._thickness / 2,\r\n this._currentMeasure.top + this._thickness / 2,\r\n this._currentMeasure.width - this._thickness,\r\n this._currentMeasure.height - this._thickness\r\n );\r\n }\r\n }\r\n\r\n context.restore();\r\n }\r\n\r\n protected override _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n super._additionalProcessing(parentMeasure, context);\r\n\r\n this._measureForChildren.width -= 2 * this._thickness;\r\n this._measureForChildren.height -= 2 * this._thickness;\r\n this._measureForChildren.left += this._thickness;\r\n this._measureForChildren.top += this._thickness;\r\n }\r\n\r\n private _drawRoundedRect(context: ICanvasRenderingContext, offset: number = 0): void {\r\n const x = this._currentMeasure.left + offset;\r\n const y = this._currentMeasure.top + offset;\r\n const width = this._currentMeasure.width - offset * 2;\r\n const height = this._currentMeasure.height - offset * 2;\r\n\r\n for (let index = 0; index < this._cornerRadius.length; index++) {\r\n this._cachedRadius[index] = Math.abs(Math.min(height / 2, Math.min(width / 2, this._cornerRadius[index])));\r\n }\r\n\r\n context.beginPath();\r\n context.moveTo(x + this._cachedRadius[0], y);\r\n context.lineTo(x + width - this._cachedRadius[1], y);\r\n context.arc(x + width - this._cachedRadius[1], y + this._cachedRadius[1], this._cachedRadius[1], (3 * Math.PI) / 2, Math.PI * 2);\r\n context.lineTo(x + width, y + height - this._cachedRadius[2]);\r\n context.arc(x + width - this._cachedRadius[2], y + height - this._cachedRadius[2], this._cachedRadius[2], 0, Math.PI / 2);\r\n context.lineTo(x + this._cachedRadius[3], y + height);\r\n context.arc(x + this._cachedRadius[3], y + height - this._cachedRadius[3], this._cachedRadius[3], Math.PI / 2, Math.PI);\r\n context.lineTo(x, y + this._cachedRadius[0]);\r\n context.arc(x + this._cachedRadius[0], y + this._cachedRadius[0], this._cachedRadius[0], Math.PI, (3 * Math.PI) / 2);\r\n context.closePath();\r\n }\r\n\r\n protected override _clipForChildren(context: ICanvasRenderingContext) {\r\n if (this._cornerRadius[0] !== 0 || this._cornerRadius[1] !== 0 || this._cornerRadius[2] !== 0 || this._cornerRadius[3] !== 0) {\r\n this._drawRoundedRect(context, this._thickness);\r\n context.clip();\r\n }\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.Rectangle\", Rectangle);\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scrollViewer.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/2D/controls/scrollViewers/scrollViewer.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAEjD;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,SAAS;IA+BvC;;OAEG;IACH,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACa,UAAU,CAAC,OAA0B;QACjD,IAAI,CAAC,OAAO,EAAE;YACV,OAAO,IAAI,CAAC;SACf;QAED,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAEjC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACa,aAAa,CAAC,OAAgB;QAC1C,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACpC,OAAO,IAAI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AC,OAAO,CAAC,CAAC;QAExC,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAE7C,OAAO,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;IAED,oCAAoC;IACpB,OAAO;QACnB,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACrD,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AA1aG;IADC,SAAS,EAAE;kDAGX;AAoBD;IADC,SAAS,EAAE;oDAGX;AAYD;IADC,SAAS,EAAE;4CAGX;AA6DD;IADC,SAAS,EAAE;2CAGX;AAmID;IADC,SAAS,EAAE;iDAGX;AAiML,aAAa,CAAC,0BAA0B,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport type { Vector2 } from \"core/Maths/math\";\r\nimport { Rectangle } from \"../rectangle\";\r\nimport { Grid } from \"../grid\";\r\nimport type { Image } from \"../image\";\r\nimport { Control } from \"../control\";\r\nimport type { Container } from \"../container\";\r\nimport type { Measure } from \"../../measure\";\r\nimport type { AdvancedDynamicTexture } from \"../../advancedDynamicTexture\";\r\nimport { _ScrollViewerWindow } from \"./scrollViewerWindow\";\r\nimport { ScrollBar } from \"../sliders/scrollBar\";\r\nimport { ImageScrollBar } from \"../sliders/imageScrollBar\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\n\r\n/**\r\n * Class used to hold a viewer window and sliders in a grid\r\n */\r\nexport class ScrollViewer extends Rectangle {\r\n private _grid: Grid;\r\n private _horizontalBarSpace: Rectangle;\r\n private _verticalBarSpace: Rectangle;\r\n private _dragSpace: Rectangle;\r\n private _horizontalBar: ScrollBar | ImageScrollBar;\r\n private _verticalBar: ScrollBar | ImageScrollBar;\r\n private _barColor: string;\r\n private _barBackground: string;\r\n private _barImage: Image;\r\n private _horizontalBarImage: Image;\r\n private _verticalBarImage: Image;\r\n private _barBackgroundImage: Image;\r\n private _horizontalBarBackgroundImage: Image;\r\n private _verticalBarBackgroundImage: Image;\r\n private _barSize: number = 20;\r\n private _window: _ScrollViewerWindow;\r\n private _pointerIsOver: Boolean = false;\r\n private _wheelPrecision: number = 0.05;\r\n private _onWheelObserver: Nullable<Observer<Vector2>>;\r\n private _clientWidth: number;\r\n private _clientHeight: number;\r\n private _useImageBar: Boolean;\r\n private _thumbLength: number = 0.5;\r\n private _thumbHeight: number = 1;\r\n private _barImageHeight: number = 1;\r\n private _horizontalBarImageHeight: number = 1;\r\n private _verticalBarImageHeight: number = 1;\r\n private _oldWindowContentsWidth: number = 0;\r\n private _oldWindowContentsHeight: number = 0;\r\n\r\n /**\r\n * Gets the horizontal scrollbar\r\n */\r\n public get horizontalBar(): ScrollBar | ImageScrollBar {\r\n return this._horizontalBar;\r\n }\r\n\r\n /**\r\n * Gets the vertical scrollbar\r\n */\r\n public get verticalBar(): ScrollBar | ImageScrollBar {\r\n return this._verticalBar;\r\n }\r\n\r\n /**\r\n * Adds a new control to the current container\r\n * @param control defines the control to add\r\n * @returns the current container\r\n */\r\n public override addControl(control: Nullable<Control>): Container {\r\n if (!control) {\r\n return this;\r\n }\r\n\r\n this._window.addControl(control);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Removes a control from the current container\r\n * @param control defines the control to remove\r\n * @returns the current container\r\n */\r\n public override removeControl(control: Control): Container {\r\n this._window.removeControl(control);\r\n return this;\r\n }\r\n\r\n /** Gets the list of children */\r\n public override get children(): Control[] {\r\n return this._window.children;\r\n }\r\n\r\n public override _flagDescendantsAsMatrixDirty(): void {\r\n for (const child of this._children) {\r\n child._markMatrixAsDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Freezes or unfreezes the controls in the window.\r\n * When controls are frozen, the scroll viewer can render a lot more quickly but updates to positions/sizes of controls\r\n * are not taken into account. If you want to change positions/sizes, unfreeze, perform the changes then freeze again\r\n */\r\n public get freezeControls(): boolean {\r\n return this._window.freezeControls;\r\n }\r\n\r\n public set freezeControls(value: boolean) {\r\n this._window.freezeControls = value;\r\n }\r\n\r\n /** Gets the bucket width */\r\n public get bucketWidth(): number {\r\n return this._window.bucketWidth;\r\n }\r\n\r\n /** Gets the bucket height */\r\n public get bucketHeight(): number {\r\n return this._window.bucketHeight;\r\n }\r\n\r\n /**\r\n * Sets the bucket sizes.\r\n * When freezeControls is true, setting a non-zero bucket size will improve performances by updating only\r\n * controls that are visible. The bucket sizes is used to subdivide (internally) the window area to smaller areas into which\r\n * controls are dispatched. So, the size should be roughly equals to the mean size of all the controls of\r\n * the window. To disable the usage of buckets, sets either width or height (or both) to 0.\r\n * Please note that using this option will raise the memory usage (the higher the bucket sizes, the less memory\r\n * used), that's why it is not enabled by default.\r\n * @param width width of the bucket\r\n * @param height height of the bucket\r\n */\r\n public setBucketSizes(width: number, height: number): void {\r\n this._window.setBucketSizes(width, height);\r\n }\r\n\r\n private _forceHorizontalBar: boolean = false;\r\n private _forceVerticalBar: boolean = false;\r\n\r\n /**\r\n * Forces the horizontal scroll bar to be displayed\r\n */\r\n public get forceHorizontalBar(): boolean {\r\n return this._forceHorizontalBar;\r\n }\r\n\r\n public set forceHorizontalBar(value: boolean) {\r\n this._grid.setRowDefinition(1, value ? this._barSize : 0, true);\r\n this._horizontalBar.isVisible = value;\r\n this._forceHorizontalBar = value;\r\n }\r\n\r\n /**\r\n * Forces the vertical scroll bar to be displayed\r\n */\r\n public get forceVerticalBar(): boolean {\r\n return this._forceVerticalBar;\r\n }\r\n\r\n public set forceVerticalBar(value: boolean) {\r\n this._grid.setColumnDefinition(1, value ? this._barSize : 0, true);\r\n this._verticalBar.isVisible = value;\r\n this._forceVerticalBar = value;\r\n }\r\n\r\n /**\r\n * Creates a new ScrollViewer\r\n * @param name of ScrollViewer\r\n * @param isImageBased\r\n */\r\n constructor(name?: string, isImageBased?: boolean) {\r\n super(name);\r\n\r\n this._useImageBar = isImageBased ? isImageBased : false;\r\n\r\n this.onDirtyObservable.add(() => {\r\n this._horizontalBarSpace.color = this.color;\r\n this._verticalBarSpace.color = this.color;\r\n this._dragSpace.color = this.color;\r\n });\r\n\r\n this.onPointerEnterObservable.add(() => {\r\n this._pointerIsOver = true;\r\n });\r\n\r\n this.onPointerOutObservable.add(() => {\r\n this._pointerIsOver = false;\r\n });\r\n\r\n this._grid = new Grid();\r\n if (this._useImageBar) {\r\n this._horizontalBar = new ImageScrollBar();\r\n this._verticalBar = new ImageScrollBar();\r\n } else {\r\n this._horizontalBar = new ScrollBar();\r\n this._verticalBar = new ScrollBar();\r\n }\r\n\r\n this._window = new _ScrollViewerWindow(\"scrollViewer_window\");\r\n this._window.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._window.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n\r\n this._grid.addColumnDefinition(1);\r\n this._grid.addColumnDefinition(0, true);\r\n this._grid.addRowDefinition(1);\r\n this._grid.addRowDefinition(0, true);\r\n\r\n super.addControl(this._grid);\r\n this._grid.addControl(this._window, 0, 0);\r\n\r\n this._verticalBarSpace = new Rectangle();\r\n this._verticalBarSpace.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._verticalBarSpace.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n this._verticalBarSpace.thickness = 1;\r\n this._grid.addControl(this._verticalBarSpace, 0, 1);\r\n this._addBar(this._verticalBar, this._verticalBarSpace, true, Math.PI);\r\n\r\n this._horizontalBarSpace = new Rectangle();\r\n this._horizontalBarSpace.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._horizontalBarSpace.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n this._horizontalBarSpace.thickness = 1;\r\n this._grid.addControl(this._horizontalBarSpace, 1, 0);\r\n this._addBar(this._horizontalBar, this._horizontalBarSpace, false, 0);\r\n\r\n this._dragSpace = new Rectangle();\r\n this._dragSpace.thickness = 1;\r\n this._grid.addControl(this._dragSpace, 1, 1);\r\n\r\n this._grid.clipChildren = false;\r\n\r\n // Colors\r\n if (!this._useImageBar) {\r\n this.barColor = \"grey\";\r\n this.barBackground = \"transparent\";\r\n }\r\n }\r\n\r\n /** Reset the scroll viewer window to initial size */\r\n public resetWindow() {\r\n this._window.width = \"100%\";\r\n this._window.height = \"100%\";\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"ScrollViewer\";\r\n }\r\n\r\n private _buildClientSizes() {\r\n const ratio = this.host.idealRatio;\r\n\r\n this._window.parentClientWidth = this._currentMeasure.width - (this._verticalBar.isVisible || this.forceVerticalBar ? this._barSize * ratio : 0) - 2 * this.thickness;\r\n this._window.parentClientHeight = this._currentMeasure.height - (this._horizontalBar.isVisible || this.forceHorizontalBar ? this._barSize * ratio : 0) - 2 * this.thickness;\r\n\r\n this._clientWidth = this._window.parentClientWidth;\r\n this._clientHeight = this._window.parentClientHeight;\r\n }\r\n\r\n protected override _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n super._additionalProcessing(parentMeasure, context);\r\n\r\n this._buildClientSizes();\r\n }\r\n\r\n protected override _postMeasure(): void {\r\n super._postMeasure();\r\n\r\n this._updateScroller();\r\n\r\n this._setWindowPosition(false);\r\n }\r\n\r\n /**\r\n * Gets or sets the mouse wheel precision\r\n * from 0 to 1 with a default value of 0.05\r\n * */\r\n @serialize()\r\n public get wheelPrecision(): number {\r\n return this._wheelPrecision;\r\n }\r\n\r\n public set wheelPrecision(value: number) {\r\n if (this._wheelPrecision === value) {\r\n return;\r\n }\r\n\r\n if (value < 0) {\r\n value = 0;\r\n }\r\n\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n\r\n this._wheelPrecision = value;\r\n }\r\n\r\n /** Gets or sets the scroll bar container background color */\r\n @serialize()\r\n public get scrollBackground(): string {\r\n return this._horizontalBarSpace.background;\r\n }\r\n\r\n public set scrollBackground(color: string) {\r\n if (this._horizontalBarSpace.background === color) {\r\n return;\r\n }\r\n this._horizontalBarSpace.background = color;\r\n this._verticalBarSpace.background = color;\r\n }\r\n\r\n /** Gets or sets the bar color */\r\n @serialize()\r\n public get barColor(): string {\r\n return this._barColor;\r\n }\r\n\r\n public set barColor(color: string) {\r\n if (this._barColor === color) {\r\n return;\r\n }\r\n\r\n this._barColor = color;\r\n this._horizontalBar.color = color;\r\n this._verticalBar.color = color;\r\n }\r\n\r\n /** Gets or sets the bar image */\r\n public get thumbImage(): Image {\r\n return this._barImage;\r\n }\r\n\r\n public set thumbImage(value: Image) {\r\n if (this._barImage === value) {\r\n return;\r\n }\r\n\r\n this._barImage = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n hb.thumbImage = value;\r\n vb.thumbImage = value;\r\n }\r\n\r\n /** Gets or sets the horizontal bar image */\r\n public get horizontalThumbImage(): Image {\r\n return this._horizontalBarImage;\r\n }\r\n\r\n public set horizontalThumbImage(value: Image) {\r\n if (this._horizontalBarImage === value) {\r\n return;\r\n }\r\n\r\n this._horizontalBarImage = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n hb.thumbImage = value;\r\n }\r\n\r\n /** Gets or sets the vertical bar image */\r\n public get verticalThumbImage(): Image {\r\n return this._verticalBarImage;\r\n }\r\n\r\n public set verticalThumbImage(value: Image) {\r\n if (this._verticalBarImage === value) {\r\n return;\r\n }\r\n\r\n this._verticalBarImage = value;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n vb.thumbImage = value;\r\n }\r\n\r\n /** Gets or sets the size of the bar */\r\n @serialize()\r\n public get barSize(): number {\r\n return this._barSize;\r\n }\r\n\r\n public set barSize(value: number) {\r\n if (this._barSize === value) {\r\n return;\r\n }\r\n\r\n this._barSize = value;\r\n this._markAsDirty();\r\n\r\n if (this._horizontalBar.isVisible) {\r\n this._grid.setRowDefinition(1, this._barSize, true);\r\n }\r\n if (this._verticalBar.isVisible) {\r\n this._grid.setColumnDefinition(1, this._barSize, true);\r\n }\r\n }\r\n\r\n /** Gets or sets the length of the thumb */\r\n public get thumbLength(): number {\r\n return this._thumbLength;\r\n }\r\n\r\n public set thumbLength(value: number) {\r\n if (this._thumbLength === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._thumbLength = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n hb.thumbLength = value;\r\n vb.thumbLength = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets the height of the thumb */\r\n public get thumbHeight(): number {\r\n return this._thumbHeight;\r\n }\r\n\r\n public set thumbHeight(value: number) {\r\n if (this._thumbHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._thumbHeight = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n hb.thumbHeight = value;\r\n vb.thumbHeight = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets the height of the bar image */\r\n public get barImageHeight(): number {\r\n return this._barImageHeight;\r\n }\r\n\r\n public set barImageHeight(value: number) {\r\n if (this._barImageHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._barImageHeight = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n hb.barImageHeight = value;\r\n vb.barImageHeight = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets the height of the horizontal bar image */\r\n public get horizontalBarImageHeight(): number {\r\n return this._horizontalBarImageHeight;\r\n }\r\n\r\n public set horizontalBarImageHeight(value: number) {\r\n if (this._horizontalBarImageHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._horizontalBarImageHeight = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n hb.barImageHeight = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets the height of the vertical bar image */\r\n public get verticalBarImageHeight(): number {\r\n return this._verticalBarImageHeight;\r\n }\r\n\r\n public set verticalBarImageHeight(value: number) {\r\n if (this._verticalBarImageHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._verticalBarImageHeight = value;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n vb.barImageHeight = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets the bar background */\r\n @serialize()\r\n public get barBackground(): string {\r\n return this._barBackground;\r\n }\r\n\r\n public set barBackground(color: string) {\r\n if (this._barBackground === color) {\r\n return;\r\n }\r\n\r\n this._barBackground = color;\r\n const hb = <ScrollBar>this._horizontalBar;\r\n const vb = <ScrollBar>this._verticalBar;\r\n hb.background = color;\r\n vb.background = color;\r\n this._dragSpace.background = color;\r\n }\r\n\r\n /** Gets or sets the bar background image */\r\n public get barImage(): Image {\r\n return this._barBackgroundImage;\r\n }\r\n\r\n public set barImage(value: Image) {\r\n this._barBackgroundImage = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n hb.backgroundImage = value;\r\n vb.backgroundImage = value;\r\n }\r\n\r\n /** Gets or sets the horizontal bar background image */\r\n public get horizontalBarImage(): Image {\r\n return this._horizontalBarBackgroundImage;\r\n }\r\n\r\n public set horizontalBarImage(value: Image) {\r\n this._horizontalBarBackgroundImage = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n hb.backgroundImage = value;\r\n }\r\n\r\n /** Gets or sets the vertical bar background image */\r\n public get verticalBarImage(): Image {\r\n return this._verticalBarBackgroundImage;\r\n }\r\n\r\n public set verticalBarImage(value: Image) {\r\n this._verticalBarBackgroundImage = value;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n vb.backgroundImage = value;\r\n }\r\n\r\n private _setWindowPosition(force = true): void {\r\n const ratio = this.host.idealRatio;\r\n const windowContentsWidth = this._window._currentMeasure.width;\r\n const windowContentsHeight = this._window._currentMeasure.height;\r\n\r\n if (!force && this._oldWindowContentsWidth === windowContentsWidth && this._oldWindowContentsHeight === windowContentsHeight) {\r\n return;\r\n }\r\n\r\n this._oldWindowContentsWidth = windowContentsWidth;\r\n this._oldWindowContentsHeight = windowContentsHeight;\r\n\r\n const _endLeft = this._clientWidth - windowContentsWidth;\r\n const _endTop = this._clientHeight - windowContentsHeight;\r\n\r\n const newLeft = (this._horizontalBar.value / ratio) * _endLeft + \"px\";\r\n const newTop = (this._verticalBar.value / ratio) * _endTop + \"px\";\r\n\r\n if (newLeft !== this._window.left) {\r\n this._window.left = newLeft;\r\n if (!this.freezeControls) {\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n\r\n if (newTop !== this._window.top) {\r\n this._window.top = newTop;\r\n if (!this.freezeControls) {\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n private _updateScroller(): void {\r\n const windowContentsWidth = this._window._currentMeasure.width;\r\n const windowContentsHeight = this._window._currentMeasure.height;\r\n\r\n if (this._horizontalBar.isVisible && windowContentsWidth <= this._clientWidth && !this.forceHorizontalBar) {\r\n this._grid.setRowDefinition(1, 0, true);\r\n this._horizontalBar.isVisible = false;\r\n this._horizontalBar.value = 0;\r\n this._rebuildLayout = true;\r\n } else if (!this._horizontalBar.isVisible && (windowContentsWidth > this._clientWidth || this.forceHorizontalBar)) {\r\n this._grid.setRowDefinition(1, this._barSize, true);\r\n this._horizontalBar.isVisible = true;\r\n this._rebuildLayout = true;\r\n }\r\n\r\n if (this._verticalBar.isVisible && windowContentsHeight <= this._clientHeight && !this.forceVerticalBar) {\r\n this._grid.setColumnDefinition(1, 0, true);\r\n this._verticalBar.isVisible = false;\r\n this._verticalBar.value = 0;\r\n this._rebuildLayout = true;\r\n } else if (!this._verticalBar.isVisible && (windowContentsHeight > this._clientHeight || this.forceVerticalBar)) {\r\n this._grid.setColumnDefinition(1, this._barSize, true);\r\n this._verticalBar.isVisible = true;\r\n this._rebuildLayout = true;\r\n }\r\n\r\n this._buildClientSizes();\r\n\r\n const ratio = this.host.idealRatio;\r\n\r\n this._horizontalBar.thumbWidth = this._thumbLength * 0.9 * (this._clientWidth / ratio) + \"px\";\r\n this._verticalBar.thumbWidth = this._thumbLength * 0.9 * (this._clientHeight / ratio) + \"px\";\r\n }\r\n\r\n public override _link(host: AdvancedDynamicTexture): void {\r\n super._link(host);\r\n\r\n this._attachWheel();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n private _addBar(barControl: ScrollBar | ImageScrollBar, barContainer: Rectangle, isVertical: boolean, rotation: number) {\r\n barControl.paddingLeft = 0;\r\n barControl.width = \"100%\";\r\n barControl.height = \"100%\";\r\n barControl.barOffset = 0;\r\n barControl.value = 0;\r\n barControl.maximum = 1;\r\n barControl.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n barControl.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n barControl.isVertical = isVertical;\r\n barControl.rotation = rotation;\r\n barControl.isVisible = false;\r\n\r\n barContainer.addControl(barControl);\r\n\r\n barControl.onValueChangedObservable.add(() => {\r\n this._setWindowPosition();\r\n });\r\n }\r\n\r\n /** @internal */\r\n private _attachWheel() {\r\n if (!this._host || this._onWheelObserver) {\r\n return;\r\n }\r\n\r\n this._onWheelObserver = this.onWheelObservable.add((pi) => {\r\n if (!this._pointerIsOver || this.isReadOnly) {\r\n return;\r\n }\r\n if (this._verticalBar.isVisible == true) {\r\n if (pi.y < 0 && this._verticalBar.value > 0) {\r\n this._verticalBar.value -= this._wheelPrecision;\r\n } else if (pi.y > 0 && this._verticalBar.value < this._verticalBar.maximum) {\r\n this._verticalBar.value += this._wheelPrecision;\r\n }\r\n }\r\n if (this._horizontalBar.isVisible == true) {\r\n if (pi.x < 0 && this._horizontalBar.value < this._horizontalBar.maximum) {\r\n this._horizontalBar.value += this._wheelPrecision;\r\n } else if (pi.x > 0 && this._horizontalBar.value > 0) {\r\n this._horizontalBar.value -= this._wheelPrecision;\r\n }\r\n }\r\n });\r\n }\r\n\r\n public override _renderHighlightSpecific(context: ICanvasRenderingContext): void {\r\n if (!this.isHighlighted) {\r\n return;\r\n }\r\n\r\n super._renderHighlightSpecific(context);\r\n\r\n this._grid._renderHighlightSpecific(context);\r\n\r\n context.restore();\r\n }\r\n\r\n /** Releases associated resources */\r\n public override dispose() {\r\n this.onWheelObservable.remove(this._onWheelObserver);\r\n this._onWheelObserver = null;\r\n super.dispose();\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.ScrollViewer\", ScrollViewer);\r\n"]}
|
1
|
+
{"version":3,"file":"scrollViewer.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/2D/controls/scrollViewers/scrollViewer.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAEjD;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,SAAS;IA+BvC;;OAEG;IACH,IAAW,aAAa;QAC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AAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACrD,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AA1aG;IADC,SAAS,EAAE;kDAGX;AAoBD;IADC,SAAS,EAAE;oDAGX;AAYD;IADC,SAAS,EAAE;4CAGX;AA6DD;IADC,SAAS,EAAE;2CAGX;AAmID;IADC,SAAS,EAAE;iDAGX;AAiML,aAAa,CAAC,0BAA0B,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport type { Vector2 } from \"core/Maths/math\";\r\nimport { Rectangle } from \"../rectangle\";\r\nimport { Grid } from \"../grid\";\r\nimport type { Image } from \"../image\";\r\nimport { Control } from \"../control\";\r\nimport type { Container } from \"../container\";\r\nimport type { Measure } from \"../../measure\";\r\nimport type { AdvancedDynamicTexture } from \"../../advancedDynamicTexture\";\r\nimport { _ScrollViewerWindow } from \"./scrollViewerWindow\";\r\nimport { ScrollBar } from \"../sliders/scrollBar\";\r\nimport { ImageScrollBar } from \"../sliders/imageScrollBar\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\n\r\n/**\r\n * Class used to hold a viewer window and sliders in a grid\r\n */\r\nexport class ScrollViewer extends Rectangle {\r\n private _grid: Grid;\r\n private _horizontalBarSpace: Rectangle;\r\n private _verticalBarSpace: Rectangle;\r\n private _dragSpace: Rectangle;\r\n private _horizontalBar: ScrollBar | ImageScrollBar;\r\n private _verticalBar: ScrollBar | ImageScrollBar;\r\n private _barColor: string;\r\n private _barBackground: string;\r\n private _barImage: Image;\r\n private _horizontalBarImage: Image;\r\n private _verticalBarImage: Image;\r\n private _barBackgroundImage: Image;\r\n private _horizontalBarBackgroundImage: Image;\r\n private _verticalBarBackgroundImage: Image;\r\n private _barSize: number = 20;\r\n private _window: _ScrollViewerWindow;\r\n private _pointerIsOver: Boolean = false;\r\n private _wheelPrecision: number = 0.05;\r\n private _onWheelObserver: Nullable<Observer<Vector2>>;\r\n private _clientWidth: number;\r\n private _clientHeight: number;\r\n private _useImageBar: Boolean;\r\n private _thumbLength: number = 0.5;\r\n private _thumbHeight: number = 1;\r\n private _barImageHeight: number = 1;\r\n private _horizontalBarImageHeight: number = 1;\r\n private _verticalBarImageHeight: number = 1;\r\n private _oldWindowContentsWidth: number = 0;\r\n private _oldWindowContentsHeight: number = 0;\r\n\r\n /**\r\n * Gets the horizontal scrollbar\r\n */\r\n public get horizontalBar(): ScrollBar | ImageScrollBar {\r\n return this._horizontalBar;\r\n }\r\n\r\n /**\r\n * Gets the vertical scrollbar\r\n */\r\n public get verticalBar(): ScrollBar | ImageScrollBar {\r\n return this._verticalBar;\r\n }\r\n\r\n /**\r\n * Adds a new control to the current container\r\n * @param control defines the control to add\r\n * @returns the current container\r\n */\r\n public override addControl(control: Nullable<Control>): Container {\r\n if (!control) {\r\n return this;\r\n }\r\n\r\n this._window.addControl(control);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Removes a control from the current container\r\n * @param control defines the control to remove\r\n * @returns the current container\r\n */\r\n public override removeControl(control: Control): Container {\r\n this._window.removeControl(control);\r\n return this;\r\n }\r\n\r\n /** Gets the list of children */\r\n public override get children(): Control[] {\r\n return this._window.children;\r\n }\r\n\r\n public override _flagDescendantsAsMatrixDirty(): void {\r\n for (const child of this._children) {\r\n child._markMatrixAsDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Freezes or unfreezes the controls in the window.\r\n * When controls are frozen, the scroll viewer can render a lot more quickly but updates to positions/sizes of controls\r\n * are not taken into account. If you want to change positions/sizes, unfreeze, perform the changes then freeze again\r\n */\r\n public get freezeControls(): boolean {\r\n return this._window.freezeControls;\r\n }\r\n\r\n public set freezeControls(value: boolean) {\r\n this._window.freezeControls = value;\r\n }\r\n\r\n /** Gets the bucket width */\r\n public get bucketWidth(): number {\r\n return this._window.bucketWidth;\r\n }\r\n\r\n /** Gets the bucket height */\r\n public get bucketHeight(): number {\r\n return this._window.bucketHeight;\r\n }\r\n\r\n /**\r\n * Sets the bucket sizes.\r\n * When freezeControls is true, setting a non-zero bucket size will improve performances by updating only\r\n * controls that are visible. The bucket sizes is used to subdivide (internally) the window area to smaller areas into which\r\n * controls are dispatched. So, the size should be roughly equals to the mean size of all the controls of\r\n * the window. To disable the usage of buckets, sets either width or height (or both) to 0.\r\n * Please note that using this option will raise the memory usage (the higher the bucket sizes, the less memory\r\n * used), that's why it is not enabled by default.\r\n * @param width width of the bucket\r\n * @param height height of the bucket\r\n */\r\n public setBucketSizes(width: number, height: number): void {\r\n this._window.setBucketSizes(width, height);\r\n }\r\n\r\n private _forceHorizontalBar: boolean = false;\r\n private _forceVerticalBar: boolean = false;\r\n\r\n /**\r\n * Forces the horizontal scroll bar to be displayed\r\n */\r\n public get forceHorizontalBar(): boolean {\r\n return this._forceHorizontalBar;\r\n }\r\n\r\n public set forceHorizontalBar(value: boolean) {\r\n this._grid.setRowDefinition(1, value ? this._barSize : 0, true);\r\n this._horizontalBar.isVisible = value;\r\n this._forceHorizontalBar = value;\r\n }\r\n\r\n /**\r\n * Forces the vertical scroll bar to be displayed\r\n */\r\n public get forceVerticalBar(): boolean {\r\n return this._forceVerticalBar;\r\n }\r\n\r\n public set forceVerticalBar(value: boolean) {\r\n this._grid.setColumnDefinition(1, value ? this._barSize : 0, true);\r\n this._verticalBar.isVisible = value;\r\n this._forceVerticalBar = value;\r\n }\r\n\r\n /**\r\n * Creates a new ScrollViewer\r\n * @param name of ScrollViewer\r\n * @param isImageBased\r\n */\r\n constructor(name?: string, isImageBased?: boolean) {\r\n super(name);\r\n\r\n this._useImageBar = isImageBased ? isImageBased : false;\r\n\r\n this.onDirtyObservable.add(() => {\r\n this._horizontalBarSpace.color = this.color;\r\n this._verticalBarSpace.color = this.color;\r\n this._dragSpace.color = this.color;\r\n });\r\n\r\n this.onPointerEnterObservable.add(() => {\r\n this._pointerIsOver = true;\r\n });\r\n\r\n this.onPointerOutObservable.add(() => {\r\n this._pointerIsOver = false;\r\n });\r\n\r\n this._grid = new Grid();\r\n if (this._useImageBar) {\r\n this._horizontalBar = new ImageScrollBar();\r\n this._verticalBar = new ImageScrollBar();\r\n } else {\r\n this._horizontalBar = new ScrollBar();\r\n this._verticalBar = new ScrollBar();\r\n }\r\n\r\n this._window = new _ScrollViewerWindow(\"scrollViewer_window\");\r\n this._window.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._window.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n\r\n this._grid.addColumnDefinition(1);\r\n this._grid.addColumnDefinition(0, true);\r\n this._grid.addRowDefinition(1);\r\n this._grid.addRowDefinition(0, true);\r\n\r\n super.addControl(this._grid);\r\n this._grid.addControl(this._window, 0, 0);\r\n\r\n this._verticalBarSpace = new Rectangle();\r\n this._verticalBarSpace.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._verticalBarSpace.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n this._verticalBarSpace.thickness = 1;\r\n this._grid.addControl(this._verticalBarSpace, 0, 1);\r\n this._addBar(this._verticalBar, this._verticalBarSpace, true, Math.PI);\r\n\r\n this._horizontalBarSpace = new Rectangle();\r\n this._horizontalBarSpace.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._horizontalBarSpace.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n this._horizontalBarSpace.thickness = 1;\r\n this._grid.addControl(this._horizontalBarSpace, 1, 0);\r\n this._addBar(this._horizontalBar, this._horizontalBarSpace, false, 0);\r\n\r\n this._dragSpace = new Rectangle();\r\n this._dragSpace.thickness = 1;\r\n this._grid.addControl(this._dragSpace, 1, 1);\r\n\r\n this._grid.clipChildren = false;\r\n\r\n // Colors\r\n if (!this._useImageBar) {\r\n this.barColor = \"grey\";\r\n this.barBackground = \"transparent\";\r\n }\r\n }\r\n\r\n /** Reset the scroll viewer window to initial size */\r\n public resetWindow() {\r\n this._window.width = \"100%\";\r\n this._window.height = \"100%\";\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"ScrollViewer\";\r\n }\r\n\r\n private _buildClientSizes() {\r\n const ratio = this.host.idealRatio;\r\n\r\n this._window.parentClientWidth = this._currentMeasure.width - (this._verticalBar.isVisible || this.forceVerticalBar ? this._barSize * ratio : 0) - 2 * this.thickness;\r\n this._window.parentClientHeight = this._currentMeasure.height - (this._horizontalBar.isVisible || this.forceHorizontalBar ? this._barSize * ratio : 0) - 2 * this.thickness;\r\n\r\n this._clientWidth = this._window.parentClientWidth;\r\n this._clientHeight = this._window.parentClientHeight;\r\n }\r\n\r\n protected override _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n super._additionalProcessing(parentMeasure, context);\r\n\r\n this._buildClientSizes();\r\n }\r\n\r\n protected override _postMeasure(): void {\r\n super._postMeasure();\r\n\r\n this._updateScroller();\r\n\r\n this._setWindowPosition(false);\r\n }\r\n\r\n /**\r\n * Gets or sets the mouse wheel precision\r\n * from 0 to 1 with a default value of 0.05\r\n * */\r\n @serialize()\r\n public get wheelPrecision(): number {\r\n return this._wheelPrecision;\r\n }\r\n\r\n public set wheelPrecision(value: number) {\r\n if (this._wheelPrecision === value) {\r\n return;\r\n }\r\n\r\n if (value < 0) {\r\n value = 0;\r\n }\r\n\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n\r\n this._wheelPrecision = value;\r\n }\r\n\r\n /** Gets or sets the scroll bar container background color */\r\n @serialize()\r\n public get scrollBackground(): string {\r\n return this._horizontalBarSpace.background;\r\n }\r\n\r\n public set scrollBackground(color: string) {\r\n if (this._horizontalBarSpace.background === color) {\r\n return;\r\n }\r\n this._horizontalBarSpace.background = color;\r\n this._verticalBarSpace.background = color;\r\n }\r\n\r\n /** Gets or sets the bar color */\r\n @serialize()\r\n public get barColor(): string {\r\n return this._barColor;\r\n }\r\n\r\n public set barColor(color: string) {\r\n if (this._barColor === color) {\r\n return;\r\n }\r\n\r\n this._barColor = color;\r\n this._horizontalBar.color = color;\r\n this._verticalBar.color = color;\r\n }\r\n\r\n /** Gets or sets the bar image */\r\n public get thumbImage(): Image {\r\n return this._barImage;\r\n }\r\n\r\n public set thumbImage(value: Image) {\r\n if (this._barImage === value) {\r\n return;\r\n }\r\n\r\n this._barImage = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n hb.thumbImage = value;\r\n vb.thumbImage = value;\r\n }\r\n\r\n /** Gets or sets the horizontal bar image */\r\n public get horizontalThumbImage(): Image {\r\n return this._horizontalBarImage;\r\n }\r\n\r\n public set horizontalThumbImage(value: Image) {\r\n if (this._horizontalBarImage === value) {\r\n return;\r\n }\r\n\r\n this._horizontalBarImage = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n hb.thumbImage = value;\r\n }\r\n\r\n /** Gets or sets the vertical bar image */\r\n public get verticalThumbImage(): Image {\r\n return this._verticalBarImage;\r\n }\r\n\r\n public set verticalThumbImage(value: Image) {\r\n if (this._verticalBarImage === value) {\r\n return;\r\n }\r\n\r\n this._verticalBarImage = value;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n vb.thumbImage = value;\r\n }\r\n\r\n /** Gets or sets the size of the bar */\r\n @serialize()\r\n public get barSize(): number {\r\n return this._barSize;\r\n }\r\n\r\n public set barSize(value: number) {\r\n if (this._barSize === value) {\r\n return;\r\n }\r\n\r\n this._barSize = value;\r\n this._markAsDirty();\r\n\r\n if (this._horizontalBar.isVisible) {\r\n this._grid.setRowDefinition(1, this._barSize, true);\r\n }\r\n if (this._verticalBar.isVisible) {\r\n this._grid.setColumnDefinition(1, this._barSize, true);\r\n }\r\n }\r\n\r\n /** Gets or sets the length of the thumb */\r\n public get thumbLength(): number {\r\n return this._thumbLength;\r\n }\r\n\r\n public set thumbLength(value: number) {\r\n if (this._thumbLength === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._thumbLength = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n hb.thumbLength = value;\r\n vb.thumbLength = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets the height of the thumb */\r\n public get thumbHeight(): number {\r\n return this._thumbHeight;\r\n }\r\n\r\n public set thumbHeight(value: number) {\r\n if (this._thumbHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._thumbHeight = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n hb.thumbHeight = value;\r\n vb.thumbHeight = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets the height of the bar image */\r\n public get barImageHeight(): number {\r\n return this._barImageHeight;\r\n }\r\n\r\n public set barImageHeight(value: number) {\r\n if (this._barImageHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._barImageHeight = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n hb.barImageHeight = value;\r\n vb.barImageHeight = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets the height of the horizontal bar image */\r\n public get horizontalBarImageHeight(): number {\r\n return this._horizontalBarImageHeight;\r\n }\r\n\r\n public set horizontalBarImageHeight(value: number) {\r\n if (this._horizontalBarImageHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._horizontalBarImageHeight = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n hb.barImageHeight = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets the height of the vertical bar image */\r\n public get verticalBarImageHeight(): number {\r\n return this._verticalBarImageHeight;\r\n }\r\n\r\n public set verticalBarImageHeight(value: number) {\r\n if (this._verticalBarImageHeight === value) {\r\n return;\r\n }\r\n if (value <= 0) {\r\n value = 0.1;\r\n }\r\n if (value > 1) {\r\n value = 1;\r\n }\r\n this._verticalBarImageHeight = value;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n vb.barImageHeight = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets the bar background */\r\n @serialize()\r\n public get barBackground(): string {\r\n return this._barBackground;\r\n }\r\n\r\n public set barBackground(color: string) {\r\n if (this._barBackground === color) {\r\n return;\r\n }\r\n\r\n this._barBackground = color;\r\n const hb = <ScrollBar>this._horizontalBar;\r\n const vb = <ScrollBar>this._verticalBar;\r\n hb.background = color;\r\n vb.background = color;\r\n this._dragSpace.background = color;\r\n }\r\n\r\n /** Gets or sets the bar background image */\r\n public get barImage(): Image {\r\n return this._barBackgroundImage;\r\n }\r\n\r\n public set barImage(value: Image) {\r\n this._barBackgroundImage = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n hb.backgroundImage = value;\r\n vb.backgroundImage = value;\r\n }\r\n\r\n /** Gets or sets the horizontal bar background image */\r\n public get horizontalBarImage(): Image {\r\n return this._horizontalBarBackgroundImage;\r\n }\r\n\r\n public set horizontalBarImage(value: Image) {\r\n this._horizontalBarBackgroundImage = value;\r\n const hb = <ImageScrollBar>this._horizontalBar;\r\n hb.backgroundImage = value;\r\n }\r\n\r\n /** Gets or sets the vertical bar background image */\r\n public get verticalBarImage(): Image {\r\n return this._verticalBarBackgroundImage;\r\n }\r\n\r\n public set verticalBarImage(value: Image) {\r\n this._verticalBarBackgroundImage = value;\r\n const vb = <ImageScrollBar>this._verticalBar;\r\n vb.backgroundImage = value;\r\n }\r\n\r\n private _setWindowPosition(force = true): void {\r\n const ratio = this.host.idealRatio;\r\n const windowContentsWidth = this._window._currentMeasure.width;\r\n const windowContentsHeight = this._window._currentMeasure.height;\r\n\r\n if (!force && this._oldWindowContentsWidth === windowContentsWidth && this._oldWindowContentsHeight === windowContentsHeight) {\r\n return;\r\n }\r\n\r\n this._oldWindowContentsWidth = windowContentsWidth;\r\n this._oldWindowContentsHeight = windowContentsHeight;\r\n\r\n const _endLeft = this._clientWidth - windowContentsWidth;\r\n const _endTop = this._clientHeight - windowContentsHeight;\r\n\r\n const newLeft = (this._horizontalBar.value / ratio) * _endLeft + \"px\";\r\n const newTop = (this._verticalBar.value / ratio) * _endTop + \"px\";\r\n\r\n if (newLeft !== this._window.left) {\r\n this._window.left = newLeft;\r\n if (!this.freezeControls) {\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n\r\n if (newTop !== this._window.top) {\r\n this._window.top = newTop;\r\n if (!this.freezeControls) {\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n private _updateScroller(): void {\r\n const windowContentsWidth = this._window._currentMeasure.width;\r\n const windowContentsHeight = this._window._currentMeasure.height;\r\n\r\n if (this._horizontalBar.isVisible && windowContentsWidth <= this._clientWidth && !this.forceHorizontalBar) {\r\n this._grid.setRowDefinition(1, 0, true);\r\n this._horizontalBar.isVisible = false;\r\n this._horizontalBar.value = 0;\r\n this._rebuildLayout = true;\r\n } else if (!this._horizontalBar.isVisible && (windowContentsWidth > this._clientWidth || this.forceHorizontalBar)) {\r\n this._grid.setRowDefinition(1, this._barSize, true);\r\n this._horizontalBar.isVisible = true;\r\n this._rebuildLayout = true;\r\n }\r\n\r\n if (this._verticalBar.isVisible && windowContentsHeight <= this._clientHeight && !this.forceVerticalBar) {\r\n this._grid.setColumnDefinition(1, 0, true);\r\n this._verticalBar.isVisible = false;\r\n this._verticalBar.value = 0;\r\n this._rebuildLayout = true;\r\n } else if (!this._verticalBar.isVisible && (windowContentsHeight > this._clientHeight || this.forceVerticalBar)) {\r\n this._grid.setColumnDefinition(1, this._barSize, true);\r\n this._verticalBar.isVisible = true;\r\n this._rebuildLayout = true;\r\n }\r\n\r\n this._buildClientSizes();\r\n\r\n const ratio = this.host.idealRatio;\r\n\r\n this._horizontalBar.thumbWidth = this._thumbLength * 0.9 * (this._clientWidth / ratio) + \"px\";\r\n this._verticalBar.thumbWidth = this._thumbLength * 0.9 * (this._clientHeight / ratio) + \"px\";\r\n }\r\n\r\n public override _link(host: AdvancedDynamicTexture): void {\r\n super._link(host);\r\n\r\n this._attachWheel();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n private _addBar(barControl: ScrollBar | ImageScrollBar, barContainer: Rectangle, isVertical: boolean, rotation: number) {\r\n barControl.paddingLeft = 0;\r\n barControl.width = \"100%\";\r\n barControl.height = \"100%\";\r\n barControl.barOffset = 0;\r\n barControl.value = 0;\r\n barControl.maximum = 1;\r\n barControl.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n barControl.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;\r\n barControl.isVertical = isVertical;\r\n barControl.rotation = rotation;\r\n barControl.isVisible = false;\r\n\r\n barContainer.addControl(barControl);\r\n\r\n barControl.onValueChangedObservable.add(() => {\r\n this._setWindowPosition();\r\n });\r\n }\r\n\r\n /** @internal */\r\n private _attachWheel() {\r\n if (!this._host || this._onWheelObserver) {\r\n return;\r\n }\r\n\r\n this._onWheelObserver = this.onWheelObservable.add((pi) => {\r\n if (!this._pointerIsOver || this.isReadOnly) {\r\n return;\r\n }\r\n if (this._verticalBar.isVisible == true) {\r\n if (pi.y < 0 && this._verticalBar.value > 0) {\r\n this._verticalBar.value -= this._wheelPrecision;\r\n } else if (pi.y > 0 && this._verticalBar.value < this._verticalBar.maximum) {\r\n this._verticalBar.value += this._wheelPrecision;\r\n }\r\n }\r\n if (this._horizontalBar.isVisible == true) {\r\n if (pi.x < 0 && this._horizontalBar.value < this._horizontalBar.maximum) {\r\n this._horizontalBar.value += this._wheelPrecision;\r\n } else if (pi.x > 0 && this._horizontalBar.value > 0) {\r\n this._horizontalBar.value -= this._wheelPrecision;\r\n }\r\n }\r\n });\r\n }\r\n\r\n public override _renderHighlightSpecific(context: ICanvasRenderingContext): void {\r\n if (!this.isHighlighted) {\r\n return;\r\n }\r\n\r\n super._renderHighlightSpecific(context);\r\n\r\n this._grid._renderHighlightSpecific(context);\r\n\r\n context.restore();\r\n }\r\n\r\n /** Releases associated resources */\r\n public override dispose() {\r\n this.onWheelObservable.remove(this._onWheelObserver);\r\n this._onWheelObserver = null;\r\n super.dispose();\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.ScrollViewer\", ScrollViewer);\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scrollViewerWindow.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/2D/controls/scrollViewers/scrollViewerWindow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAS9C,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED,IAAW,cAAc,CAAC,KAAc;QACpC,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,EAAE;YAChC,OAAO;SACV;QAED,IAAI,CAAC,KAAK,EAAE;YACR,IAAI,CAAC,gBAAgB,EAAE,CAAC;SAC3B;QAED,kGAAkG;QAClG,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAE7B,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACxC,MAAM,WAAW,GAAG,WA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CAAC,QAAQ,GAAG,IAAI,CAAC;SACxB;QAED,KAAK,CAAC,YAAY,EAAE,CAAC;IACzB,CAAC;CACJ","sourcesContent":["import { Measure } from \"../../measure\";\r\nimport { Container } from \"../container\";\r\nimport { ValueAndUnit } from \"../../valueAndUnit\";\r\nimport { Control } from \"../control\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\n\r\n/**\r\n * Class used to hold a the container for ScrollViewer\r\n * @internal\r\n */\r\nexport class _ScrollViewerWindow extends Container {\r\n public parentClientWidth: number;\r\n public parentClientHeight: number;\r\n\r\n private _freezeControls = false;\r\n private _parentMeasure: Measure;\r\n private _oldLeft: number | null;\r\n private _oldTop: number | null;\r\n\r\n public get freezeControls(): boolean {\r\n return this._freezeControls;\r\n }\r\n\r\n public set freezeControls(value: boolean) {\r\n if (this._freezeControls === value) {\r\n return;\r\n }\r\n\r\n if (!value) {\r\n this._restoreMeasures();\r\n }\r\n\r\n // trigger a full normal layout calculation to be sure all children have their measures up to date\r\n this._freezeControls = false;\r\n\r\n const textureSize = this.host.getSize();\r\n const renderWidth = textureSize.width;\r\n const renderHeight = textureSize.height;\r\n\r\n const context = this.host.getContext();\r\n\r\n const measure = new Measure(0, 0, renderWidth, renderHeight);\r\n\r\n this.host._numLayoutCalls = 0;\r\n\r\n this.host._rootContainer._layout(measure, context);\r\n\r\n // in freeze mode, prepare children measures accordingly\r\n if (value) {\r\n this._updateMeasures();\r\n if (this._useBuckets()) {\r\n this._makeBuckets();\r\n }\r\n }\r\n\r\n this._freezeControls = value;\r\n\r\n this.host.markAsDirty(); // redraw with the (new) current settings\r\n }\r\n\r\n private _bucketWidth: number = 0;\r\n private _bucketHeight: number = 0;\r\n private _buckets: { [key: number]: Array<Control> } = {};\r\n private _bucketLen: number;\r\n\r\n public get bucketWidth(): number {\r\n return this._bucketWidth;\r\n }\r\n\r\n public get bucketHeight(): number {\r\n return this._bucketHeight;\r\n }\r\n\r\n public setBucketSizes(width: number, height: number): void {\r\n this._bucketWidth = width;\r\n this._bucketHeight = height;\r\n\r\n if (this._useBuckets()) {\r\n if (this._freezeControls) {\r\n this._makeBuckets();\r\n }\r\n } else {\r\n this._buckets = {};\r\n }\r\n }\r\n\r\n private _useBuckets(): boolean {\r\n return this._bucketWidth > 0 && this._bucketHeight > 0;\r\n }\r\n\r\n private _makeBuckets(): void {\r\n this._buckets = {};\r\n this._bucketLen = Math.ceil(this.widthInPixels / this._bucketWidth);\r\n this._dispatchInBuckets(this._children);\r\n this._oldLeft = null;\r\n this._oldTop = null;\r\n }\r\n\r\n private _dispatchInBuckets(children: Control[]): void {\r\n for (let i = 0; i < children.length; ++i) {\r\n const child = children[i];\r\n\r\n const bStartX = Math.max(0, Math.floor((child._customData._origLeft - this._customData.origLeft) / this._bucketWidth)),\r\n bEndX = Math.floor((child._customData._origLeft - this._customData.origLeft + child._currentMeasure.width - 1) / this._bucketWidth),\r\n bEndY = Math.floor((child._customData._origTop - this._customData.origTop + child._currentMeasure.height - 1) / this._bucketHeight);\r\n let bStartY = Math.max(0, Math.floor((child._customData._origTop - this._customData.origTop) / this._bucketHeight));\r\n\r\n while (bStartY <= bEndY) {\r\n for (let x = bStartX; x <= bEndX; ++x) {\r\n const bucket = bStartY * this._bucketLen + x;\r\n let lstc = this._buckets[bucket];\r\n\r\n if (!lstc) {\r\n lstc = [];\r\n this._buckets[bucket] = lstc;\r\n }\r\n\r\n lstc.push(child);\r\n }\r\n bStartY++;\r\n }\r\n\r\n if (child instanceof Container && child._children.length > 0) {\r\n this._dispatchInBuckets(child._children);\r\n }\r\n }\r\n }\r\n\r\n // reset left and top measures for the window and all its children\r\n private _updateMeasures(): void {\r\n const left = this.leftInPixels | 0,\r\n top = this.topInPixels | 0;\r\n\r\n this._measureForChildren.left -= left;\r\n this._measureForChildren.top -= top;\r\n this._currentMeasure.left -= left;\r\n this._currentMeasure.top -= top;\r\n\r\n this._customData.origLeftForChildren = this._measureForChildren.left;\r\n this._customData.origTopForChildren = this._measureForChildren.top;\r\n this._customData.origLeft = this._currentMeasure.left;\r\n this._customData.origTop = this._currentMeasure.top;\r\n\r\n this._updateChildrenMeasures(this._children, left, top);\r\n }\r\n\r\n private _updateChildrenMeasures(children: Control[], left: number, top: number): void {\r\n for (let i = 0; i < children.length; ++i) {\r\n const child = children[i];\r\n\r\n child._currentMeasure.left -= left;\r\n child._currentMeasure.top -= top;\r\n\r\n child._customData._origLeft = child._currentMeasure.left; // save the original left and top values for each child\r\n child._customData._origTop = child._currentMeasure.top;\r\n\r\n if (child instanceof Container && child._children.length > 0) {\r\n this._updateChildrenMeasures(child._children, left, top);\r\n }\r\n }\r\n }\r\n\r\n private _restoreMeasures(): void {\r\n const left = this.leftInPixels | 0,\r\n top = this.topInPixels | 0;\r\n\r\n this._measureForChildren.left = this._customData.origLeftForChildren + left;\r\n this._measureForChildren.top = this._customData.origTopForChildren + top;\r\n this._currentMeasure.left = this._customData.origLeft + left;\r\n this._currentMeasure.top = this._customData.origTop + top;\r\n }\r\n\r\n /**\r\n * Creates a new ScrollViewerWindow\r\n * @param name of ScrollViewerWindow\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"ScrollViewerWindow\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected override _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n super._additionalProcessing(parentMeasure, context);\r\n\r\n this._parentMeasure = parentMeasure;\r\n\r\n this._measureForChildren.left = this._currentMeasure.left;\r\n this._measureForChildren.top = this._currentMeasure.top;\r\n\r\n this._measureForChildren.width = parentMeasure.width;\r\n this._measureForChildren.height = parentMeasure.height;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _layout(parentMeasure: Measure, context: ICanvasRenderingContext): boolean {\r\n if (this._freezeControls) {\r\n this.invalidateRect(); // will trigger a redraw of the window\r\n return false;\r\n }\r\n\r\n return super._layout(parentMeasure, context);\r\n }\r\n\r\n private _scrollChildren(children: Control[], left: number, top: number): void {\r\n for (let i = 0; i < children.length; ++i) {\r\n const child = children[i];\r\n\r\n child._currentMeasure.left = child._customData._origLeft + left;\r\n child._currentMeasure.top = child._customData._origTop + top;\r\n child._isClipped = false; // clipping will be handled by _draw and the call to _intersectsRect()\r\n\r\n if (child instanceof Container && child._children.length > 0) {\r\n this._scrollChildren(child._children, left, top);\r\n }\r\n }\r\n }\r\n\r\n private _scrollChildrenWithBuckets(left: number, top: number, scrollLeft: number, scrollTop: number): void {\r\n const bStartX = Math.max(0, Math.floor(-left / this._bucketWidth)),\r\n bEndX = Math.floor((-left + this._parentMeasure.width - 1) / this._bucketWidth),\r\n bEndY = Math.floor((-top + this._parentMeasure.height - 1) / this._bucketHeight);\r\n let bStartY = Math.max(0, Math.floor(-top / this._bucketHeight));\r\n\r\n while (bStartY <= bEndY) {\r\n for (let x = bStartX; x <= bEndX; ++x) {\r\n const bucket = bStartY * this._bucketLen + x,\r\n lstc = this._buckets[bucket];\r\n\r\n if (lstc) {\r\n for (let i = 0; i < lstc.length; ++i) {\r\n const child = lstc[i];\r\n child._currentMeasure.left = child._customData._origLeft + scrollLeft;\r\n child._currentMeasure.top = child._customData._origTop + scrollTop;\r\n child._isClipped = false; // clipping will be handled by _draw and the call to _intersectsRect()\r\n }\r\n }\r\n }\r\n bStartY++;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _draw(context: ICanvasRenderingContext, invalidatedRectangle?: Measure): void {\r\n if (!this._freezeControls) {\r\n super._draw(context, invalidatedRectangle);\r\n return;\r\n }\r\n\r\n this._localDraw(context);\r\n\r\n if (this.clipChildren) {\r\n this._clipForChildren(context);\r\n }\r\n\r\n const left = this.leftInPixels | 0,\r\n top = this.topInPixels | 0;\r\n\r\n if (this._useBuckets()) {\r\n if (this._oldLeft !== null && this._oldTop !== null) {\r\n this._scrollChildrenWithBuckets(this._oldLeft, this._oldTop, left, top);\r\n this._scrollChildrenWithBuckets(left, top, left, top);\r\n } else {\r\n this._scrollChildren(this._children, left, top);\r\n }\r\n } else {\r\n this._scrollChildren(this._children, left, top);\r\n }\r\n\r\n this._oldLeft = left;\r\n this._oldTop = top;\r\n\r\n for (const child of this._children) {\r\n if (!child._intersectsRect(this._parentMeasure)) {\r\n continue;\r\n }\r\n child._render(context, this._parentMeasure);\r\n }\r\n }\r\n\r\n protected override _postMeasure(): void {\r\n if (this._freezeControls) {\r\n super._postMeasure();\r\n return;\r\n }\r\n\r\n let maxWidth = this.parentClientWidth;\r\n let maxHeight = this.parentClientHeight;\r\n for (const child of this.children) {\r\n if (!child.isVisible || child.notRenderable) {\r\n continue;\r\n }\r\n\r\n if (child.horizontalAlignment === Control.HORIZONTAL_ALIGNMENT_CENTER) {\r\n child._offsetLeft(this._currentMeasure.left - child._currentMeasure.left);\r\n }\r\n\r\n if (child.verticalAlignment === Control.VERTICAL_ALIGNMENT_CENTER) {\r\n child._offsetTop(this._currentMeasure.top - child._currentMeasure.top);\r\n }\r\n\r\n maxWidth = Math.max(maxWidth, child._currentMeasure.left - this._currentMeasure.left + child._currentMeasure.width + child.paddingRightInPixels);\r\n maxHeight = Math.max(maxHeight, child._currentMeasure.top - this._currentMeasure.top + child._currentMeasure.height + child.paddingBottomInPixels);\r\n }\r\n\r\n if (this._currentMeasure.width !== maxWidth) {\r\n this._width.updateInPlace(maxWidth, ValueAndUnit.UNITMODE_PIXEL);\r\n this._currentMeasure.width = maxWidth;\r\n this._rebuildLayout = true;\r\n this._isDirty = true;\r\n }\r\n\r\n if (this._currentMeasure.height !== maxHeight) {\r\n this._height.updateInPlace(maxHeight, ValueAndUnit.UNITMODE_PIXEL);\r\n this._currentMeasure.height = maxHeight;\r\n this._rebuildLayout = true;\r\n this._isDirty = true;\r\n }\r\n\r\n super._postMeasure();\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"scrollViewerWindow.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/2D/controls/scrollViewers/scrollViewerWindow.ts"],"names":[],"mappings":"A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r\nimport { Control } from \"../control\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\n\r\n/**\r\n * Class used to hold a the container for ScrollViewer\r\n * @internal\r\n */\r\nexport class _ScrollViewerWindow extends Container {\r\n public parentClientWidth: number;\r\n public parentClientHeight: number;\r\n\r\n private _freezeControls = false;\r\n private _parentMeasure: Measure;\r\n private _oldLeft: number | null;\r\n private _oldTop: number | null;\r\n\r\n public get freezeControls(): boolean {\r\n return this._freezeControls;\r\n }\r\n\r\n public set freezeControls(value: boolean) {\r\n if (this._freezeControls === value) {\r\n return;\r\n }\r\n\r\n if (!value) {\r\n this._restoreMeasures();\r\n }\r\n\r\n // trigger a full normal layout calculation to be sure all children have their measures up to date\r\n this._freezeControls = false;\r\n\r\n const textureSize = this.host.getSize();\r\n const renderWidth = textureSize.width;\r\n const renderHeight = textureSize.height;\r\n\r\n const context = this.host.getContext();\r\n\r\n const measure = new Measure(0, 0, renderWidth, renderHeight);\r\n\r\n this.host._numLayoutCalls = 0;\r\n\r\n this.host._rootContainer._layout(measure, context);\r\n\r\n // in freeze mode, prepare children measures accordingly\r\n if (value) {\r\n this._updateMeasures();\r\n if (this._useBuckets()) {\r\n this._makeBuckets();\r\n }\r\n }\r\n\r\n this._freezeControls = value;\r\n\r\n this.host.markAsDirty(); // redraw with the (new) current settings\r\n }\r\n\r\n private _bucketWidth: number = 0;\r\n private _bucketHeight: number = 0;\r\n private _buckets: { [key: number]: Array<Control> } = {};\r\n private _bucketLen: number;\r\n\r\n public get bucketWidth(): number {\r\n return this._bucketWidth;\r\n }\r\n\r\n public get bucketHeight(): number {\r\n return this._bucketHeight;\r\n }\r\n\r\n public setBucketSizes(width: number, height: number): void {\r\n this._bucketWidth = width;\r\n this._bucketHeight = height;\r\n\r\n if (this._useBuckets()) {\r\n if (this._freezeControls) {\r\n this._makeBuckets();\r\n }\r\n } else {\r\n this._buckets = {};\r\n }\r\n }\r\n\r\n private _useBuckets(): boolean {\r\n return this._bucketWidth > 0 && this._bucketHeight > 0;\r\n }\r\n\r\n private _makeBuckets(): void {\r\n this._buckets = {};\r\n this._bucketLen = Math.ceil(this.widthInPixels / this._bucketWidth);\r\n this._dispatchInBuckets(this._children);\r\n this._oldLeft = null;\r\n this._oldTop = null;\r\n }\r\n\r\n private _dispatchInBuckets(children: Control[]): void {\r\n for (let i = 0; i < children.length; ++i) {\r\n const child = children[i];\r\n\r\n const bStartX = Math.max(0, Math.floor((child._customData._origLeft - this._customData.origLeft) / this._bucketWidth)),\r\n bEndX = Math.floor((child._customData._origLeft - this._customData.origLeft + child._currentMeasure.width - 1) / this._bucketWidth),\r\n bEndY = Math.floor((child._customData._origTop - this._customData.origTop + child._currentMeasure.height - 1) / this._bucketHeight);\r\n let bStartY = Math.max(0, Math.floor((child._customData._origTop - this._customData.origTop) / this._bucketHeight));\r\n\r\n while (bStartY <= bEndY) {\r\n for (let x = bStartX; x <= bEndX; ++x) {\r\n const bucket = bStartY * this._bucketLen + x;\r\n let lstc = this._buckets[bucket];\r\n\r\n if (!lstc) {\r\n lstc = [];\r\n this._buckets[bucket] = lstc;\r\n }\r\n\r\n lstc.push(child);\r\n }\r\n bStartY++;\r\n }\r\n\r\n if (child instanceof Container && child._children.length > 0) {\r\n this._dispatchInBuckets(child._children);\r\n }\r\n }\r\n }\r\n\r\n // reset left and top measures for the window and all its children\r\n private _updateMeasures(): void {\r\n const left = this.leftInPixels | 0,\r\n top = this.topInPixels | 0;\r\n\r\n this._measureForChildren.left -= left;\r\n this._measureForChildren.top -= top;\r\n this._currentMeasure.left -= left;\r\n this._currentMeasure.top -= top;\r\n\r\n this._customData.origLeftForChildren = this._measureForChildren.left;\r\n this._customData.origTopForChildren = this._measureForChildren.top;\r\n this._customData.origLeft = this._currentMeasure.left;\r\n this._customData.origTop = this._currentMeasure.top;\r\n\r\n this._updateChildrenMeasures(this._children, left, top);\r\n }\r\n\r\n private _updateChildrenMeasures(children: Control[], left: number, top: number): void {\r\n for (let i = 0; i < children.length; ++i) {\r\n const child = children[i];\r\n\r\n child._currentMeasure.left -= left;\r\n child._currentMeasure.top -= top;\r\n\r\n child._customData._origLeft = child._currentMeasure.left; // save the original left and top values for each child\r\n child._customData._origTop = child._currentMeasure.top;\r\n\r\n if (child instanceof Container && child._children.length > 0) {\r\n this._updateChildrenMeasures(child._children, left, top);\r\n }\r\n }\r\n }\r\n\r\n private _restoreMeasures(): void {\r\n const left = this.leftInPixels | 0,\r\n top = this.topInPixels | 0;\r\n\r\n this._measureForChildren.left = this._customData.origLeftForChildren + left;\r\n this._measureForChildren.top = this._customData.origTopForChildren + top;\r\n this._currentMeasure.left = this._customData.origLeft + left;\r\n this._currentMeasure.top = this._customData.origTop + top;\r\n }\r\n\r\n /**\r\n * Creates a new ScrollViewerWindow\r\n * @param name of ScrollViewerWindow\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"ScrollViewerWindow\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected override _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n super._additionalProcessing(parentMeasure, context);\r\n\r\n this._parentMeasure = parentMeasure;\r\n\r\n this._measureForChildren.left = this._currentMeasure.left;\r\n this._measureForChildren.top = this._currentMeasure.top;\r\n\r\n this._measureForChildren.width = parentMeasure.width;\r\n this._measureForChildren.height = parentMeasure.height;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _layout(parentMeasure: Measure, context: ICanvasRenderingContext): boolean {\r\n if (this._freezeControls) {\r\n this.invalidateRect(); // will trigger a redraw of the window\r\n return false;\r\n }\r\n\r\n return super._layout(parentMeasure, context);\r\n }\r\n\r\n private _scrollChildren(children: Control[], left: number, top: number): void {\r\n for (let i = 0; i < children.length; ++i) {\r\n const child = children[i];\r\n\r\n child._currentMeasure.left = child._customData._origLeft + left;\r\n child._currentMeasure.top = child._customData._origTop + top;\r\n child._isClipped = false; // clipping will be handled by _draw and the call to _intersectsRect()\r\n\r\n if (child instanceof Container && child._children.length > 0) {\r\n this._scrollChildren(child._children, left, top);\r\n }\r\n }\r\n }\r\n\r\n private _scrollChildrenWithBuckets(left: number, top: number, scrollLeft: number, scrollTop: number): void {\r\n const bStartX = Math.max(0, Math.floor(-left / this._bucketWidth)),\r\n bEndX = Math.floor((-left + this._parentMeasure.width - 1) / this._bucketWidth),\r\n bEndY = Math.floor((-top + this._parentMeasure.height - 1) / this._bucketHeight);\r\n let bStartY = Math.max(0, Math.floor(-top / this._bucketHeight));\r\n\r\n while (bStartY <= bEndY) {\r\n for (let x = bStartX; x <= bEndX; ++x) {\r\n const bucket = bStartY * this._bucketLen + x,\r\n lstc = this._buckets[bucket];\r\n\r\n if (lstc) {\r\n for (let i = 0; i < lstc.length; ++i) {\r\n const child = lstc[i];\r\n child._currentMeasure.left = child._customData._origLeft + scrollLeft;\r\n child._currentMeasure.top = child._customData._origTop + scrollTop;\r\n child._isClipped = false; // clipping will be handled by _draw and the call to _intersectsRect()\r\n }\r\n }\r\n }\r\n bStartY++;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _draw(context: ICanvasRenderingContext, invalidatedRectangle?: Measure): void {\r\n if (!this._freezeControls) {\r\n super._draw(context, invalidatedRectangle);\r\n return;\r\n }\r\n\r\n this._localDraw(context);\r\n\r\n if (this.clipChildren) {\r\n this._clipForChildren(context);\r\n }\r\n\r\n const left = this.leftInPixels | 0,\r\n top = this.topInPixels | 0;\r\n\r\n if (this._useBuckets()) {\r\n if (this._oldLeft !== null && this._oldTop !== null) {\r\n this._scrollChildrenWithBuckets(this._oldLeft, this._oldTop, left, top);\r\n this._scrollChildrenWithBuckets(left, top, left, top);\r\n } else {\r\n this._scrollChildren(this._children, left, top);\r\n }\r\n } else {\r\n this._scrollChildren(this._children, left, top);\r\n }\r\n\r\n this._oldLeft = left;\r\n this._oldTop = top;\r\n\r\n for (const child of this._children) {\r\n if (!child._intersectsRect(this._parentMeasure)) {\r\n continue;\r\n }\r\n child._render(context, this._parentMeasure);\r\n }\r\n }\r\n\r\n protected override _postMeasure(): void {\r\n if (this._freezeControls) {\r\n super._postMeasure();\r\n return;\r\n }\r\n\r\n let maxWidth = this.parentClientWidth;\r\n let maxHeight = this.parentClientHeight;\r\n for (const child of this.children) {\r\n if (!child.isVisible || child.notRenderable) {\r\n continue;\r\n }\r\n\r\n if (child.horizontalAlignment === Control.HORIZONTAL_ALIGNMENT_CENTER) {\r\n child._offsetLeft(this._currentMeasure.left - child._currentMeasure.left);\r\n }\r\n\r\n if (child.verticalAlignment === Control.VERTICAL_ALIGNMENT_CENTER) {\r\n child._offsetTop(this._currentMeasure.top - child._currentMeasure.top);\r\n }\r\n\r\n maxWidth = Math.max(maxWidth, child._currentMeasure.left - this._currentMeasure.left + child._currentMeasure.width + child.paddingRightInPixels);\r\n maxHeight = Math.max(maxHeight, child._currentMeasure.top - this._currentMeasure.top + child._currentMeasure.height + child.paddingBottomInPixels);\r\n }\r\n\r\n if (this._currentMeasure.width !== maxWidth) {\r\n this._width.updateInPlace(maxWidth, ValueAndUnit.UNITMODE_PIXEL);\r\n this._currentMeasure.width = maxWidth;\r\n this._rebuildLayout = true;\r\n this._isDirty = true;\r\n }\r\n\r\n if (this._currentMeasure.height !== maxHeight) {\r\n this._height.updateInPlace(maxHeight, ValueAndUnit.UNITMODE_PIXEL);\r\n this._currentMeasure.height = maxHeight;\r\n this._rebuildLayout = true;\r\n this._isDirty = true;\r\n }\r\n\r\n super._postMeasure();\r\n }\r\n}\r\n"]}
|