@babylonjs/shared-ui-components 5.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/colorPicker/colorComponentEntry.d.ts +18 -0
- package/colorPicker/colorComponentEntry.js +37 -0
- package/colorPicker/colorComponentEntry.js.map +1 -0
- package/colorPicker/colorPicker.d.ts +43 -0
- package/colorPicker/colorPicker.js +137 -0
- package/colorPicker/colorPicker.js.map +1 -0
- package/colorPicker/hexColor.d.ts +20 -0
- package/colorPicker/hexColor.js +43 -0
- package/colorPicker/hexColor.js.map +1 -0
- package/components/Button.d.ts +10 -0
- package/components/Button.js +7 -0
- package/components/Button.js.map +1 -0
- package/components/Icon.d.ts +6 -0
- package/components/Icon.js +7 -0
- package/components/Icon.js.map +1 -0
- package/components/Label.d.ts +7 -0
- package/components/Label.js +7 -0
- package/components/Label.js.map +1 -0
- package/components/MessageDialog.d.ts +7 -0
- package/components/MessageDialog.js +23 -0
- package/components/MessageDialog.js.map +1 -0
- package/components/Toggle.d.ts +8 -0
- package/components/Toggle.js +16 -0
- package/components/Toggle.js.map +1 -0
- package/components/bars/CommandBarComponent.d.ts +16 -0
- package/components/bars/CommandBarComponent.js +69 -0
- package/components/bars/CommandBarComponent.js.map +1 -0
- package/components/bars/CommandButtonComponent.d.ts +11 -0
- package/components/bars/CommandButtonComponent.js +7 -0
- package/components/bars/CommandButtonComponent.js.map +1 -0
- package/components/bars/CommandDropdownComponent.d.ts +26 -0
- package/components/bars/CommandDropdownComponent.js +49 -0
- package/components/bars/CommandDropdownComponent.js.map +1 -0
- package/components/classNames.d.ts +2 -0
- package/components/classNames.js +19 -0
- package/components/classNames.js.map +1 -0
- package/components/colorPicker/ColorComponentEntry.d.ts +18 -0
- package/components/colorPicker/ColorComponentEntry.js +38 -0
- package/components/colorPicker/ColorComponentEntry.js.map +1 -0
- package/components/colorPicker/ColorPicker.d.ts +43 -0
- package/components/colorPicker/ColorPicker.js +138 -0
- package/components/colorPicker/ColorPicker.js.map +1 -0
- package/components/colorPicker/HexColor.d.ts +20 -0
- package/components/colorPicker/HexColor.js +46 -0
- package/components/colorPicker/HexColor.js.map +1 -0
- package/components/lines/ColorLineComponent.d.ts +40 -0
- package/components/lines/ColorLineComponent.js +146 -0
- package/components/lines/ColorLineComponent.js.map +1 -0
- package/components/lines/ColorPickerLineComponent.d.ts +33 -0
- package/components/lines/ColorPickerLineComponent.js +62 -0
- package/components/lines/ColorPickerLineComponent.js.map +1 -0
- package/components/lines/FileButtonLineComponent.d.ts +16 -0
- package/components/lines/FileButtonLineComponent.js +22 -0
- package/components/lines/FileButtonLineComponent.js.map +1 -0
- package/components/lines/NumericInputComponent.d.ts +31 -0
- package/components/lines/NumericInputComponent.js +87 -0
- package/components/lines/NumericInputComponent.js.map +1 -0
- package/license.md +71 -0
- package/lines/booleanLineComponent.d.ts +11 -0
- package/lines/booleanLineComponent.js +15 -0
- package/lines/booleanLineComponent.js.map +1 -0
- package/lines/buttonLineComponent.d.ts +12 -0
- package/lines/buttonLineComponent.js +11 -0
- package/lines/buttonLineComponent.js.map +1 -0
- package/lines/checkBoxLineComponent.d.ts +36 -0
- package/lines/checkBoxLineComponent.js +89 -0
- package/lines/checkBoxLineComponent.js.map +1 -0
- package/lines/color3LineComponent.d.ts +18 -0
- package/lines/color3LineComponent.js +10 -0
- package/lines/color3LineComponent.js.map +1 -0
- package/lines/color4LineComponent.d.ts +18 -0
- package/lines/color4LineComponent.js +10 -0
- package/lines/color4LineComponent.js.map +1 -0
- package/lines/colorLineComponent.d.ts +40 -0
- package/lines/colorLineComponent.js +145 -0
- package/lines/colorLineComponent.js.map +1 -0
- package/lines/colorPickerComponent.d.ts +31 -0
- package/lines/colorPickerComponent.js +61 -0
- package/lines/colorPickerComponent.js.map +1 -0
- package/lines/draggableLineComponent.d.ts +9 -0
- package/lines/draggableLineComponent.js +13 -0
- package/lines/draggableLineComponent.js.map +1 -0
- package/lines/fileButtonLineComponent.d.ts +17 -0
- package/lines/fileButtonLineComponent.js +21 -0
- package/lines/fileButtonLineComponent.js.map +1 -0
- package/lines/fileMultipleButtonLineComponent.d.ts +17 -0
- package/lines/fileMultipleButtonLineComponent.js +21 -0
- package/lines/fileMultipleButtonLineComponent.js.map +1 -0
- package/lines/floatLineComponent.d.ts +50 -0
- package/lines/floatLineComponent.js +176 -0
- package/lines/floatLineComponent.js.map +1 -0
- package/lines/hexLineComponent.d.ts +40 -0
- package/lines/hexLineComponent.js +122 -0
- package/lines/hexLineComponent.js.map +1 -0
- package/lines/iSelectedLineContainer.d.ts +4 -0
- package/lines/iSelectedLineContainer.js +2 -0
- package/lines/iSelectedLineContainer.js.map +1 -0
- package/lines/iconButtonLineComponent.d.ts +11 -0
- package/lines/iconButtonLineComponent.js +11 -0
- package/lines/iconButtonLineComponent.js.map +1 -0
- package/lines/iconComponent.d.ts +9 -0
- package/lines/iconComponent.js +8 -0
- package/lines/iconComponent.js.map +1 -0
- package/lines/indentedTextLineComponent.d.ts +16 -0
- package/lines/indentedTextLineComponent.js +27 -0
- package/lines/indentedTextLineComponent.js.map +1 -0
- package/lines/inputArrowsComponent.d.ts +13 -0
- package/lines/inputArrowsComponent.js +38 -0
- package/lines/inputArrowsComponent.js.map +1 -0
- package/lines/lineContainerComponent.d.ts +19 -0
- package/lines/lineContainerComponent.js +50 -0
- package/lines/lineContainerComponent.js.map +1 -0
- package/lines/linkButtonComponent.d.ts +16 -0
- package/lines/linkButtonComponent.js +21 -0
- package/lines/linkButtonComponent.js.map +1 -0
- package/lines/matrixLineComponent.d.ts +36 -0
- package/lines/matrixLineComponent.js +103 -0
- package/lines/matrixLineComponent.js.map +1 -0
- package/lines/messageLineComponent.d.ts +12 -0
- package/lines/messageLineComponent.js +15 -0
- package/lines/messageLineComponent.js.map +1 -0
- package/lines/numericInputComponent.d.ts +31 -0
- package/lines/numericInputComponent.js +86 -0
- package/lines/numericInputComponent.js.map +1 -0
- package/lines/optionsLineComponent.d.ts +48 -0
- package/lines/optionsLineComponent.js +119 -0
- package/lines/optionsLineComponent.js.map +1 -0
- package/lines/popup.d.ts +4 -0
- package/lines/popup.js +68 -0
- package/lines/popup.js.map +1 -0
- package/lines/radioLineComponent.d.ts +21 -0
- package/lines/radioLineComponent.js +27 -0
- package/lines/radioLineComponent.js.map +1 -0
- package/lines/sliderLineComponent.d.ts +37 -0
- package/lines/sliderLineComponent.js +90 -0
- package/lines/sliderLineComponent.js.map +1 -0
- package/lines/targetsProxy.d.ts +11 -0
- package/lines/targetsProxy.js +43 -0
- package/lines/targetsProxy.js.map +1 -0
- package/lines/textInputLineComponent.d.ts +47 -0
- package/lines/textInputLineComponent.js +155 -0
- package/lines/textInputLineComponent.js.map +1 -0
- package/lines/textLineComponent.d.ts +21 -0
- package/lines/textLineComponent.js +31 -0
- package/lines/textLineComponent.js.map +1 -0
- package/lines/unitButton.d.ts +8 -0
- package/lines/unitButton.js +8 -0
- package/lines/unitButton.js.map +1 -0
- package/lines/valueLineComponent.d.ts +15 -0
- package/lines/valueLineComponent.js +13 -0
- package/lines/valueLineComponent.js.map +1 -0
- package/lines/vector2LineComponent.d.ts +36 -0
- package/lines/vector2LineComponent.js +64 -0
- package/lines/vector2LineComponent.js.map +1 -0
- package/lines/vector3LineComponent.d.ts +41 -0
- package/lines/vector3LineComponent.js +75 -0
- package/lines/vector3LineComponent.js.map +1 -0
- package/lines/vector4LineComponent.d.ts +42 -0
- package/lines/vector4LineComponent.js +82 -0
- package/lines/vector4LineComponent.js.map +1 -0
- package/nodeGraphSystem/displayLedger.d.ts +5 -0
- package/nodeGraphSystem/displayLedger.js +4 -0
- package/nodeGraphSystem/displayLedger.js.map +1 -0
- package/nodeGraphSystem/frameNodePort.d.ts +25 -0
- package/nodeGraphSystem/frameNodePort.js +60 -0
- package/nodeGraphSystem/frameNodePort.js.map +1 -0
- package/nodeGraphSystem/graphCanvas.d.ts +111 -0
- package/nodeGraphSystem/graphCanvas.js +1132 -0
- package/nodeGraphSystem/graphCanvas.js.map +1 -0
- package/nodeGraphSystem/graphFrame.d.ts +153 -0
- package/nodeGraphSystem/graphFrame.js +1329 -0
- package/nodeGraphSystem/graphFrame.js.map +1 -0
- package/nodeGraphSystem/graphNode.d.ts +79 -0
- package/nodeGraphSystem/graphNode.js +460 -0
- package/nodeGraphSystem/graphNode.js.map +1 -0
- package/nodeGraphSystem/interfaces/displayManager.d.ts +13 -0
- package/nodeGraphSystem/interfaces/displayManager.js +2 -0
- package/nodeGraphSystem/interfaces/displayManager.js.map +1 -0
- package/nodeGraphSystem/interfaces/nodeContainer.d.ts +6 -0
- package/nodeGraphSystem/interfaces/nodeContainer.js +2 -0
- package/nodeGraphSystem/interfaces/nodeContainer.js.map +1 -0
- package/nodeGraphSystem/interfaces/nodeData.d.ts +15 -0
- package/nodeGraphSystem/interfaces/nodeData.js +2 -0
- package/nodeGraphSystem/interfaces/nodeData.js.map +1 -0
- package/nodeGraphSystem/interfaces/nodeLocationInfo.d.ts +26 -0
- package/nodeGraphSystem/interfaces/nodeLocationInfo.js +2 -0
- package/nodeGraphSystem/interfaces/nodeLocationInfo.js.map +1 -0
- package/nodeGraphSystem/interfaces/portData.d.ts +28 -0
- package/nodeGraphSystem/interfaces/portData.js +8 -0
- package/nodeGraphSystem/interfaces/portData.js.map +1 -0
- package/nodeGraphSystem/interfaces/propertyComponentProps.d.ts +6 -0
- package/nodeGraphSystem/interfaces/propertyComponentProps.js +2 -0
- package/nodeGraphSystem/interfaces/propertyComponentProps.js.map +1 -0
- package/nodeGraphSystem/interfaces/selectionChangedOptions.d.ts +11 -0
- package/nodeGraphSystem/interfaces/selectionChangedOptions.js +2 -0
- package/nodeGraphSystem/interfaces/selectionChangedOptions.js.map +1 -0
- package/nodeGraphSystem/nodeLink.d.ts +31 -0
- package/nodeGraphSystem/nodeLink.js +183 -0
- package/nodeGraphSystem/nodeLink.js.map +1 -0
- package/nodeGraphSystem/nodePort.d.ts +35 -0
- package/nodeGraphSystem/nodePort.js +129 -0
- package/nodeGraphSystem/nodePort.js.map +1 -0
- package/nodeGraphSystem/propertyLedger.d.ts +8 -0
- package/nodeGraphSystem/propertyLedger.js +4 -0
- package/nodeGraphSystem/propertyLedger.js.map +1 -0
- package/nodeGraphSystem/stateManager.d.ts +45 -0
- package/nodeGraphSystem/stateManager.js +19 -0
- package/nodeGraphSystem/stateManager.js.map +1 -0
- package/nodeGraphSystem/tools.d.ts +5 -0
- package/nodeGraphSystem/tools.js +37 -0
- package/nodeGraphSystem/tools.js.map +1 -0
- package/nodeGraphSystem/typeLedger.d.ts +8 -0
- package/nodeGraphSystem/typeLedger.js +3 -0
- package/nodeGraphSystem/typeLedger.js.map +1 -0
- package/nodeGraphSystem/types/framePortData.d.ts +7 -0
- package/nodeGraphSystem/types/framePortData.js +2 -0
- package/nodeGraphSystem/types/framePortData.js.map +1 -0
- package/package.json +55 -0
- package/propertyChangedEvent.d.ts +7 -0
- package/propertyChangedEvent.js +3 -0
- package/propertyChangedEvent.js.map +1 -0
- package/readme.md +6 -0
- package/stories/Button.stories.d.ts +10 -0
- package/stories/Button.stories.js +20 -0
- package/stories/Button.stories.js.map +1 -0
- package/stories/Icon.stories.d.ts +9 -0
- package/stories/Icon.stories.js +17 -0
- package/stories/Icon.stories.js.map +1 -0
- package/stories/Label.stories.d.ts +8 -0
- package/stories/Label.stories.js +11 -0
- package/stories/Label.stories.js.map +1 -0
- package/stories/MessageDialog.stories.d.ts +9 -0
- package/stories/MessageDialog.stories.js +20 -0
- package/stories/MessageDialog.stories.js.map +1 -0
- package/stories/Toggle.stories.d.ts +9 -0
- package/stories/Toggle.stories.js +18 -0
- package/stories/Toggle.stories.js.map +1 -0
- package/stories/bars/CommandBarComponent.stories.d.ts +11 -0
- package/stories/bars/CommandBarComponent.stories.js +13 -0
- package/stories/bars/CommandBarComponent.stories.js.map +1 -0
- package/stories/bars/CommandButtonComponent.stories.d.ts +6 -0
- package/stories/bars/CommandButtonComponent.stories.js +7 -0
- package/stories/bars/CommandButtonComponent.stories.js.map +1 -0
- package/stories/colorPicker/ColorPicker.stories.d.ts +11 -0
- package/stories/colorPicker/ColorPicker.stories.js +5 -0
- package/stories/colorPicker/ColorPicker.stories.js.map +1 -0
- package/stories/lines/ColorLineComponent.stories.d.ts +21 -0
- package/stories/lines/ColorLineComponent.stories.js +10 -0
- package/stories/lines/ColorLineComponent.stories.js.map +1 -0
- package/stories/lines/ColorPickerLineComponent.stories.d.ts +14 -0
- package/stories/lines/ColorPickerLineComponent.stories.js +11 -0
- package/stories/lines/ColorPickerLineComponent.stories.js.map +1 -0
- package/stories/lines/FileButtonLineComponent.stories.d.ts +6 -0
- package/stories/lines/FileButtonLineComponent.stories.js +6 -0
- package/stories/lines/FileButtonLineComponent.stories.js.map +1 -0
- package/stories/lines/NumericInputComponent.stories.d.ts +11 -0
- package/stories/lines/NumericInputComponent.stories.js +6 -0
- package/stories/lines/NumericInputComponent.stories.js.map +1 -0
- package/stringTools.d.ts +11 -0
- package/stringTools.js +89 -0
- package/stringTools.js.map +1 -0
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.js +16 -0
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.js +15 -0
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.d.ts +17 -0
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.js +56 -0
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.js +13 -0
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.js +16 -0
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.d.ts +17 -0
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.js +39 -0
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.js +17 -0
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.js +26 -0
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.js +18 -0
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/linePropertyGridComponent.d.ts +16 -0
- package/tabs/propertyGrids/gui/linePropertyGridComponent.js +28 -0
- package/tabs/propertyGrids/gui/linePropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.js +18 -0
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.js +16 -0
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.js +16 -0
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.js +17 -0
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.js +15 -0
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.js +35 -0
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/lockObject.d.ts +9 -0
- package/tabs/propertyGrids/lockObject.js +12 -0
- package/tabs/propertyGrids/lockObject.js.map +1 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CommandBarComponent.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/components/bars/CommandBarComponent.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,aAAa,MAAM,8BAA8B,CAAC;AACzD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,QAAQ,MAAM,4BAA4B,CAAC;AAClD,OAAO,aAAa,MAAM,8BAA8B,CAAC;AACzD,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAE/C,OAAO,KAAK,MAAM,2BAA2B,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AA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AC,wBAAwB,IAAI,SAAS,EAC5D,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC5F,cAAc,EAAE,CAAC,QAAgB,EAAE,EAAE;oCACjC,IAAI,KAAK,CAAC,sBAAsB,EAAE;wCAC9B,KAAK,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;qCAC1C;gCACL,CAAC,GACH,CACL,IACC,IACJ,EACN,cAAK,SAAS,EAAE,KAAK,CAAC,aAAa,YAC/B,cAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,GAAI,GACjE,IACJ,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FC } from \"react\";\r\nimport { JoinClassNames } from \"../classNames\";\r\nimport { CommandButtonComponent } from \"./CommandButtonComponent\";\r\nimport { CommandDropdownComponent } from \"./CommandDropdownComponent\";\r\n\r\nimport hamburgerIcon from \"../../imgs/hamburgerIcon.svg\";\r\nimport pointerIcon from \"../../imgs/pointerIcon.svg\";\r\nimport handIcon from \"../../imgs/handIcon.svg\";\r\nimport zoomIcon from \"../../imgs/zoomIcon.svg\";\r\nimport logoIcon from \"../../imgs/babylonLogo.svg\";\r\nimport canvasFitIcon from \"../../imgs/canvasFitIcon.svg\";\r\nimport betaFlag from \"../../imgs/betaFlag.svg\";\r\n\r\nimport style from \"./CommandBar.modules.scss\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { ColorPickerLineComponent } from \"../lines/ColorPickerLineComponent\";\r\n\r\nexport interface ICommandBarComponentProps {\r\n onSaveButtonClicked?: () => void;\r\n onSaveToSnippetButtonClicked?: () => void;\r\n onLoadFromSnippetButtonClicked?: () => void;\r\n onHelpButtonClicked?: () => void;\r\n onGiveFeedbackButtonClicked?: () => void;\r\n onSelectButtonClicked?: () => void;\r\n onPanButtonClicked?: () => void;\r\n onZoomButtonClicked?: () => void;\r\n onFitButtonClicked?: () => void;\r\n onArtboardColorChanged?: (newColor: string) => void;\r\n artboardColor?: string;\r\n artboardColorPickerColor?: string;\r\n}\r\n\r\nexport const CommandBarComponent: FC<ICommandBarComponentProps> = (props) => {\r\n return (\r\n <div className={style.commandBar}>\r\n <div className={style.commandsLeft}>\r\n <div className={style.divider}>\r\n <img src={logoIcon} color=\"white\" className={\"active\"} draggable={false} />\r\n <CommandDropdownComponent\r\n //globalState={this.props.globalState}\r\n toRight={true}\r\n icon={hamburgerIcon}\r\n tooltip=\"Options\"\r\n items={[\r\n {\r\n label: \"Save\",\r\n onClick: () => {\r\n props.onSaveButtonClicked && props.onSaveButtonClicked();\r\n },\r\n },\r\n {\r\n label: \"Load\",\r\n fileButton: true,\r\n },\r\n {\r\n label: \"Save to snippet\",\r\n onClick: () => {\r\n props.onSaveToSnippetButtonClicked && props.onSaveToSnippetButtonClicked();\r\n },\r\n },\r\n {\r\n label: \"Load from snippet\",\r\n onClick: () => {\r\n props.onLoadFromSnippetButtonClicked && props.onLoadFromSnippetButtonClicked();\r\n },\r\n },\r\n {\r\n label: \"Help\",\r\n onClick: () => {\r\n props.onHelpButtonClicked && props.onHelpButtonClicked();\r\n },\r\n },\r\n {\r\n label: \"Give feedback\",\r\n onClick: () => {\r\n props.onGiveFeedbackButtonClicked && props.onGiveFeedbackButtonClicked();\r\n },\r\n },\r\n ]}\r\n />\r\n <CommandButtonComponent\r\n tooltip=\"Select\"\r\n icon={pointerIcon}\r\n shortcut=\"S\"\r\n isActive={false}\r\n onClick={() => {\r\n props.onSelectButtonClicked && props.onSelectButtonClicked();\r\n }}\r\n />\r\n <CommandButtonComponent\r\n tooltip=\"Pan\"\r\n icon={handIcon}\r\n shortcut=\"P\"\r\n isActive={false}\r\n onClick={() => {\r\n props.onPanButtonClicked && props.onPanButtonClicked();\r\n }}\r\n />\r\n <CommandButtonComponent\r\n tooltip=\"Zoom\"\r\n shortcut=\"Z\"\r\n icon={zoomIcon}\r\n isActive={false}\r\n onClick={() => {\r\n props.onZoomButtonClicked && props.onZoomButtonClicked();\r\n }}\r\n />\r\n </div>\r\n <div className={style.divider}>\r\n <CommandButtonComponent\r\n tooltip=\"Fit to Window\"\r\n shortcut=\"F\"\r\n icon={canvasFitIcon}\r\n isActive={false}\r\n onClick={() => {\r\n props.onFitButtonClicked && props.onFitButtonClicked();\r\n }}\r\n />\r\n </div>\r\n <div className={JoinClassNames(style, \"divider\", \"padded\")}>\r\n <div style={{ paddingRight: \"5px\" }}>Artboard:</div>\r\n {props.onArtboardColorChanged && (\r\n <ColorPickerLineComponent\r\n backgroundColor={props.artboardColorPickerColor || \"#888888\"}\r\n value={props.artboardColor ? Color3.FromHexString(props.artboardColor) : new Color3(0, 0, 0)}\r\n onColorChanged={(newColor: string) => {\r\n if (props.onArtboardColorChanged) {\r\n props.onArtboardColorChanged(newColor);\r\n }\r\n }}\r\n />\r\n )}\r\n </div>\r\n </div>\r\n <div className={style.commandsRight}>\r\n <img src={betaFlag} className={style.betaFlag} draggable={false} />\r\n </div>\r\n </div>\r\n );\r\n};\r\n"]}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
export interface ICommandButtonComponentProps {
|
3
|
+
tooltip: string;
|
4
|
+
shortcut?: string;
|
5
|
+
icon: string;
|
6
|
+
iconLabel?: string;
|
7
|
+
isActive: boolean;
|
8
|
+
onClick: () => void;
|
9
|
+
disabled?: boolean;
|
10
|
+
}
|
11
|
+
export declare const CommandButtonComponent: React.FC<ICommandButtonComponentProps>;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { ClassNames } from "../classNames.js";
|
3
|
+
import style from "./CommandButton.modules.scss";
|
4
|
+
export const CommandButtonComponent = (props) => {
|
5
|
+
return (_jsx("div", { className: ClassNames({ commandButton: true, active: props.isActive, disabled: props.disabled }, style), onClick: props.onClick, title: `${props.tooltip} ${props.shortcut ? " (" + props.shortcut + ")" : ""}`, children: _jsx("div", { className: ClassNames({ commandButtonIcon: true }, style), children: _jsx("img", { src: props.icon, title: props.iconLabel, alt: props.iconLabel, draggable: false }) }) }));
|
6
|
+
};
|
7
|
+
//# sourceMappingURL=CommandButtonComponent.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CommandButtonComponent.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/components/bars/CommandButtonComponent.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,KAAK,MAAM,8BAA8B,CAAC;AAYjD,MAAM,CAAC,MAAM,sBAAsB,GAA2C,CAAC,KAAK,EAAE,EAAE;IACpF,OAAO,CACH,cACI,SAAS,EAAE,UAAU,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,EACvG,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,KAAK,EAAE,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,YAE9E,cAAK,SAAS,EAAE,UAAU,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,YAC1D,cAAK,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,GAAI,GACtF,GACJ,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from \"react\";\r\nimport { ClassNames } from \"../classNames\";\r\n\r\nimport style from \"./CommandButton.modules.scss\";\r\n\r\nexport interface ICommandButtonComponentProps {\r\n tooltip: string;\r\n shortcut?: string;\r\n icon: string;\r\n iconLabel?: string;\r\n isActive: boolean;\r\n onClick: () => void;\r\n disabled?: boolean;\r\n}\r\n\r\nexport const CommandButtonComponent: React.FC<ICommandButtonComponentProps> = (props) => {\r\n return (\r\n <div\r\n className={ClassNames({ commandButton: true, active: props.isActive, disabled: props.disabled }, style)}\r\n onClick={props.onClick}\r\n title={`${props.tooltip} ${props.shortcut ? \" (\" + props.shortcut + \")\" : \"\"}`}\r\n >\r\n <div className={ClassNames({ commandButtonIcon: true }, style)}>\r\n <img src={props.icon} title={props.iconLabel} alt={props.iconLabel} draggable={false} />\r\n </div>\r\n </div>\r\n );\r\n};\r\n"]}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
interface ICommandDropdownComponentProps {
|
3
|
+
icon?: string;
|
4
|
+
tooltip: string;
|
5
|
+
defaultValue?: string;
|
6
|
+
items: {
|
7
|
+
label: string;
|
8
|
+
icon?: string;
|
9
|
+
fileButton?: boolean;
|
10
|
+
onClick?: () => void;
|
11
|
+
onCheck?: (value: boolean) => void;
|
12
|
+
storeKey?: string;
|
13
|
+
isActive?: boolean;
|
14
|
+
defaultValue?: boolean | string;
|
15
|
+
subItems?: string[];
|
16
|
+
}[];
|
17
|
+
toRight?: boolean;
|
18
|
+
}
|
19
|
+
export declare class CommandDropdownComponent extends React.Component<ICommandDropdownComponentProps, {
|
20
|
+
isExpanded: boolean;
|
21
|
+
activeState: string;
|
22
|
+
}> {
|
23
|
+
constructor(props: ICommandDropdownComponentProps);
|
24
|
+
render(): JSX.Element;
|
25
|
+
}
|
26
|
+
export {};
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
+
import * as React from "react";
|
3
|
+
import { FileButtonLineComponent } from "../lines/FileButtonLineComponent.js";
|
4
|
+
import { JoinClassNames } from "../classNames.js";
|
5
|
+
import style from "./CommandDropdown.modules.scss";
|
6
|
+
export class CommandDropdownComponent extends React.Component {
|
7
|
+
constructor(props) {
|
8
|
+
super(props);
|
9
|
+
this.state = { isExpanded: false, activeState: "" };
|
10
|
+
}
|
11
|
+
render() {
|
12
|
+
return (_jsxs(_Fragment, { children: [this.state.isExpanded && (_jsx("div", { className: style.commandDropdownBlocker, onClick: () => {
|
13
|
+
this.setState({ isExpanded: false });
|
14
|
+
} })), _jsxs("div", { className: style.commandDropdownRoot, children: [_jsxs("div", { className: JoinClassNames(style, "commandDropdown", this.state.isExpanded ? "activated" : ""), title: this.props.tooltip, onClick: () => {
|
15
|
+
this.setState({ isExpanded: false });
|
16
|
+
const newState = !this.state.isExpanded;
|
17
|
+
const pgHost = document.getElementById("embed-host");
|
18
|
+
if (pgHost) {
|
19
|
+
pgHost.style.zIndex = newState ? "0" : "10";
|
20
|
+
}
|
21
|
+
this.setState({ isExpanded: newState });
|
22
|
+
}, children: [this.props.icon && (_jsx("div", { className: style.commandDropdownIcon, children: _jsx("img", { src: this.props.icon }) })), !this.props.icon && _jsx("div", { className: style.commandDropdownActive })] }), this.state.isExpanded && (_jsx("div", { className: JoinClassNames(style, "commandDropdownContent", this.props.toRight ? "toRight" : ""), children: this.props.items.map((m) => {
|
23
|
+
if (!m.fileButton) {
|
24
|
+
return (_jsxs("div", { className: JoinClassNames(style, "commandDropdownLabel", m.isActive ? "active" : ""), onClick: () => {
|
25
|
+
if (!m.onClick) {
|
26
|
+
this.forceUpdate();
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
if (!m.subItems) {
|
30
|
+
m.onClick();
|
31
|
+
this.setState({ isExpanded: false, activeState: m.label });
|
32
|
+
}
|
33
|
+
}, title: m.label, children: [!m.icon && _jsx("div", { className: style.commandDropdownLabelText, children: (m.isActive ? "> " : "") + m.label }), m.icon && (_jsx("div", { className: style.commandDropdownIcon, children: _jsx("img", { src: m.icon }) })), m.onCheck && (_jsx("input", { type: "checkBox", className: style.commandDropdownLabelCheck, onChange: (evt) => {
|
34
|
+
this.forceUpdate();
|
35
|
+
m.onCheck(evt.target.checked);
|
36
|
+
}, checked: false })), m.subItems && _jsx("div", { className: style.commandDropdownArrow, children: ">" }), m.subItems && (_jsx("div", { className: style.subItems, children: m.subItems.map((s) => {
|
37
|
+
return (_jsx("div", { className: style.subItem, onClick: () => {
|
38
|
+
m.onClick();
|
39
|
+
this.setState({ isExpanded: false });
|
40
|
+
}, children: _jsx("div", { children: s }) }, s));
|
41
|
+
}) }))] }, m.label));
|
42
|
+
}
|
43
|
+
else {
|
44
|
+
return _jsx(FileButtonLineComponent, { label: "Load", onClick: (file) => console.log("file btn clicked"), accept: ".json" }, m.label);
|
45
|
+
}
|
46
|
+
}) }))] })] }));
|
47
|
+
}
|
48
|
+
}
|
49
|
+
//# sourceMappingURL=CommandDropdownComponent.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CommandDropdownComponent.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/components/bars/CommandDropdownComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,MAAM,gCAAgC,CAAC;AAoBnD,MAAM,OAAO,wBAAyB,SAAQ,KAAK,CAAC,SAAuF;IACvI,YAAmB,KAAqC;QACpD,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,KAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;IACxD,CAAC;IAEM,MAAM;QACT,OAAO,CACH,8BACK,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,CACtB,cACI,SAAS,EAAE,KAAK,CAAC,sBAAsB,EACvC,OAAO,EAAE,GAA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AC,CAAC;gDACnC,CAAC,EACD,OAAO,EAAE,KAAK,GAChB,CACL,EACA,CAAC,CAAC,QAAQ,IAAI,cAAK,SAAS,EAAE,KAAK,CAAC,oBAAoB,YAAG,GAAG,GAAO,EACrE,CAAC,CAAC,QAAQ,IAAI,CACX,cAAK,SAAS,EAAE,KAAK,CAAC,QAAQ,YACzB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;oDAClB,OAAO,CACH,cAEI,SAAS,EAAE,KAAK,CAAC,OAAO,EACxB,OAAO,EAAE,GAAG,EAAE;4DACV,CAAC,CAAC,OAAQ,EAAE,CAAC;4DACb,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;wDACzC,CAAC,YAED,wBAAM,CAAC,GAAO,IAPT,CAAC,CAQJ,CACT,CAAC;gDACN,CAAC,CAAC,GACA,CACT,KAjDI,CAAC,CAAC,KAAK,CAkDV,CACT,CAAC;iCACL;qCAAM;oCACH,OAAO,KAAC,uBAAuB,IAAe,KAAK,EAAC,MAAM,EAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAC,OAAO,IAAxF,CAAC,CAAC,KAAK,CAAoF,CAAC;iCACpI;4BACL,CAAC,CAAC,GACA,CACT,IACC,IACP,CACN,CAAC;IACN,CAAC;CACJ","sourcesContent":["import * as React from \"react\";\r\nimport { FileButtonLineComponent } from \"../lines/FileButtonLineComponent\";\r\nimport { JoinClassNames } from \"../classNames\";\r\n\r\nimport style from \"./CommandDropdown.modules.scss\";\r\n\r\ninterface ICommandDropdownComponentProps {\r\n icon?: string;\r\n tooltip: string;\r\n defaultValue?: string;\r\n items: {\r\n label: string;\r\n icon?: string;\r\n fileButton?: boolean;\r\n onClick?: () => void;\r\n onCheck?: (value: boolean) => void;\r\n storeKey?: string;\r\n isActive?: boolean;\r\n defaultValue?: boolean | string;\r\n subItems?: string[];\r\n }[];\r\n toRight?: boolean;\r\n}\r\n\r\nexport class CommandDropdownComponent extends React.Component<ICommandDropdownComponentProps, { isExpanded: boolean; activeState: string }> {\r\n public constructor(props: ICommandDropdownComponentProps) {\r\n super(props);\r\n\r\n this.state = { isExpanded: false, activeState: \"\" };\r\n }\r\n\r\n public render() {\r\n return (\r\n <>\r\n {this.state.isExpanded && (\r\n <div\r\n className={style.commandDropdownBlocker}\r\n onClick={() => {\r\n this.setState({ isExpanded: false });\r\n }}\r\n ></div>\r\n )}\r\n <div className={style.commandDropdownRoot}>\r\n <div\r\n className={JoinClassNames(style, \"commandDropdown\", this.state.isExpanded ? \"activated\" : \"\")}\r\n title={this.props.tooltip}\r\n onClick={() => {\r\n this.setState({ isExpanded: false });\r\n const newState = !this.state.isExpanded;\r\n const pgHost = document.getElementById(\"embed-host\");\r\n\r\n if (pgHost) {\r\n pgHost.style.zIndex = newState ? \"0\" : \"10\";\r\n }\r\n\r\n this.setState({ isExpanded: newState });\r\n }}\r\n >\r\n {this.props.icon && (\r\n <div className={style.commandDropdownIcon}>\r\n <img src={this.props.icon} />\r\n </div>\r\n )}\r\n {!this.props.icon && <div className={style.commandDropdownActive}></div>}\r\n </div>\r\n {this.state.isExpanded && (\r\n <div className={JoinClassNames(style, \"commandDropdownContent\", this.props.toRight ? \"toRight\" : \"\")}>\r\n {this.props.items.map((m) => {\r\n if (!m.fileButton) {\r\n return (\r\n <div\r\n className={JoinClassNames(style, \"commandDropdownLabel\", m.isActive ? \"active\" : \"\")}\r\n key={m.label}\r\n onClick={() => {\r\n if (!m.onClick) {\r\n this.forceUpdate();\r\n return;\r\n }\r\n if (!m.subItems) {\r\n m.onClick();\r\n\r\n this.setState({ isExpanded: false, activeState: m.label });\r\n }\r\n }}\r\n title={m.label}\r\n >\r\n {!m.icon && <div className={style.commandDropdownLabelText}>{(m.isActive ? \"> \" : \"\") + m.label}</div>}\r\n {m.icon && (\r\n <div className={style.commandDropdownIcon}>\r\n <img src={m.icon} />\r\n </div>\r\n )}\r\n {m.onCheck && (\r\n <input\r\n type=\"checkBox\"\r\n className={style.commandDropdownLabelCheck}\r\n onChange={(evt) => {\r\n this.forceUpdate();\r\n m.onCheck!(evt.target.checked);\r\n }}\r\n checked={false}\r\n />\r\n )}\r\n {m.subItems && <div className={style.commandDropdownArrow}>{\">\"}</div>}\r\n {m.subItems && (\r\n <div className={style.subItems}>\r\n {m.subItems.map((s) => {\r\n return (\r\n <div\r\n key={s}\r\n className={style.subItem}\r\n onClick={() => {\r\n m.onClick!();\r\n this.setState({ isExpanded: false });\r\n }}\r\n >\r\n <div>{s}</div>\r\n </div>\r\n );\r\n })}\r\n </div>\r\n )}\r\n </div>\r\n );\r\n } else {\r\n return <FileButtonLineComponent key={m.label} label=\"Load\" onClick={(file) => console.log(\"file btn clicked\")} accept=\".json\" />;\r\n }\r\n })}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n );\r\n }\r\n}\r\n"]}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
export function ClassNames(names, styleObject) {
|
2
|
+
let string = "";
|
3
|
+
for (const name in names) {
|
4
|
+
if (names[name]) {
|
5
|
+
string += styleObject[name] + " ";
|
6
|
+
}
|
7
|
+
}
|
8
|
+
return string;
|
9
|
+
}
|
10
|
+
export function JoinClassNames(styleObject, ...names) {
|
11
|
+
let string = "";
|
12
|
+
for (const name of names) {
|
13
|
+
if (name && styleObject[name]) {
|
14
|
+
string += styleObject[name] + " ";
|
15
|
+
}
|
16
|
+
}
|
17
|
+
return string;
|
18
|
+
}
|
19
|
+
//# sourceMappingURL=classNames.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"classNames.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/classNames.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,KAAU,EAAE,WAAgB;IACnD,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE;YACb,MAAM,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;SACrC;KACJ;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,WAAgB,EAAE,GAAG,KAAe;IAC/D,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,IAAI,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;YAC3B,MAAM,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;SACrC;KACJ;IACD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["export function ClassNames(names: any, styleObject: any) {\r\n let string = \"\";\r\n for (const name in names) {\r\n if (names[name]) {\r\n string += styleObject[name] + \" \";\r\n }\r\n }\r\n return string;\r\n}\r\n\r\nexport function JoinClassNames(styleObject: any, ...names: string[]) {\r\n let string = \"\";\r\n for (const name of names) {\r\n if (name && styleObject[name]) {\r\n string += styleObject[name] + \" \";\r\n }\r\n }\r\n return string;\r\n}\r\n"]}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import type { LockObject } from "../../tabs/propertyGrids/lockObject";
|
3
|
+
export interface IColorComponentEntryProps {
|
4
|
+
value: number;
|
5
|
+
label: string;
|
6
|
+
max?: number;
|
7
|
+
min?: number;
|
8
|
+
onChange: (value: number) => void;
|
9
|
+
disabled?: boolean;
|
10
|
+
lockObject: LockObject;
|
11
|
+
}
|
12
|
+
export declare class ColorComponentEntry extends React.Component<IColorComponentEntryProps> {
|
13
|
+
constructor(props: IColorComponentEntryProps);
|
14
|
+
updateValue(valueString: string): void;
|
15
|
+
lock(): void;
|
16
|
+
unlock(): void;
|
17
|
+
render(): JSX.Element;
|
18
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import * as React from "react";
|
3
|
+
import style from "./ColorComponentEntry.modules.scss";
|
4
|
+
export class ColorComponentEntry extends React.Component {
|
5
|
+
constructor(props) {
|
6
|
+
super(props);
|
7
|
+
}
|
8
|
+
updateValue(valueString) {
|
9
|
+
if (/[^0-9.-]/g.test(valueString)) {
|
10
|
+
return;
|
11
|
+
}
|
12
|
+
let valueAsNumber = parseInt(valueString);
|
13
|
+
if (isNaN(valueAsNumber)) {
|
14
|
+
return;
|
15
|
+
}
|
16
|
+
if (this.props.max != undefined && valueAsNumber > this.props.max) {
|
17
|
+
valueAsNumber = this.props.max;
|
18
|
+
}
|
19
|
+
if (this.props.min != undefined && valueAsNumber < this.props.min) {
|
20
|
+
valueAsNumber = this.props.min;
|
21
|
+
}
|
22
|
+
this.props.onChange(valueAsNumber);
|
23
|
+
}
|
24
|
+
lock() {
|
25
|
+
if (this.props.lockObject) {
|
26
|
+
this.props.lockObject.lock = true;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
unlock() {
|
30
|
+
if (this.props.lockObject) {
|
31
|
+
this.props.lockObject.lock = false;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
render() {
|
35
|
+
return (_jsxs("div", { className: style.colorPickerComponent, children: [_jsx("div", { className: style.colorPickerComponentValue, children: _jsx("input", { type: "number", step: 1, className: "numeric-input", value: this.props.value, onBlur: () => this.unlock(), onFocus: () => this.lock(), onChange: (evt) => this.updateValue(evt.target.value), disabled: this.props.disabled }) }), _jsx("div", { className: style.colorPickerComponentLabel, children: this.props.label })] }));
|
36
|
+
}
|
37
|
+
}
|
38
|
+
//# sourceMappingURL=ColorComponentEntry.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ColorComponentEntry.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/components/colorPicker/ColorComponentEntry.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B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AS,EAAC,eAAe,EACzB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EAC1B,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EACrD,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAC/B,GACA,EACN,cAAK,SAAS,EAAE,KAAK,CAAC,yBAAyB,YAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAO,IACvE,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import * as React from \"react\";\r\nimport type { LockObject } from \"../../tabs/propertyGrids/lockObject\";\r\nimport style from \"./ColorComponentEntry.modules.scss\";\r\n\r\nexport interface IColorComponentEntryProps {\r\n value: number;\r\n label: string;\r\n max?: number;\r\n min?: number;\r\n onChange: (value: number) => void;\r\n disabled?: boolean;\r\n lockObject: LockObject;\r\n}\r\n\r\nexport class ColorComponentEntry extends React.Component<IColorComponentEntryProps> {\r\n constructor(props: IColorComponentEntryProps) {\r\n super(props);\r\n }\r\n\r\n updateValue(valueString: string) {\r\n if (/[^0-9.-]/g.test(valueString)) {\r\n return;\r\n }\r\n\r\n let valueAsNumber = parseInt(valueString);\r\n\r\n if (isNaN(valueAsNumber)) {\r\n return;\r\n }\r\n if (this.props.max != undefined && valueAsNumber > this.props.max) {\r\n valueAsNumber = this.props.max;\r\n }\r\n if (this.props.min != undefined && valueAsNumber < this.props.min) {\r\n valueAsNumber = this.props.min;\r\n }\r\n\r\n this.props.onChange(valueAsNumber);\r\n }\r\n\r\n lock() {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = true;\r\n }\r\n }\r\n\r\n unlock() {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = false;\r\n }\r\n }\r\n\r\n public render() {\r\n return (\r\n <div className={style.colorPickerComponent}>\r\n <div className={style.colorPickerComponentValue}>\r\n <input\r\n type=\"number\"\r\n step={1}\r\n className=\"numeric-input\"\r\n value={this.props.value}\r\n onBlur={() => this.unlock()}\r\n onFocus={() => this.lock()}\r\n onChange={(evt) => this.updateValue(evt.target.value)}\r\n disabled={this.props.disabled}\r\n />\r\n </div>\r\n <div className={style.colorPickerComponentLabel}>{this.props.label}</div>\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
|
3
|
+
import type { LockObject } from "../../tabs/propertyGrids/lockObject";
|
4
|
+
/**
|
5
|
+
* Interface used to specify creation options for color picker
|
6
|
+
*/
|
7
|
+
export interface IColorPickerProps {
|
8
|
+
color: Color3 | Color4;
|
9
|
+
linearhint?: boolean;
|
10
|
+
debugMode?: boolean;
|
11
|
+
onColorChanged?: (color: Color3 | Color4) => void;
|
12
|
+
lockObject: LockObject;
|
13
|
+
backgroundColor?: string;
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* Interface used to specify creation options for color picker
|
17
|
+
*/
|
18
|
+
export interface IColorPickerState {
|
19
|
+
color: Color3;
|
20
|
+
alpha: number;
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* Class used to create a color picker
|
24
|
+
*/
|
25
|
+
export declare class ColorPicker extends React.Component<IColorPickerProps, IColorPickerState> {
|
26
|
+
private _saturationRef;
|
27
|
+
private _hueRef;
|
28
|
+
private _isSaturationPointerDown;
|
29
|
+
private _isHuePointerDown;
|
30
|
+
constructor(props: IColorPickerProps);
|
31
|
+
shouldComponentUpdate(nextProps: IColorPickerProps, nextState: IColorPickerState): boolean;
|
32
|
+
onSaturationPointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
|
33
|
+
onSaturationPointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
|
34
|
+
onSaturationPointerMove(evt: React.PointerEvent<HTMLDivElement>): void;
|
35
|
+
onHuePointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
|
36
|
+
onHuePointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
|
37
|
+
onHuePointerMove(evt: React.PointerEvent<HTMLDivElement>): void;
|
38
|
+
private _evaluateSaturation;
|
39
|
+
private _evaluateHue;
|
40
|
+
componentDidUpdate(): void;
|
41
|
+
raiseOnColorChanged(): void;
|
42
|
+
render(): JSX.Element;
|
43
|
+
}
|
@@ -0,0 +1,138 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import * as React from "react";
|
3
|
+
import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
|
4
|
+
import { ColorComponentEntry } from "./ColorComponentEntry.js";
|
5
|
+
import { HexColor } from "./HexColor.js";
|
6
|
+
import style from "./ColorPicker.modules.scss";
|
7
|
+
import { ClassNames } from "../classNames.js";
|
8
|
+
/**
|
9
|
+
* Class used to create a color picker
|
10
|
+
*/
|
11
|
+
export class ColorPicker extends React.Component {
|
12
|
+
constructor(props) {
|
13
|
+
super(props);
|
14
|
+
if (this.props.color instanceof Color4) {
|
15
|
+
this.state = { color: new Color3(this.props.color.r, this.props.color.g, this.props.color.b), alpha: this.props.color.a };
|
16
|
+
}
|
17
|
+
else {
|
18
|
+
this.state = { color: this.props.color.clone(), alpha: 1 };
|
19
|
+
}
|
20
|
+
this._saturationRef = React.createRef();
|
21
|
+
this._hueRef = React.createRef();
|
22
|
+
}
|
23
|
+
shouldComponentUpdate(nextProps, nextState) {
|
24
|
+
return nextProps.color.toHexString() !== this.props.color.toHexString() || nextState.color.toHexString() !== this.props.color.toHexString();
|
25
|
+
}
|
26
|
+
onSaturationPointerDown(evt) {
|
27
|
+
this._evaluateSaturation(evt);
|
28
|
+
this._isSaturationPointerDown = true;
|
29
|
+
evt.currentTarget.setPointerCapture(evt.pointerId);
|
30
|
+
}
|
31
|
+
onSaturationPointerUp(evt) {
|
32
|
+
this._isSaturationPointerDown = false;
|
33
|
+
evt.currentTarget.releasePointerCapture(evt.pointerId);
|
34
|
+
}
|
35
|
+
onSaturationPointerMove(evt) {
|
36
|
+
if (!this._isSaturationPointerDown) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
this._evaluateSaturation(evt);
|
40
|
+
}
|
41
|
+
onHuePointerDown(evt) {
|
42
|
+
this._evaluateHue(evt);
|
43
|
+
this._isHuePointerDown = true;
|
44
|
+
evt.currentTarget.setPointerCapture(evt.pointerId);
|
45
|
+
}
|
46
|
+
onHuePointerUp(evt) {
|
47
|
+
this._isHuePointerDown = false;
|
48
|
+
evt.currentTarget.releasePointerCapture(evt.pointerId);
|
49
|
+
}
|
50
|
+
onHuePointerMove(evt) {
|
51
|
+
if (!this._isHuePointerDown) {
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
this._evaluateHue(evt);
|
55
|
+
}
|
56
|
+
_evaluateSaturation(evt) {
|
57
|
+
const left = evt.nativeEvent.offsetX;
|
58
|
+
const top = evt.nativeEvent.offsetY;
|
59
|
+
const saturation = Math.min(1, Math.max(0.0001, left / this._saturationRef.current.clientWidth));
|
60
|
+
const value = Math.min(1, Math.max(0.0001, 1 - top / this._saturationRef.current.clientHeight));
|
61
|
+
if (this.props.debugMode) {
|
62
|
+
console.log("Saturation: " + saturation);
|
63
|
+
console.log("Value: " + value);
|
64
|
+
}
|
65
|
+
const hsv = this.state.color.toHSV();
|
66
|
+
Color3.HSVtoRGBToRef(hsv.r, saturation, value, this.state.color);
|
67
|
+
if (this.state.alpha === 0) {
|
68
|
+
this.setState({ alpha: 1 });
|
69
|
+
}
|
70
|
+
this.setState({ color: this.state.color });
|
71
|
+
}
|
72
|
+
_evaluateHue(evt) {
|
73
|
+
const left = evt.nativeEvent.offsetX;
|
74
|
+
const hue = 360 * Math.min(0.9999, Math.max(0.0001, left / this._hueRef.current.clientWidth));
|
75
|
+
if (this.props.debugMode) {
|
76
|
+
console.log("Hue: " + hue);
|
77
|
+
}
|
78
|
+
const hsv = this.state.color.toHSV();
|
79
|
+
Color3.HSVtoRGBToRef(hue, Math.max(hsv.g, 0.01), Math.max(hsv.b, 0.01), this.state.color);
|
80
|
+
this.setState({ color: this.state.color });
|
81
|
+
}
|
82
|
+
componentDidUpdate() {
|
83
|
+
this.raiseOnColorChanged();
|
84
|
+
}
|
85
|
+
raiseOnColorChanged() {
|
86
|
+
if (!this.props.onColorChanged) {
|
87
|
+
return;
|
88
|
+
}
|
89
|
+
if (this.props.color instanceof Color4) {
|
90
|
+
const newColor4 = Color4.FromColor3(this.state.color, this.state.alpha);
|
91
|
+
this.props.onColorChanged(newColor4);
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
this.props.onColorChanged(this.state.color.clone());
|
95
|
+
}
|
96
|
+
render() {
|
97
|
+
const color4 = Color4.FromColor3(this.state.color);
|
98
|
+
color4.a = this.state.alpha;
|
99
|
+
const colorHex = color4.toHexString();
|
100
|
+
const hsv = this.state.color.toHSV();
|
101
|
+
const colorRef = new Color3();
|
102
|
+
Color3.HSVtoRGBToRef(hsv.r, 1, 1, colorRef);
|
103
|
+
const colorHexRef = colorRef.toHexString();
|
104
|
+
const hasAlpha = this.props.color instanceof Color4;
|
105
|
+
return (_jsxs("div", { className: ClassNames({ colorPickerContainer: true, withHints: this.props.linearhint }, style), style: { backgroundColor: this.props.backgroundColor || "inherit" }, children: [_jsxs("div", { className: style.colorPickerSaturation, onPointerMove: (e) => this.onSaturationPointerMove(e), onPointerDown: (e) => this.onSaturationPointerDown(e), onPointerUp: (e) => this.onSaturationPointerUp(e), ref: this._saturationRef, style: {
|
106
|
+
background: colorHexRef,
|
107
|
+
}, children: [_jsx("div", { className: style.colorPickerSaturationWhite }), _jsx("div", { className: style.colorPickerSaturationBlack }), _jsx("div", { className: style.colorPickerSaturationCursor, style: {
|
108
|
+
top: `${-(hsv.b * 100) + 100}%`,
|
109
|
+
left: `${hsv.g * 100}%`,
|
110
|
+
} })] }), _jsxs("div", { className: style.colorPickerHue, children: [_jsx("div", { className: style.colorPickerHueColor, style: {
|
111
|
+
background: colorHex,
|
112
|
+
} }), _jsx("div", { className: style.colorPickerHueSlider, ref: this._hueRef, onPointerMove: (e) => this.onHuePointerMove(e), onPointerDown: (e) => this.onHuePointerDown(e), onPointerUp: (e) => this.onHuePointerUp(e), children: _jsx("div", { className: style.colorPickerHueCursor, style: {
|
113
|
+
left: `${(hsv.r / 360.0) * 100}%`,
|
114
|
+
border: `1px solid ` + colorHexRef,
|
115
|
+
} }) })] }), _jsxs("div", { className: style.colorPickerRgb, children: [_jsx("div", { className: style.red, children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "R", min: 0, max: 255, value: Math.round(this.state.color.r * 255), onChange: (value) => {
|
116
|
+
this.state.color.r = value / 255.0;
|
117
|
+
this.forceUpdate();
|
118
|
+
} }) }), _jsx("div", { className: style.green, children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "G", min: 0, max: 255, value: Math.round(this.state.color.g * 255), onChange: (value) => {
|
119
|
+
this.state.color.g = value / 255.0;
|
120
|
+
this.forceUpdate();
|
121
|
+
} }) }), _jsx("div", { className: style.blue, children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "B", min: 0, max: 255, value: Math.round(this.state.color.b * 255), onChange: (value) => {
|
122
|
+
this.state.color.b = value / 255.0;
|
123
|
+
this.forceUpdate();
|
124
|
+
} }) }), _jsx("div", { className: ClassNames({ alpha: true, grayed: hasAlpha }, style), children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "A", min: 0, max: 255, value: Math.round(this.state.alpha * 255), onChange: (value) => {
|
125
|
+
this.setState({ alpha: value / 255.0 });
|
126
|
+
this.forceUpdate();
|
127
|
+
} }) })] }), _jsx(HexColor, { lockObject: this.props.lockObject, expectedLength: hasAlpha ? 8 : 6, value: colorHex, onChange: (value) => {
|
128
|
+
if (hasAlpha) {
|
129
|
+
const color4 = Color4.FromHexString(value);
|
130
|
+
this.setState({ color: new Color3(color4.r, color4.g, color4.b), alpha: color4.a });
|
131
|
+
}
|
132
|
+
else {
|
133
|
+
this.setState({ color: Color3.FromHexString(value) });
|
134
|
+
}
|
135
|
+
} }), this.props.linearhint && (_jsx("div", { className: style.colorPickerWarning, children: "(Note: color is stored in linear mode and was converted to gamma to be displayed here (toGammaSpace() / toLinearSpace()))" }))] }));
|
136
|
+
}
|
137
|
+
}
|
138
|
+
//# sourceMappingURL=ColorPicker.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/components/colorPicker/ColorPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,4CAA8B;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,KAAK,MAAM,4BAA4B,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAsB3C;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,SAA+C;IAMlF,YAAY,KAAwB;QAChC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,YAAY,MAAM,EAAE;YACpC,IAAI,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;SAC7H;aAAM;YACH,IAAI,CAAC,K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EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;yBACvF;6BAAM;4BACH,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;yBACzD;oBACL,CAAC,GACH,EACD,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,CACtB,cAAK,SAAS,EAAE,KAAK,CAAC,kBAAkB,0IAElC,CACT,IACC,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import * as React from \"react\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport { ColorComponentEntry } from \"./ColorComponentEntry\";\r\nimport { HexColor } from \"./HexColor\";\r\nimport type { LockObject } from \"../../tabs/propertyGrids/lockObject\";\r\n\r\nimport style from \"./ColorPicker.modules.scss\";\r\nimport { ClassNames } from \"../classNames\";\r\n\r\n/**\r\n * Interface used to specify creation options for color picker\r\n */\r\nexport interface IColorPickerProps {\r\n color: Color3 | Color4;\r\n linearhint?: boolean;\r\n debugMode?: boolean;\r\n onColorChanged?: (color: Color3 | Color4) => void;\r\n lockObject: LockObject;\r\n backgroundColor?: string;\r\n}\r\n\r\n/**\r\n * Interface used to specify creation options for color picker\r\n */\r\nexport interface IColorPickerState {\r\n color: Color3;\r\n alpha: number;\r\n}\r\n\r\n/**\r\n * Class used to create a color picker\r\n */\r\nexport class ColorPicker extends React.Component<IColorPickerProps, IColorPickerState> {\r\n private _saturationRef: React.RefObject<HTMLDivElement>;\r\n private _hueRef: React.RefObject<HTMLDivElement>;\r\n private _isSaturationPointerDown: boolean;\r\n private _isHuePointerDown: boolean;\r\n\r\n constructor(props: IColorPickerProps) {\r\n super(props);\r\n if (this.props.color instanceof Color4) {\r\n this.state = { color: new Color3(this.props.color.r, this.props.color.g, this.props.color.b), alpha: this.props.color.a };\r\n } else {\r\n this.state = { color: this.props.color.clone(), alpha: 1 };\r\n }\r\n this._saturationRef = React.createRef();\r\n this._hueRef = React.createRef();\r\n }\r\n\r\n shouldComponentUpdate(nextProps: IColorPickerProps, nextState: IColorPickerState) {\r\n return nextProps.color.toHexString() !== this.props.color.toHexString() || nextState.color.toHexString() !== this.props.color.toHexString();\r\n }\r\n\r\n onSaturationPointerDown(evt: React.PointerEvent<HTMLDivElement>) {\r\n this._evaluateSaturation(evt);\r\n this._isSaturationPointerDown = true;\r\n\r\n evt.currentTarget.setPointerCapture(evt.pointerId);\r\n }\r\n\r\n onSaturationPointerUp(evt: React.PointerEvent<HTMLDivElement>) {\r\n this._isSaturationPointerDown = false;\r\n evt.currentTarget.releasePointerCapture(evt.pointerId);\r\n }\r\n\r\n onSaturationPointerMove(evt: React.PointerEvent<HTMLDivElement>) {\r\n if (!this._isSaturationPointerDown) {\r\n return;\r\n }\r\n this._evaluateSaturation(evt);\r\n }\r\n\r\n onHuePointerDown(evt: React.PointerEvent<HTMLDivElement>) {\r\n this._evaluateHue(evt);\r\n this._isHuePointerDown = true;\r\n\r\n evt.currentTarget.setPointerCapture(evt.pointerId);\r\n }\r\n\r\n onHuePointerUp(evt: React.PointerEvent<HTMLDivElement>) {\r\n this._isHuePointerDown = false;\r\n evt.currentTarget.releasePointerCapture(evt.pointerId);\r\n }\r\n\r\n onHuePointerMove(evt: React.PointerEvent<HTMLDivElement>) {\r\n if (!this._isHuePointerDown) {\r\n return;\r\n }\r\n this._evaluateHue(evt);\r\n }\r\n\r\n private _evaluateSaturation(evt: React.PointerEvent<HTMLDivElement>) {\r\n const left = evt.nativeEvent.offsetX;\r\n const top = evt.nativeEvent.offsetY;\r\n\r\n const saturation = Math.min(1, Math.max(0.0001, left / this._saturationRef.current!.clientWidth));\r\n const value = Math.min(1, Math.max(0.0001, 1 - top / this._saturationRef.current!.clientHeight));\r\n\r\n if (this.props.debugMode) {\r\n console.log(\"Saturation: \" + saturation);\r\n console.log(\"Value: \" + value);\r\n }\r\n\r\n const hsv = this.state.color.toHSV();\r\n Color3.HSVtoRGBToRef(hsv.r, saturation, value, this.state.color);\r\n if (this.state.alpha === 0) {\r\n this.setState({ alpha: 1 });\r\n }\r\n this.setState({ color: this.state.color });\r\n }\r\n\r\n private _evaluateHue(evt: React.PointerEvent<HTMLDivElement>) {\r\n const left = evt.nativeEvent.offsetX;\r\n\r\n const hue = 360 * Math.min(0.9999, Math.max(0.0001, left / this._hueRef.current!.clientWidth));\r\n\r\n if (this.props.debugMode) {\r\n console.log(\"Hue: \" + hue);\r\n }\r\n\r\n const hsv = this.state.color.toHSV();\r\n Color3.HSVtoRGBToRef(hue, Math.max(hsv.g, 0.01), Math.max(hsv.b, 0.01), this.state.color);\r\n this.setState({ color: this.state.color });\r\n }\r\n\r\n componentDidUpdate() {\r\n this.raiseOnColorChanged();\r\n }\r\n\r\n raiseOnColorChanged() {\r\n if (!this.props.onColorChanged) {\r\n return;\r\n }\r\n\r\n if (this.props.color instanceof Color4) {\r\n const newColor4 = Color4.FromColor3(this.state.color, this.state.alpha);\r\n\r\n this.props.onColorChanged(newColor4);\r\n\r\n return;\r\n }\r\n\r\n this.props.onColorChanged(this.state.color.clone());\r\n }\r\n\r\n public render() {\r\n const color4 = Color4.FromColor3(this.state.color);\r\n color4.a = this.state.alpha;\r\n const colorHex = color4.toHexString();\r\n const hsv = this.state.color.toHSV();\r\n const colorRef = new Color3();\r\n Color3.HSVtoRGBToRef(hsv.r, 1, 1, colorRef);\r\n const colorHexRef = colorRef.toHexString();\r\n const hasAlpha = this.props.color instanceof Color4;\r\n\r\n return (\r\n <div\r\n className={ClassNames({ colorPickerContainer: true, withHints: this.props.linearhint }, style)}\r\n style={{ backgroundColor: this.props.backgroundColor || \"inherit\" }}\r\n >\r\n <div\r\n className={style.colorPickerSaturation}\r\n onPointerMove={(e) => this.onSaturationPointerMove(e)}\r\n onPointerDown={(e) => this.onSaturationPointerDown(e)}\r\n onPointerUp={(e) => this.onSaturationPointerUp(e)}\r\n ref={this._saturationRef}\r\n style={{\r\n background: colorHexRef,\r\n }}\r\n >\r\n <div className={style.colorPickerSaturationWhite}></div>\r\n <div className={style.colorPickerSaturationBlack}></div>\r\n <div\r\n className={style.colorPickerSaturationCursor}\r\n style={{\r\n top: `${-(hsv.b * 100) + 100}%`,\r\n left: `${hsv.g * 100}%`,\r\n }}\r\n ></div>\r\n </div>\r\n <div className={style.colorPickerHue}>\r\n <div\r\n className={style.colorPickerHueColor}\r\n style={{\r\n background: colorHex,\r\n }}\r\n ></div>\r\n <div\r\n className={style.colorPickerHueSlider}\r\n ref={this._hueRef}\r\n onPointerMove={(e) => this.onHuePointerMove(e)}\r\n onPointerDown={(e) => this.onHuePointerDown(e)}\r\n onPointerUp={(e) => this.onHuePointerUp(e)}\r\n >\r\n <div\r\n className={style.colorPickerHueCursor}\r\n style={{\r\n left: `${(hsv.r / 360.0) * 100}%`,\r\n border: `1px solid ` + colorHexRef,\r\n }}\r\n ></div>\r\n </div>\r\n </div>\r\n {/* <div className=\"color-picker-alpha\"></div> */}\r\n <div className={style.colorPickerRgb}>\r\n <div className={style.red}>\r\n <ColorComponentEntry\r\n lockObject={this.props.lockObject}\r\n label=\"R\"\r\n min={0}\r\n max={255}\r\n value={Math.round(this.state.color.r * 255)}\r\n onChange={(value) => {\r\n this.state.color.r = value / 255.0;\r\n this.forceUpdate();\r\n }}\r\n />\r\n </div>\r\n <div className={style.green}>\r\n <ColorComponentEntry\r\n lockObject={this.props.lockObject}\r\n label=\"G\"\r\n min={0}\r\n max={255}\r\n value={Math.round(this.state.color.g * 255)}\r\n onChange={(value) => {\r\n this.state.color.g = value / 255.0;\r\n this.forceUpdate();\r\n }}\r\n />\r\n </div>\r\n <div className={style.blue}>\r\n <ColorComponentEntry\r\n lockObject={this.props.lockObject}\r\n label=\"B\"\r\n min={0}\r\n max={255}\r\n value={Math.round(this.state.color.b * 255)}\r\n onChange={(value) => {\r\n this.state.color.b = value / 255.0;\r\n this.forceUpdate();\r\n }}\r\n />\r\n </div>\r\n <div className={ClassNames({ alpha: true, grayed: hasAlpha }, style)}>\r\n <ColorComponentEntry\r\n lockObject={this.props.lockObject}\r\n label=\"A\"\r\n min={0}\r\n max={255}\r\n value={Math.round(this.state.alpha * 255)}\r\n onChange={(value) => {\r\n this.setState({ alpha: value / 255.0 });\r\n this.forceUpdate();\r\n }}\r\n />\r\n </div>\r\n </div>\r\n <HexColor\r\n lockObject={this.props.lockObject}\r\n expectedLength={hasAlpha ? 8 : 6}\r\n value={colorHex}\r\n onChange={(value) => {\r\n if (hasAlpha) {\r\n const color4 = Color4.FromHexString(value);\r\n this.setState({ color: new Color3(color4.r, color4.g, color4.b), alpha: color4.a });\r\n } else {\r\n this.setState({ color: Color3.FromHexString(value) });\r\n }\r\n }}\r\n />\r\n {this.props.linearhint && (\r\n <div className={style.colorPickerWarning}>\r\n (Note: color is stored in linear mode and was converted to gamma to be displayed here (toGammaSpace() / toLinearSpace()))\r\n </div>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import type { LockObject } from "../../tabs/propertyGrids/lockObject";
|
3
|
+
export interface IHexColorProps {
|
4
|
+
value: string;
|
5
|
+
expectedLength: number;
|
6
|
+
onChange: (value: string) => void;
|
7
|
+
lockObject: LockObject;
|
8
|
+
}
|
9
|
+
export declare class HexColor extends React.Component<IHexColorProps, {
|
10
|
+
hex: string;
|
11
|
+
}> {
|
12
|
+
constructor(props: IHexColorProps);
|
13
|
+
shouldComponentUpdate(nextProps: IHexColorProps, nextState: {
|
14
|
+
hex: string;
|
15
|
+
}): boolean;
|
16
|
+
lock(): void;
|
17
|
+
unlock(): void;
|
18
|
+
updateHexValue(valueString: string): void;
|
19
|
+
render(): JSX.Element;
|
20
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import * as React from "react";
|
3
|
+
import style from "./HexColor.modules.scss";
|
4
|
+
export class HexColor extends React.Component {
|
5
|
+
constructor(props) {
|
6
|
+
super(props);
|
7
|
+
this.state = { hex: this.props.value.replace("#", "") };
|
8
|
+
}
|
9
|
+
shouldComponentUpdate(nextProps, nextState) {
|
10
|
+
if (nextProps.value !== this.props.value) {
|
11
|
+
nextState.hex = nextProps.value.replace("#", "");
|
12
|
+
}
|
13
|
+
return true;
|
14
|
+
}
|
15
|
+
lock() {
|
16
|
+
if (this.props.lockObject) {
|
17
|
+
this.props.lockObject.lock = true;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
unlock() {
|
21
|
+
if (this.props.lockObject) {
|
22
|
+
this.props.lockObject.lock = false;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
updateHexValue(valueString) {
|
26
|
+
if (valueString != "" && /^[0-9A-Fa-f]+$/g.test(valueString) == false) {
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
this.setState({ hex: valueString });
|
30
|
+
if (valueString.length !== this.props.expectedLength) {
|
31
|
+
if (this.props.expectedLength === 8 && valueString.length === 6) {
|
32
|
+
valueString = valueString + "FF";
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
return;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
this.props.onChange("#" + valueString);
|
39
|
+
}
|
40
|
+
render() {
|
41
|
+
return (_jsxs("div", { className: style.colorPickerHex, children: [_jsx("div", { className: style.colorPickerHexLabel, children: "Hex" }), _jsx("div", { className: style.colorPickerHexValue, children: _jsx("input", { type: "string",
|
42
|
+
// className="hex-input"
|
43
|
+
className: style.colorPickerHex, value: this.state.hex, onBlur: () => this.unlock(), onFocus: () => this.lock(), onChange: (evt) => this.updateHexValue(evt.target.value) }) })] }));
|
44
|
+
}
|
45
|
+
}
|
46
|
+
//# sourceMappingURL=HexColor.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"HexColor.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/components/colorPicker/HexColor.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK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C;iBAAM;gBACH,OAAO;aACV;SACJ;QAED,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC;IAC3C,CAAC;IAEM,MAAM;QACT,OAAO,CACH,eAAK,SAAS,EAAE,KAAK,CAAC,cAAc,aAChC,cAAK,SAAS,EAAE,KAAK,CAAC,mBAAmB,oBAAW,EACpD,cAAK,SAAS,EAAE,KAAK,CAAC,mBAAmB,YACrC,gBACI,IAAI,EAAC,QAAQ;wBACb,wBAAwB;wBACxB,SAAS,EAAE,KAAK,CAAC,cAAc,EAC/B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EACrB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EAC1B,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAC1D,GACA,IACJ,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import * as React from \"react\";\r\nimport type { LockObject } from \"../../tabs/propertyGrids/lockObject\";\r\nimport style from \"./HexColor.modules.scss\";\r\n\r\nexport interface IHexColorProps {\r\n value: string;\r\n expectedLength: number;\r\n onChange: (value: string) => void;\r\n lockObject: LockObject;\r\n}\r\n\r\nexport class HexColor extends React.Component<IHexColorProps, { hex: string }> {\r\n constructor(props: IHexColorProps) {\r\n super(props);\r\n\r\n this.state = { hex: this.props.value.replace(\"#\", \"\") };\r\n }\r\n\r\n shouldComponentUpdate(nextProps: IHexColorProps, nextState: { hex: string }) {\r\n if (nextProps.value !== this.props.value) {\r\n nextState.hex = nextProps.value.replace(\"#\", \"\");\r\n }\r\n\r\n return true;\r\n }\r\n\r\n lock() {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = true;\r\n }\r\n }\r\n\r\n unlock() {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = false;\r\n }\r\n }\r\n\r\n updateHexValue(valueString: string) {\r\n if (valueString != \"\" && /^[0-9A-Fa-f]+$/g.test(valueString) == false) {\r\n return;\r\n }\r\n\r\n this.setState({ hex: valueString });\r\n\r\n if (valueString.length !== this.props.expectedLength) {\r\n if (this.props.expectedLength === 8 && valueString.length === 6) {\r\n valueString = valueString + \"FF\";\r\n } else {\r\n return;\r\n }\r\n }\r\n\r\n this.props.onChange(\"#\" + valueString);\r\n }\r\n\r\n public render() {\r\n return (\r\n <div className={style.colorPickerHex}>\r\n <div className={style.colorPickerHexLabel}>Hex</div>\r\n <div className={style.colorPickerHexValue}>\r\n <input\r\n type=\"string\"\r\n // className=\"hex-input\"\r\n className={style.colorPickerHex}\r\n value={this.state.hex}\r\n onBlur={() => this.unlock()}\r\n onFocus={() => this.lock()}\r\n onChange={(evt) => this.updateHexValue(evt.target.value)}\r\n />\r\n </div>\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import type { Observable } from "@babylonjs/core/Misc/observable.js";
|
3
|
+
import { Color4 } from "@babylonjs/core/Maths/math.color.js";
|
4
|
+
import type { PropertyChangedEvent } from "../../propertyChangedEvent";
|
5
|
+
import type { LockObject } from "../../tabs/propertyGrids/lockObject";
|
6
|
+
export interface IColorLineComponentProps {
|
7
|
+
label: string;
|
8
|
+
target: any;
|
9
|
+
propertyName: string;
|
10
|
+
onPropertyChangedObservable: Observable<PropertyChangedEvent>;
|
11
|
+
onChange?: () => void;
|
12
|
+
isLinear?: boolean;
|
13
|
+
icon?: string;
|
14
|
+
iconLabel?: string;
|
15
|
+
disableAlpha?: boolean;
|
16
|
+
lockObject: LockObject;
|
17
|
+
}
|
18
|
+
interface IColorLineComponentState {
|
19
|
+
isExpanded: boolean;
|
20
|
+
color: Color4;
|
21
|
+
}
|
22
|
+
export declare class ColorLineComponent extends React.Component<IColorLineComponentProps, IColorLineComponentState> {
|
23
|
+
constructor(props: IColorLineComponentProps);
|
24
|
+
shouldComponentUpdate(nextProps: IColorLineComponentProps, nextState: IColorLineComponentState): boolean;
|
25
|
+
getValue(props?: Readonly<IColorLineComponentProps> & Readonly<{
|
26
|
+
children?: React.ReactNode;
|
27
|
+
}>): Color4;
|
28
|
+
setColorFromString(colorString: string): void;
|
29
|
+
setColor(newColor: Color4): void;
|
30
|
+
switchExpandState(): void;
|
31
|
+
updateStateR(value: number): void;
|
32
|
+
updateStateG(value: number): void;
|
33
|
+
updateStateB(value: number): void;
|
34
|
+
updateStateA(value: number): void;
|
35
|
+
copyToClipboard(): void;
|
36
|
+
private _convertToColor;
|
37
|
+
private _toColor3;
|
38
|
+
render(): JSX.Element;
|
39
|
+
}
|
40
|
+
export {};
|