@babylonjs/shared-ui-components 6.8.0 → 6.9.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.
@@ -1 +1 @@
1
- {"version":3,"file":"FileButtonLineComponent.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/lines/FileButtonLineComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,MAAM,MAAM,wCAAwC,CAAC;AAU5D,MAAM,OAAO,uBAAwB,SAAQ,KAAK,CAAC,SAAwC;IAKvF,YAAY,KAAoC;QAC5C,KAAK,CAAC,KAAK,CAAC,CAAC;QAJT,QAAG,GAAG,uBAAuB,CAAC,YAAY,EAAE,CAAC;QAKjD,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAC7C,CAAC;IAED,QAAQ,CAAC,GAAQ;QACb,MAAM,KAAK,GAAW,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;QACvC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE;YACvB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SAChC;QAED,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED,MAAM;QACF,OAAO,CACH,eAAK,SAAS,EAAE,MAAM,CAAC,UAAU,aAC5B,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,cAAK,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,GAAI,EACzG,gBAAO,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,UAAU,YACjE,IAAI,CAAC,KAAK,CAAC,KAAK,GACb,EACR,gBAAO,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,EAAE,EAAE,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,EAAC,MAAM,EAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAI,IAC9I,CACT,CAAC;IACN,CAAC;;AA5Bc,oCAAY,GAAG,CAAC,CAAC","sourcesContent":["import * as React from \"react\";\r\nimport styles from \"./FileButtonLineComponent.modules.scss\";\r\n\r\nexport interface IFileButtonLineComponentProps {\r\n label: string;\r\n onClick: (file: File) => void;\r\n accept: string;\r\n icon?: string;\r\n iconLabel?: string;\r\n}\r\n\r\nexport class FileButtonLineComponent extends React.Component<IFileButtonLineComponentProps> {\r\n private static _IDGenerator = 0;\r\n private _id = FileButtonLineComponent._IDGenerator++;\r\n private _uploadInputRef: React.RefObject<HTMLInputElement>;\r\n\r\n constructor(props: IFileButtonLineComponentProps) {\r\n super(props);\r\n this._uploadInputRef = React.createRef();\r\n }\r\n\r\n onChange(evt: any) {\r\n const files: File[] = evt.target.files;\r\n if (files && files.length) {\r\n this.props.onClick(files[0]);\r\n }\r\n\r\n evt.target.value = \"\";\r\n }\r\n\r\n render() {\r\n return (\r\n <div className={styles.buttonLine}>\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} />}\r\n <label htmlFor={\"file-upload\" + this._id} className={styles.fileUpload}>\r\n {this.props.label}\r\n </label>\r\n <input ref={this._uploadInputRef} id={\"file-upload\" + this._id} type=\"file\" accept={this.props.accept} onChange={(evt) => this.onChange(evt)} />\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"FileButtonLineComponent.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/lines/FileButtonLineComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAA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ACT,CAAC;IACN,CAAC;;AA5Bc,oCAAY,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import * as React from \"react\";\r\nimport styles from \"./FileButtonLineComponent.modules.scss\";\r\n\r\nexport interface IFileButtonLineComponentProps {\r\n label: string;\r\n onClick: (file: File) => void;\r\n accept: string;\r\n icon?: string;\r\n iconLabel?: string;\r\n}\r\n\r\nexport class FileButtonLineComponent extends React.Component<IFileButtonLineComponentProps> {\r\n private static _IDGenerator = 0;\r\n private _id = FileButtonLineComponent._IDGenerator++;\r\n private _uploadInputRef: React.RefObject<HTMLInputElement>;\r\n\r\n constructor(props: IFileButtonLineComponentProps) {\r\n super(props);\r\n this._uploadInputRef = React.createRef();\r\n }\r\n\r\n onChange(evt: any) {\r\n const files: File[] = evt.target.files;\r\n if (files && files.length) {\r\n this.props.onClick(files[0]);\r\n }\r\n\r\n evt.target.value = \"\";\r\n }\r\n\r\n render() {\r\n return (\r\n <div className={styles.buttonLine}>\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} />}\r\n <label htmlFor={\"file-upload\" + this._id} className={styles.fileUpload}>\r\n {this.props.label}\r\n </label>\r\n <input ref={this._uploadInputRef} id={\"file-upload\" + this._id} type=\"file\" accept={this.props.accept} onChange={(evt) => this.onChange(evt)} />\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"NumericInputComponent.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/lines/NumericInputComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,MAAM,sCAAsC,CAAC;AAazD,MAAM,OAAO,qBAAsB,SAAQ,KAAK,CAAC,SAAyD;IAOtG,YAAY,KAAkC;QAC1C,KAAK,CAAC,KAAK,CAAC,CAAC;QAFT,iBAAY,GAAG,KAAK,CAAC;QAIzB,IAAI,CAAC,KAAK,GAAG,EAAE,KAAK,E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CAAC,IAAI,CAAC,MAAM,EAAE,GAC7B,IACA,CACT,CAAC;IACN,CAAC;;AArHD,gEAAgE;AACzD,kCAAY,GAAG;IAClB,IAAI,EAAE,CAAC;CACV,CAAC","sourcesContent":["import * as React from \"react\";\r\nimport type { LockObject } from \"../../tabs/propertyGrids/lockObject\";\r\nimport style from \"./NumericInputComponent.modules.scss\";\r\n\r\ninterface INumericInputComponentProps {\r\n label: string;\r\n value: number;\r\n step?: number;\r\n onChange: (value: number) => void;\r\n precision?: number;\r\n icon?: string;\r\n iconLabel?: string;\r\n lockObject: LockObject;\r\n}\r\n\r\nexport class NumericInputComponent extends React.Component<INumericInputComponentProps, { value: string }> {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n static defaultProps = {\r\n step: 1,\r\n };\r\n\r\n private _localChange = false;\r\n constructor(props: INumericInputComponentProps) {\r\n super(props);\r\n\r\n this.state = { value: this.props.value.toFixed(this.props.precision !== undefined ? this.props.precision : 3) };\r\n }\r\n\r\n componentWillUnmount() {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = false;\r\n }\r\n }\r\n\r\n shouldComponentUpdate(nextProps: INumericInputComponentProps, nextState: { value: string }) {\r\n if (this._localChange) {\r\n return true;\r\n }\r\n\r\n if (nextProps.value.toString() !== nextState.value) {\r\n nextState.value = nextProps.value.toFixed(this.props.precision !== undefined ? this.props.precision : 3);\r\n return true;\r\n }\r\n return false;\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 const valueAsNumber = parseFloat(valueString);\r\n\r\n this._localChange = true;\r\n this.setState({ value: valueString });\r\n\r\n if (isNaN(valueAsNumber)) {\r\n return;\r\n }\r\n\r\n this.props.onChange(valueAsNumber);\r\n }\r\n\r\n onBlur() {\r\n this._localChange = false;\r\n const valueAsNumber = parseFloat(this.state.value);\r\n\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = false;\r\n }\r\n\r\n if (isNaN(valueAsNumber)) {\r\n this.props.onChange(this.props.value);\r\n return;\r\n }\r\n\r\n this.props.onChange(valueAsNumber);\r\n }\r\n\r\n incrementValue(amount: number) {\r\n let currentValue = parseFloat(this.state.value);\r\n if (isNaN(currentValue)) {\r\n currentValue = 0;\r\n }\r\n this.updateValue((currentValue + amount).toFixed(this.props.precision !== undefined ? this.props.precision : 3));\r\n }\r\n\r\n onKeyDown(evt: React.KeyboardEvent<HTMLInputElement>) {\r\n const step = this.props.step || 1;\r\n const handleArrowKey = (sign: number) => {\r\n if (evt.shiftKey) {\r\n sign *= 10;\r\n if (evt.ctrlKey || evt.metaKey) {\r\n sign *= 10;\r\n }\r\n }\r\n\r\n this.incrementValue(sign * step);\r\n evt.preventDefault();\r\n };\r\n\r\n if (evt.key === \"ArrowUp\") {\r\n handleArrowKey(1);\r\n } else if (evt.key === \"ArrowDown\") {\r\n handleArrowKey(-1);\r\n }\r\n }\r\n\r\n render() {\r\n return (\r\n <div className={style.numeric}>\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} className=\"icon\" />}\r\n {this.props.label && (\r\n <div className={style.numericLabel} title={this.props.label}>\r\n {`${this.props.label}: `}\r\n </div>\r\n )}\r\n <input\r\n type=\"number\"\r\n step={this.props.step}\r\n className={style.numericInput}\r\n value={this.state.value}\r\n onChange={(evt) => this.updateValue(evt.target.value)}\r\n onKeyDown={(evt) => this.onKeyDown(evt)}\r\n onFocus={() => {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = true;\r\n }\r\n }}\r\n onBlur={() => this.onBlur()}\r\n />\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"NumericInputComponent.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/lines/NumericInputComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,MAAM,sCAAsC,CAAC;AAazD,MAAM,OAA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,EAAE;wBACV,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;4BACvB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;yBACrC;oBACL,CAAC,EACD,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,GAC7B,IACA,CACT,CAAC;IACN,CAAC;;AArHD,gEAAgE;AACzD,kCAAY,GAAG;IAClB,IAAI,EAAE,CAAC;CACV,AAFkB,CAEjB","sourcesContent":["import * as React from \"react\";\r\nimport type { LockObject } from \"../../tabs/propertyGrids/lockObject\";\r\nimport style from \"./NumericInputComponent.modules.scss\";\r\n\r\ninterface INumericInputComponentProps {\r\n label: string;\r\n value: number;\r\n step?: number;\r\n onChange: (value: number) => void;\r\n precision?: number;\r\n icon?: string;\r\n iconLabel?: string;\r\n lockObject: LockObject;\r\n}\r\n\r\nexport class NumericInputComponent extends React.Component<INumericInputComponentProps, { value: string }> {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n static defaultProps = {\r\n step: 1,\r\n };\r\n\r\n private _localChange = false;\r\n constructor(props: INumericInputComponentProps) {\r\n super(props);\r\n\r\n this.state = { value: this.props.value.toFixed(this.props.precision !== undefined ? this.props.precision : 3) };\r\n }\r\n\r\n componentWillUnmount() {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = false;\r\n }\r\n }\r\n\r\n shouldComponentUpdate(nextProps: INumericInputComponentProps, nextState: { value: string }) {\r\n if (this._localChange) {\r\n return true;\r\n }\r\n\r\n if (nextProps.value.toString() !== nextState.value) {\r\n nextState.value = nextProps.value.toFixed(this.props.precision !== undefined ? this.props.precision : 3);\r\n return true;\r\n }\r\n return false;\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 const valueAsNumber = parseFloat(valueString);\r\n\r\n this._localChange = true;\r\n this.setState({ value: valueString });\r\n\r\n if (isNaN(valueAsNumber)) {\r\n return;\r\n }\r\n\r\n this.props.onChange(valueAsNumber);\r\n }\r\n\r\n onBlur() {\r\n this._localChange = false;\r\n const valueAsNumber = parseFloat(this.state.value);\r\n\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = false;\r\n }\r\n\r\n if (isNaN(valueAsNumber)) {\r\n this.props.onChange(this.props.value);\r\n return;\r\n }\r\n\r\n this.props.onChange(valueAsNumber);\r\n }\r\n\r\n incrementValue(amount: number) {\r\n let currentValue = parseFloat(this.state.value);\r\n if (isNaN(currentValue)) {\r\n currentValue = 0;\r\n }\r\n this.updateValue((currentValue + amount).toFixed(this.props.precision !== undefined ? this.props.precision : 3));\r\n }\r\n\r\n onKeyDown(evt: React.KeyboardEvent<HTMLInputElement>) {\r\n const step = this.props.step || 1;\r\n const handleArrowKey = (sign: number) => {\r\n if (evt.shiftKey) {\r\n sign *= 10;\r\n if (evt.ctrlKey || evt.metaKey) {\r\n sign *= 10;\r\n }\r\n }\r\n\r\n this.incrementValue(sign * step);\r\n evt.preventDefault();\r\n };\r\n\r\n if (evt.key === \"ArrowUp\") {\r\n handleArrowKey(1);\r\n } else if (evt.key === \"ArrowDown\") {\r\n handleArrowKey(-1);\r\n }\r\n }\r\n\r\n render() {\r\n return (\r\n <div className={style.numeric}>\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} className=\"icon\" />}\r\n {this.props.label && (\r\n <div className={style.numericLabel} title={this.props.label}>\r\n {`${this.props.label}: `}\r\n </div>\r\n )}\r\n <input\r\n type=\"number\"\r\n step={this.props.step}\r\n className={style.numericInput}\r\n value={this.state.value}\r\n onChange={(evt) => this.updateValue(evt.target.value)}\r\n onKeyDown={(evt) => this.onKeyDown(evt)}\r\n onFocus={() => {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = true;\r\n }\r\n }}\r\n onBlur={() => this.onBlur()}\r\n />\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":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AC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAI,IAC9I,CACT,CAAC;IACN,CAAC;;AA5Bc,oCAAY,GAAG,CAAC,CAAC","sourcesContent":["import * as React from \"react\";\r\n\r\ninterface IFileButtonLineComponentProps {\r\n label: string;\r\n onClick: (file: File) => void;\r\n accept: string;\r\n icon?: string;\r\n iconLabel?: string;\r\n}\r\n\r\nexport class FileButtonLineComponent extends React.Component<IFileButtonLineComponentProps> {\r\n private static _IDGenerator = 0;\r\n private _id = FileButtonLineComponent._IDGenerator++;\r\n private _uploadInputRef: React.RefObject<HTMLInputElement>;\r\n\r\n constructor(props: IFileButtonLineComponentProps) {\r\n super(props);\r\n this._uploadInputRef = React.createRef();\r\n }\r\n\r\n onChange(evt: any) {\r\n const files: File[] = evt.target.files;\r\n if (files && files.length) {\r\n this.props.onClick(files[0]);\r\n }\r\n\r\n evt.target.value = \"\";\r\n }\r\n\r\n render() {\r\n return (\r\n <div className=\"buttonLine\">\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} className=\"icon\" />}\r\n <label htmlFor={\"file-upload\" + this._id} className=\"file-upload\">\r\n {this.props.label}\r\n </label>\r\n <input ref={this._uploadInputRef} id={\"file-upload\" + this._id} type=\"file\" accept={this.props.accept} onChange={(evt) => this.onChange(evt)} />\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"fileButtonLineComponent.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/lines/fileButtonLineComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,OAAO,uBAAwB,SAAQ,KAAK,CAAC,SAAwC;IAKvF,YAAY,KAAoC;QAC5C,KAAK,CAAC,KAAK,CAAC,CAAC;QAJT,QAAG,GAAG,uBAAuB,CAAC,YAAY,EAAE,CAAC;QAKjD,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAC7C,CAAC;IAED,QAAQ,CAAC,GAAQ;QACb,MAAM,KAAK,GAAW,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;QACvC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE;YACvB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SAChC;QAED,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED,MAAM;QACF,OAAO,CACH,eAAK,SAAS,EAAC,YAAY,aACtB,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,cAAK,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,EAAC,MAAM,GAAG,EAC1H,gBAAO,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,SAAS,EAAC,aAAa,YAC5D,IAAI,CAAC,KAAK,CAAC,KAAK,GACb,EACR,gBAAO,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,EAAE,EAAE,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,EAAC,MAAM,EAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAI,IAC9I,CACT,CAAC;IACN,CAAC;;AA5Bc,oCAAY,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import * as React from \"react\";\r\n\r\ninterface IFileButtonLineComponentProps {\r\n label: string;\r\n onClick: (file: File) => void;\r\n accept: string;\r\n icon?: string;\r\n iconLabel?: string;\r\n}\r\n\r\nexport class FileButtonLineComponent extends React.Component<IFileButtonLineComponentProps> {\r\n private static _IDGenerator = 0;\r\n private _id = FileButtonLineComponent._IDGenerator++;\r\n private _uploadInputRef: React.RefObject<HTMLInputElement>;\r\n\r\n constructor(props: IFileButtonLineComponentProps) {\r\n super(props);\r\n this._uploadInputRef = React.createRef();\r\n }\r\n\r\n onChange(evt: any) {\r\n const files: File[] = evt.target.files;\r\n if (files && files.length) {\r\n this.props.onClick(files[0]);\r\n }\r\n\r\n evt.target.value = \"\";\r\n }\r\n\r\n render() {\r\n return (\r\n <div className=\"buttonLine\">\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} className=\"icon\" />}\r\n <label htmlFor={\"file-upload\" + this._id} className=\"file-upload\">\r\n {this.props.label}\r\n </label>\r\n <input ref={this._uploadInputRef} id={\"file-upload\" + this._id} type=\"file\" accept={this.props.accept} onChange={(evt) => this.onChange(evt)} />\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fileMultipleButtonLineComponent.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/lines/fileMultipleButtonLineComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,OAAO,+BAAgC,SAAQ,KAAK,CAAC,SAAgD;IAKvG,YAAY,KAA4C;QACpD,KAAK,CAAC,KAAK,CAAC,CAAC;QAJT,QAAG,GAAG,+BAA+B,CAAC,YAAY,EAAE,CAAC;QAKzD,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAC7C,CAAC;IAED,QAAQ,CAAC,GAAQ;QACb,MAAM,KAAK,GAAW,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;QACvC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE;YACvB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SAC3B;QAED,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED,MAAM;QACF,OAAO,CACH,eAAK,SAAS,EAAC,YAAY,aACtB,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,cAAK,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,EAAC,MAAM,GAAG,EAC1H,gBAAO,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,SAAS,EAAC,aAAa,YAC5D,IAAI,CAAC,KAAK,CAAC,KAAK,GACb,EACR,gBAAO,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,EAAE,EAAE,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,EAAC,MAAM,EAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,SAAG,IACvJ,CACT,CAAC;IACN,CAAC;;AA5Bc,4CAAY,GAAG,CAAC,CAAC","sourcesContent":["import * as React from \"react\";\r\n\r\ninterface IFileMultipleButtonLineComponentProps {\r\n label: string;\r\n onClick: (event: any) => void;\r\n accept: string;\r\n icon?: string;\r\n iconLabel?: string;\r\n}\r\n\r\nexport class FileMultipleButtonLineComponent extends React.Component<IFileMultipleButtonLineComponentProps> {\r\n private static _IDGenerator = 0;\r\n private _id = FileMultipleButtonLineComponent._IDGenerator++;\r\n private _uploadInputRef: React.RefObject<HTMLInputElement>;\r\n\r\n constructor(props: IFileMultipleButtonLineComponentProps) {\r\n super(props);\r\n this._uploadInputRef = React.createRef();\r\n }\r\n\r\n onChange(evt: any) {\r\n const files: File[] = evt.target.files;\r\n if (files && files.length) {\r\n this.props.onClick(evt);\r\n }\r\n\r\n evt.target.value = \"\";\r\n }\r\n\r\n render() {\r\n return (\r\n <div className=\"buttonLine\">\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} className=\"icon\" />}\r\n <label htmlFor={\"file-upload\" + this._id} className=\"file-upload\">\r\n {this.props.label}\r\n </label>\r\n <input ref={this._uploadInputRef} id={\"file-upload\" + this._id} type=\"file\" accept={this.props.accept} onChange={(evt) => this.onChange(evt)} multiple />\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"fileMultipleButtonLineComponent.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/lines/fileMultipleButtonLineComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,OAAO,+BAAgC,SAAQ,KAAK,CAAC,SAAgD;IAKvG,YAAY,KAA4C;QACpD,KAAK,CAAC,KAAK,CAAC,CAAC;QAJT,QAAG,GAAG,+BAA+B,CAAC,YAAY,EAAE,CAAC;QAKzD,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAC7C,CAAC;IAED,QAAQ,CAAC,GAAQ;QACb,MAAM,KAAK,GAAW,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;QACvC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE;YACvB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SAC3B;QAED,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED,MAAM;QACF,OAAO,CACH,eAAK,SAAS,EAAC,YAAY,aACtB,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,cAAK,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,EAAC,MAAM,GAAG,EAC1H,gBAAO,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,SAAS,EAAC,aAAa,YAC5D,IAAI,CAAC,KAAK,CAAC,KAAK,GACb,EACR,gBAAO,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,EAAE,EAAE,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,EAAC,MAAM,EAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,SAAG,IACvJ,CACT,CAAC;IACN,CAAC;;AA5Bc,4CAAY,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import * as React from \"react\";\r\n\r\ninterface IFileMultipleButtonLineComponentProps {\r\n label: string;\r\n onClick: (event: any) => void;\r\n accept: string;\r\n icon?: string;\r\n iconLabel?: string;\r\n}\r\n\r\nexport class FileMultipleButtonLineComponent extends React.Component<IFileMultipleButtonLineComponentProps> {\r\n private static _IDGenerator = 0;\r\n private _id = FileMultipleButtonLineComponent._IDGenerator++;\r\n private _uploadInputRef: React.RefObject<HTMLInputElement>;\r\n\r\n constructor(props: IFileMultipleButtonLineComponentProps) {\r\n super(props);\r\n this._uploadInputRef = React.createRef();\r\n }\r\n\r\n onChange(evt: any) {\r\n const files: File[] = evt.target.files;\r\n if (files && files.length) {\r\n this.props.onClick(evt);\r\n }\r\n\r\n evt.target.value = \"\";\r\n }\r\n\r\n render() {\r\n return (\r\n <div className=\"buttonLine\">\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} className=\"icon\" />}\r\n <label htmlFor={\"file-upload\" + this._id} className=\"file-upload\">\r\n {this.props.label}\r\n </label>\r\n <input ref={this._uploadInputRef} id={\"file-upload\" + this._id} type=\"file\" accept={this.props.accept} onChange={(evt) => this.onChange(evt)} multiple />\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"numeric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SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EACvC,OAAO,EAAE,GAAG,EAAE;wBACV,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;4BACvB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;yBACrC;oBACL,CAAC,EACD,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,GAC7B,IACA,CACT,CAAC;IACN,CAAC;;AArHD,gEAAgE;AACzD,kCAAY,GAAG;IAClB,IAAI,EAAE,CAAC;CACV,CAAC","sourcesContent":["import * as React from \"react\";\r\nimport type { LockObject } from \"../tabs/propertyGrids/lockObject\";\r\n\r\ninterface INumericInputComponentProps {\r\n label: string;\r\n value: number;\r\n step?: number;\r\n onChange: (value: number) => void;\r\n precision?: number;\r\n icon?: string;\r\n iconLabel?: string;\r\n lockObject: LockObject;\r\n}\r\n\r\nexport class NumericInputComponent extends React.Component<INumericInputComponentProps, { value: string }> {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n static defaultProps = {\r\n step: 1,\r\n };\r\n\r\n private _localChange = false;\r\n constructor(props: INumericInputComponentProps) {\r\n super(props);\r\n\r\n this.state = { value: this.props.value.toFixed(this.props.precision !== undefined ? this.props.precision : 3) };\r\n }\r\n\r\n componentWillUnmount() {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = false;\r\n }\r\n }\r\n\r\n shouldComponentUpdate(nextProps: INumericInputComponentProps, nextState: { value: string }) {\r\n if (this._localChange) {\r\n return true;\r\n }\r\n\r\n if (nextProps.value.toString() !== nextState.value) {\r\n nextState.value = nextProps.value.toFixed(this.props.precision !== undefined ? this.props.precision : 3);\r\n return true;\r\n }\r\n return false;\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 const valueAsNumber = parseFloat(valueString);\r\n\r\n this._localChange = true;\r\n this.setState({ value: valueString });\r\n\r\n if (isNaN(valueAsNumber)) {\r\n return;\r\n }\r\n\r\n this.props.onChange(valueAsNumber);\r\n }\r\n\r\n onBlur() {\r\n this._localChange = false;\r\n const valueAsNumber = parseFloat(this.state.value);\r\n\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = false;\r\n }\r\n\r\n if (isNaN(valueAsNumber)) {\r\n this.props.onChange(this.props.value);\r\n return;\r\n }\r\n\r\n this.props.onChange(valueAsNumber);\r\n }\r\n\r\n incrementValue(amount: number) {\r\n let currentValue = parseFloat(this.state.value);\r\n if (isNaN(currentValue)) {\r\n currentValue = 0;\r\n }\r\n this.updateValue((currentValue + amount).toFixed(this.props.precision !== undefined ? this.props.precision : 3));\r\n }\r\n\r\n onKeyDown(evt: React.KeyboardEvent<HTMLInputElement>) {\r\n const step = this.props.step || 1;\r\n const handleArrowKey = (sign: number) => {\r\n if (evt.shiftKey) {\r\n sign *= 10;\r\n if (evt.ctrlKey || evt.metaKey) {\r\n sign *= 10;\r\n }\r\n }\r\n\r\n this.incrementValue(sign * step);\r\n evt.preventDefault();\r\n };\r\n\r\n if (evt.key === \"ArrowUp\") {\r\n handleArrowKey(1);\r\n } else if (evt.key === \"ArrowDown\") {\r\n handleArrowKey(-1);\r\n }\r\n }\r\n\r\n render() {\r\n return (\r\n <div className=\"numeric\">\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} className=\"icon\" />}\r\n {this.props.label && (\r\n <div className=\"numeric-label\" title={this.props.label}>\r\n {`${this.props.label}: `}\r\n </div>\r\n )}\r\n <input\r\n type=\"number\"\r\n step={this.props.step}\r\n className=\"numeric-input\"\r\n value={this.state.value}\r\n onChange={(evt) => this.updateValue(evt.target.value)}\r\n onKeyDown={(evt) => this.onKeyDown(evt)}\r\n onFocus={() => {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = true;\r\n }\r\n }}\r\n onBlur={() => this.onBlur()}\r\n />\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"numericInputComponent.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/lines/numericInputComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,MAAM,OAAO,qBAAsB,SAAQ,KAAK,CAAC,SAAyD;IAOtG,YAAY,KAAkC;QAC1C,KAAK,CAAC,KAAK,CAAC,CAAC;QAFT,iBAAY,GAAG,KAAK,CAAC;QAIzB,IAAI,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACpH,CAAC;IAED,oBAAoB;QAChB,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;YACvB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,KAAK,CAAC;SACtC;IACL,CAAC;IAED,qBAAqB,CAAC,SAAsC,EAAE,SAA4B;QACtF,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,OAAO,IAAI,CAAC;SACf;QAED,IAAI,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,SAAS,CAAC,KAAK,EAAE;YAChD,SAAS,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACzG,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,WAAW,CAAC,WAAmB;QAC3B,IAAI,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;YAC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AAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EACrD,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EACvC,OAAO,EAAE,GAAG,EAAE;wBACV,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;4BACvB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;yBACrC;oBACL,CAAC,EACD,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,GAC7B,IACA,CACT,CAAC;IACN,CAAC;;AArHD,gEAAgE;AACzD,kCAAY,GAAG;IAClB,IAAI,EAAE,CAAC;CACV,AAFkB,CAEjB","sourcesContent":["import * as React from \"react\";\r\nimport type { LockObject } from \"../tabs/propertyGrids/lockObject\";\r\n\r\ninterface INumericInputComponentProps {\r\n label: string;\r\n value: number;\r\n step?: number;\r\n onChange: (value: number) => void;\r\n precision?: number;\r\n icon?: string;\r\n iconLabel?: string;\r\n lockObject: LockObject;\r\n}\r\n\r\nexport class NumericInputComponent extends React.Component<INumericInputComponentProps, { value: string }> {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n static defaultProps = {\r\n step: 1,\r\n };\r\n\r\n private _localChange = false;\r\n constructor(props: INumericInputComponentProps) {\r\n super(props);\r\n\r\n this.state = { value: this.props.value.toFixed(this.props.precision !== undefined ? this.props.precision : 3) };\r\n }\r\n\r\n componentWillUnmount() {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = false;\r\n }\r\n }\r\n\r\n shouldComponentUpdate(nextProps: INumericInputComponentProps, nextState: { value: string }) {\r\n if (this._localChange) {\r\n return true;\r\n }\r\n\r\n if (nextProps.value.toString() !== nextState.value) {\r\n nextState.value = nextProps.value.toFixed(this.props.precision !== undefined ? this.props.precision : 3);\r\n return true;\r\n }\r\n return false;\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 const valueAsNumber = parseFloat(valueString);\r\n\r\n this._localChange = true;\r\n this.setState({ value: valueString });\r\n\r\n if (isNaN(valueAsNumber)) {\r\n return;\r\n }\r\n\r\n this.props.onChange(valueAsNumber);\r\n }\r\n\r\n onBlur() {\r\n this._localChange = false;\r\n const valueAsNumber = parseFloat(this.state.value);\r\n\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = false;\r\n }\r\n\r\n if (isNaN(valueAsNumber)) {\r\n this.props.onChange(this.props.value);\r\n return;\r\n }\r\n\r\n this.props.onChange(valueAsNumber);\r\n }\r\n\r\n incrementValue(amount: number) {\r\n let currentValue = parseFloat(this.state.value);\r\n if (isNaN(currentValue)) {\r\n currentValue = 0;\r\n }\r\n this.updateValue((currentValue + amount).toFixed(this.props.precision !== undefined ? this.props.precision : 3));\r\n }\r\n\r\n onKeyDown(evt: React.KeyboardEvent<HTMLInputElement>) {\r\n const step = this.props.step || 1;\r\n const handleArrowKey = (sign: number) => {\r\n if (evt.shiftKey) {\r\n sign *= 10;\r\n if (evt.ctrlKey || evt.metaKey) {\r\n sign *= 10;\r\n }\r\n }\r\n\r\n this.incrementValue(sign * step);\r\n evt.preventDefault();\r\n };\r\n\r\n if (evt.key === \"ArrowUp\") {\r\n handleArrowKey(1);\r\n } else if (evt.key === \"ArrowDown\") {\r\n handleArrowKey(-1);\r\n }\r\n }\r\n\r\n render() {\r\n return (\r\n <div className=\"numeric\">\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} className=\"icon\" />}\r\n {this.props.label && (\r\n <div className=\"numeric-label\" title={this.props.label}>\r\n {`${this.props.label}: `}\r\n </div>\r\n )}\r\n <input\r\n type=\"number\"\r\n step={this.props.step}\r\n className=\"numeric-input\"\r\n value={this.state.value}\r\n onChange={(evt) => this.updateValue(evt.target.value)}\r\n onKeyDown={(evt) => this.onKeyDown(evt)}\r\n onFocus={() => {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = true;\r\n }\r\n }}\r\n onBlur={() => this.onBlur()}\r\n />\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"vector2LineComponent.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/lines/vector2LineComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAgBpE,MAAM,OAAO,oBAAqB,SAAQ,KAAK,CAAC,SAA8E;IAQ1H,YAAY,KAAiC;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;QAHT,iBAAY,GAAG,KAAK,CAAC;QAKzB,IAAI,CAAC,KAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;IAClG,CAAC;IAED,qBAAqB,CAAC,SAAqC,EAAE,SAAkD;QAC3G,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAEhE,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE;YAC9D,SAAS,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC;YACzC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;YAC1B,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,iBAAiB;QACb,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,QAAQ,CAAC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AC,QAAQ,YACpF,OAAO,GACN,IACJ,EACL,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,CACtB,eAAK,SAAS,EAAC,YAAY,aACvB,KAAC,qBAAqB,IAClB,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EACjC,KAAK,EAAC,GAAG,EACT,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAC/C,EACF,KAAC,qBAAqB,IAClB,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EACjC,KAAK,EAAC,GAAG,EACT,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAC/C,IACA,CACT,IACC,CACT,CAAC;IACN,CAAC;;AApGD,gEAAgE;AACzD,iCAAY,GAAG;IAClB,IAAI,EAAE,KAAK,EAAE,KAAK;CACrB,CAAC","sourcesContent":["import * as React from \"react\";\r\nimport type { Vector2 } from \"core/Maths/math.vector\";\r\nimport type { Observable } from \"core/Misc/observable\";\r\n\r\nimport { NumericInputComponent } from \"./numericInputComponent\";\r\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\r\nimport { faMinus, faPlus } from \"@fortawesome/free-solid-svg-icons\";\r\nimport type { PropertyChangedEvent } from \"../propertyChangedEvent\";\r\nimport type { LockObject } from \"../tabs/propertyGrids/lockObject\";\r\n\r\ninterface IVector2LineComponentProps {\r\n label: string;\r\n target: any;\r\n propertyName: string;\r\n step?: number;\r\n onChange?: (newvalue: Vector2) => void;\r\n onPropertyChangedObservable?: Observable<PropertyChangedEvent>;\r\n icon?: string;\r\n iconLabel?: string;\r\n lockObject: LockObject;\r\n}\r\n\r\nexport class Vector2LineComponent extends React.Component<IVector2LineComponentProps, { isExpanded: boolean; value: Vector2 }> {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n static defaultProps = {\r\n step: 0.001, // cm\r\n };\r\n\r\n private _localChange = false;\r\n\r\n constructor(props: IVector2LineComponentProps) {\r\n super(props);\r\n\r\n this.state = { isExpanded: false, value: this.props.target[this.props.propertyName].clone() };\r\n }\r\n\r\n shouldComponentUpdate(nextProps: IVector2LineComponentProps, nextState: { isExpanded: boolean; value: Vector2 }) {\r\n const nextPropsValue = nextProps.target[nextProps.propertyName];\r\n\r\n if (!nextPropsValue.equals(nextState.value) || this._localChange) {\r\n nextState.value = nextPropsValue.clone();\r\n this._localChange = false;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n switchExpandState() {\r\n this._localChange = true;\r\n this.setState({ isExpanded: !this.state.isExpanded });\r\n }\r\n\r\n raiseOnPropertyChanged(previousValue: Vector2) {\r\n if (this.props.onChange) {\r\n this.props.onChange(this.state.value);\r\n }\r\n\r\n if (!this.props.onPropertyChangedObservable) {\r\n return;\r\n }\r\n this.props.onPropertyChangedObservable.notifyObservers({\r\n object: this.props.target,\r\n property: this.props.propertyName,\r\n value: this.state.value,\r\n initialValue: previousValue,\r\n });\r\n }\r\n\r\n updateStateX(value: number) {\r\n this._localChange = true;\r\n\r\n const store = this.state.value.clone();\r\n this.props.target[this.props.propertyName].x = value;\r\n this.state.value.x = value;\r\n this.setState({ value: this.state.value });\r\n\r\n this.raiseOnPropertyChanged(store);\r\n }\r\n\r\n updateStateY(value: number) {\r\n this._localChange = true;\r\n\r\n const store = this.state.value.clone();\r\n this.props.target[this.props.propertyName].y = value;\r\n this.state.value.y = value;\r\n this.setState({ value: this.state.value });\r\n\r\n this.raiseOnPropertyChanged(store);\r\n }\r\n\r\n render() {\r\n const chevron = this.state.isExpanded ? <FontAwesomeIcon icon={faMinus} /> : <FontAwesomeIcon icon={faPlus} />;\r\n\r\n return (\r\n <div className=\"vector3Line\">\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} className=\"icon\" />}\r\n <div className=\"firstLine\" title={this.props.label}>\r\n <div className=\"label\">{this.props.label}</div>\r\n <div className=\"vector\">{`X: ${this.state.value.x.toFixed(2)}, Y: ${this.state.value.y.toFixed(2)}`}</div>\r\n <div className=\"expand hoverIcon\" onClick={() => this.switchExpandState()} title=\"Expand\">\r\n {chevron}\r\n </div>\r\n </div>\r\n {this.state.isExpanded && (\r\n <div className=\"secondLine\">\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"x\"\r\n step={this.props.step}\r\n value={this.state.value.x}\r\n onChange={(value) => this.updateStateX(value)}\r\n />\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"y\"\r\n step={this.props.step}\r\n value={this.state.value.y}\r\n onChange={(value) => this.updateStateY(value)}\r\n />\r\n </div>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"vector2LineComponent.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/lines/vector2LineComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAgBpE,MAAM,OAAO,oBAAqB,SAAQ,KAAK,CAAC,SAA8E;IAQ1H,YAAY,KAAiC;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;QAHT,iBAAY,GAAG,KAAK,CAAC;QAKzB,IAAI,CAAC,KAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAA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AAK,CAAC,GAC/C,IACA,CACT,IACC,CACT,CAAC;IACN,CAAC;;AApGD,gEAAgE;AACzD,iCAAY,GAAG;IAClB,IAAI,EAAE,KAAK,EAAE,KAAK;CACrB,AAFkB,CAEjB","sourcesContent":["import * as React from \"react\";\r\nimport type { Vector2 } from \"core/Maths/math.vector\";\r\nimport type { Observable } from \"core/Misc/observable\";\r\n\r\nimport { NumericInputComponent } from \"./numericInputComponent\";\r\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\r\nimport { faMinus, faPlus } from \"@fortawesome/free-solid-svg-icons\";\r\nimport type { PropertyChangedEvent } from \"../propertyChangedEvent\";\r\nimport type { LockObject } from \"../tabs/propertyGrids/lockObject\";\r\n\r\ninterface IVector2LineComponentProps {\r\n label: string;\r\n target: any;\r\n propertyName: string;\r\n step?: number;\r\n onChange?: (newvalue: Vector2) => void;\r\n onPropertyChangedObservable?: Observable<PropertyChangedEvent>;\r\n icon?: string;\r\n iconLabel?: string;\r\n lockObject: LockObject;\r\n}\r\n\r\nexport class Vector2LineComponent extends React.Component<IVector2LineComponentProps, { isExpanded: boolean; value: Vector2 }> {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n static defaultProps = {\r\n step: 0.001, // cm\r\n };\r\n\r\n private _localChange = false;\r\n\r\n constructor(props: IVector2LineComponentProps) {\r\n super(props);\r\n\r\n this.state = { isExpanded: false, value: this.props.target[this.props.propertyName].clone() };\r\n }\r\n\r\n shouldComponentUpdate(nextProps: IVector2LineComponentProps, nextState: { isExpanded: boolean; value: Vector2 }) {\r\n const nextPropsValue = nextProps.target[nextProps.propertyName];\r\n\r\n if (!nextPropsValue.equals(nextState.value) || this._localChange) {\r\n nextState.value = nextPropsValue.clone();\r\n this._localChange = false;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n switchExpandState() {\r\n this._localChange = true;\r\n this.setState({ isExpanded: !this.state.isExpanded });\r\n }\r\n\r\n raiseOnPropertyChanged(previousValue: Vector2) {\r\n if (this.props.onChange) {\r\n this.props.onChange(this.state.value);\r\n }\r\n\r\n if (!this.props.onPropertyChangedObservable) {\r\n return;\r\n }\r\n this.props.onPropertyChangedObservable.notifyObservers({\r\n object: this.props.target,\r\n property: this.props.propertyName,\r\n value: this.state.value,\r\n initialValue: previousValue,\r\n });\r\n }\r\n\r\n updateStateX(value: number) {\r\n this._localChange = true;\r\n\r\n const store = this.state.value.clone();\r\n this.props.target[this.props.propertyName].x = value;\r\n this.state.value.x = value;\r\n this.setState({ value: this.state.value });\r\n\r\n this.raiseOnPropertyChanged(store);\r\n }\r\n\r\n updateStateY(value: number) {\r\n this._localChange = true;\r\n\r\n const store = this.state.value.clone();\r\n this.props.target[this.props.propertyName].y = value;\r\n this.state.value.y = value;\r\n this.setState({ value: this.state.value });\r\n\r\n this.raiseOnPropertyChanged(store);\r\n }\r\n\r\n render() {\r\n const chevron = this.state.isExpanded ? <FontAwesomeIcon icon={faMinus} /> : <FontAwesomeIcon icon={faPlus} />;\r\n\r\n return (\r\n <div className=\"vector3Line\">\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} className=\"icon\" />}\r\n <div className=\"firstLine\" title={this.props.label}>\r\n <div className=\"label\">{this.props.label}</div>\r\n <div className=\"vector\">{`X: ${this.state.value.x.toFixed(2)}, Y: ${this.state.value.y.toFixed(2)}`}</div>\r\n <div className=\"expand hoverIcon\" onClick={() => this.switchExpandState()} title=\"Expand\">\r\n {chevron}\r\n </div>\r\n </div>\r\n {this.state.isExpanded && (\r\n <div className=\"secondLine\">\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"x\"\r\n step={this.props.step}\r\n value={this.state.value.x}\r\n onChange={(value) => this.updateStateX(value)}\r\n />\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"y\"\r\n step={this.props.step}\r\n value={this.state.value.y}\r\n onChange={(value) => this.updateStateY(value)}\r\n />\r\n </div>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"vector3LineComponent.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/lines/vector3LineComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,sCAAwB;AAiBxC,MAAM,OAAO,oBAAqB,SAAQ,KAAK,CAAC,SAA8E;IAQ1H,YAAY,KAAiC;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;QAHT,iBAAY,GAAG,KAAK,CAAC;QAKzB,IAAI,CAAC,KAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC;IAC9E,CAAC;IAED,eAAe;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACtD,CAAC;IAED,qBAAqB,CAAC,SAAqC,EAAE,SAAkD;QAC3G,MAAM,cAAc,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAE9C,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE;YAC9D,SAAS,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC;YACzC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;YAC1B,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,iBAAiB;QACb,IAAI,CAAC,YAAY,G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,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,GAChE,EACF,KAAC,qBAAqB,IAClB,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EACjC,KAAK,EAAC,GAAG,EACT,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EACrB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAC1C,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,GAChE,IACA,CACT,IACC,CACT,CAAC;IACN,CAAC;;AA1LD,gEAAgE;AACzD,iCAAY,GAAG;IAClB,IAAI,EAAE,KAAK,EAAE,KAAK;CACrB,CAAC","sourcesContent":["import * as React from \"react\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { Observable } from \"core/Misc/observable\";\r\n\r\nimport { NumericInputComponent } from \"../lines/numericInputComponent\";\r\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\r\nimport { faMinus, faPlus } from \"@fortawesome/free-solid-svg-icons\";\r\nimport type { PropertyChangedEvent } from \"../propertyChangedEvent\";\r\nimport { SliderLineComponent } from \"../lines/sliderLineComponent\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport type { LockObject } from \"../tabs/propertyGrids/lockObject\";\r\n\r\ninterface IVector3LineComponentProps {\r\n label: string;\r\n target: any;\r\n propertyName: string;\r\n step?: number;\r\n onChange?: (newvalue: Vector3) => void;\r\n useEuler?: boolean;\r\n onPropertyChangedObservable?: Observable<PropertyChangedEvent>;\r\n noSlider?: boolean;\r\n icon?: string;\r\n iconLabel?: string;\r\n lockObject: LockObject;\r\n}\r\n\r\nexport class Vector3LineComponent extends React.Component<IVector3LineComponentProps, { isExpanded: boolean; value: Vector3 }> {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n static defaultProps = {\r\n step: 0.001, // cm\r\n };\r\n\r\n private _localChange = false;\r\n\r\n constructor(props: IVector3LineComponentProps) {\r\n super(props);\r\n\r\n this.state = { isExpanded: false, value: this.getCurrentValue().clone() };\r\n }\r\n\r\n getCurrentValue() {\r\n return this.props.target[this.props.propertyName];\r\n }\r\n\r\n shouldComponentUpdate(nextProps: IVector3LineComponentProps, nextState: { isExpanded: boolean; value: Vector3 }) {\r\n const nextPropsValue = this.getCurrentValue();\r\n\r\n if (!nextPropsValue.equals(nextState.value) || this._localChange) {\r\n nextState.value = nextPropsValue.clone();\r\n this._localChange = false;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n switchExpandState() {\r\n this._localChange = true;\r\n this.setState({ isExpanded: !this.state.isExpanded });\r\n }\r\n\r\n raiseOnPropertyChanged(previousValue: Vector3) {\r\n if (this.props.onChange) {\r\n this.props.onChange(this.state.value);\r\n }\r\n\r\n if (!this.props.onPropertyChangedObservable) {\r\n return;\r\n }\r\n this.props.onPropertyChangedObservable.notifyObservers({\r\n object: this.props.target,\r\n property: this.props.propertyName,\r\n value: this.state.value,\r\n initialValue: previousValue,\r\n });\r\n }\r\n\r\n updateVector3() {\r\n const store = this.props.target[this.props.propertyName].clone();\r\n this.props.target[this.props.propertyName] = this.state.value;\r\n\r\n this.setState({ value: store });\r\n\r\n this.raiseOnPropertyChanged(store);\r\n }\r\n\r\n updateStateX(value: number) {\r\n this._localChange = true;\r\n\r\n this.state.value.x = value;\r\n this.updateVector3();\r\n }\r\n\r\n updateStateY(value: number) {\r\n this._localChange = true;\r\n\r\n this.state.value.y = value;\r\n this.updateVector3();\r\n }\r\n\r\n updateStateZ(value: number) {\r\n this._localChange = true;\r\n\r\n this.state.value.z = value;\r\n this.updateVector3();\r\n }\r\n\r\n render() {\r\n const chevron = this.state.isExpanded ? <FontAwesomeIcon icon={faMinus} /> : <FontAwesomeIcon icon={faPlus} />;\r\n\r\n return (\r\n <div className=\"vector3Line\">\r\n <div className=\"firstLine\">\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} className=\"icon\" />}\r\n <div className=\"label\" title={this.props.label}>\r\n {this.props.label}\r\n </div>\r\n <div className=\"vector\">\r\n {!this.props.useEuler && `X: ${this.state.value.x.toFixed(2)}, Y: ${this.state.value.y.toFixed(2)}, Z: ${this.state.value.z.toFixed(2)}`}\r\n {this.props.useEuler &&\r\n `X: ${Tools.ToDegrees(this.state.value.x).toFixed(2)}, Y: ${Tools.ToDegrees(this.state.value.y).toFixed(2)}, Z: ${Tools.ToDegrees(\r\n this.state.value.z\r\n ).toFixed(2)}`}\r\n </div>\r\n <div className=\"expand hoverIcon\" onClick={() => this.switchExpandState()} title=\"Expand\">\r\n {chevron}\r\n </div>\r\n </div>\r\n {this.state.isExpanded && !this.props.useEuler && (\r\n <div className=\"secondLine\">\r\n <NumericInputComponent\r\n label=\"x\"\r\n lockObject={this.props.lockObject}\r\n step={this.props.step}\r\n value={this.state.value.x}\r\n onChange={(value) => this.updateStateX(value)}\r\n />\r\n <NumericInputComponent\r\n label=\"y\"\r\n lockObject={this.props.lockObject}\r\n step={this.props.step}\r\n value={this.state.value.y}\r\n onChange={(value) => this.updateStateY(value)}\r\n />\r\n <NumericInputComponent\r\n label=\"z\"\r\n lockObject={this.props.lockObject}\r\n step={this.props.step}\r\n value={this.state.value.z}\r\n onChange={(value) => this.updateStateZ(value)}\r\n />\r\n </div>\r\n )}\r\n {this.state.isExpanded && this.props.useEuler && !this.props.noSlider && (\r\n <div className=\"secondLine\">\r\n <SliderLineComponent\r\n lockObject={this.props.lockObject}\r\n margin={true}\r\n label=\"x\"\r\n minimum={0}\r\n maximum={360}\r\n step={0.1}\r\n directValue={Tools.ToDegrees(this.state.value.x)}\r\n onChange={(value) => this.updateStateX(Tools.ToRadians(value))}\r\n />\r\n <SliderLineComponent\r\n lockObject={this.props.lockObject}\r\n margin={true}\r\n label=\"y\"\r\n minimum={0}\r\n maximum={360}\r\n step={0.1}\r\n directValue={Tools.ToDegrees(this.state.value.y)}\r\n onChange={(value) => this.updateStateY(Tools.ToRadians(value))}\r\n />\r\n <SliderLineComponent\r\n lockObject={this.props.lockObject}\r\n margin={true}\r\n label=\"z\"\r\n minimum={0}\r\n maximum={360}\r\n step={0.1}\r\n directValue={Tools.ToDegrees(this.state.value.z)}\r\n onChange={(value) => this.updateStateZ(Tools.ToRadians(value))}\r\n />\r\n </div>\r\n )}\r\n {this.state.isExpanded && this.props.useEuler && this.props.noSlider && (\r\n <div className=\"secondLine\">\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"x\"\r\n step={this.props.step}\r\n value={Tools.ToDegrees(this.state.value.x)}\r\n onChange={(value) => this.updateStateX(Tools.ToRadians(value))}\r\n />\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"y\"\r\n step={this.props.step}\r\n value={Tools.ToDegrees(this.state.value.y)}\r\n onChange={(value) => this.updateStateY(Tools.ToRadians(value))}\r\n />\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"z\"\r\n step={this.props.step}\r\n value={Tools.ToDegrees(this.state.value.z)}\r\n onChange={(value) => this.updateStateZ(Tools.ToRadians(value))}\r\n />\r\n </div>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"vector3LineComponent.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/lines/vector3LineComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,sCAAwB;AAiBxC,MAAM,OAAO,o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,iCAAY,GAAG;IAClB,IAAI,EAAE,KAAK,EAAE,KAAK;CACrB,AAFkB,CAEjB","sourcesContent":["import * as React from \"react\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { Observable } from \"core/Misc/observable\";\r\n\r\nimport { NumericInputComponent } from \"../lines/numericInputComponent\";\r\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\r\nimport { faMinus, faPlus } from \"@fortawesome/free-solid-svg-icons\";\r\nimport type { PropertyChangedEvent } from \"../propertyChangedEvent\";\r\nimport { SliderLineComponent } from \"../lines/sliderLineComponent\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport type { LockObject } from \"../tabs/propertyGrids/lockObject\";\r\n\r\ninterface IVector3LineComponentProps {\r\n label: string;\r\n target: any;\r\n propertyName: string;\r\n step?: number;\r\n onChange?: (newvalue: Vector3) => void;\r\n useEuler?: boolean;\r\n onPropertyChangedObservable?: Observable<PropertyChangedEvent>;\r\n noSlider?: boolean;\r\n icon?: string;\r\n iconLabel?: string;\r\n lockObject: LockObject;\r\n}\r\n\r\nexport class Vector3LineComponent extends React.Component<IVector3LineComponentProps, { isExpanded: boolean; value: Vector3 }> {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n static defaultProps = {\r\n step: 0.001, // cm\r\n };\r\n\r\n private _localChange = false;\r\n\r\n constructor(props: IVector3LineComponentProps) {\r\n super(props);\r\n\r\n this.state = { isExpanded: false, value: this.getCurrentValue().clone() };\r\n }\r\n\r\n getCurrentValue() {\r\n return this.props.target[this.props.propertyName];\r\n }\r\n\r\n shouldComponentUpdate(nextProps: IVector3LineComponentProps, nextState: { isExpanded: boolean; value: Vector3 }) {\r\n const nextPropsValue = this.getCurrentValue();\r\n\r\n if (!nextPropsValue.equals(nextState.value) || this._localChange) {\r\n nextState.value = nextPropsValue.clone();\r\n this._localChange = false;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n switchExpandState() {\r\n this._localChange = true;\r\n this.setState({ isExpanded: !this.state.isExpanded });\r\n }\r\n\r\n raiseOnPropertyChanged(previousValue: Vector3) {\r\n if (this.props.onChange) {\r\n this.props.onChange(this.state.value);\r\n }\r\n\r\n if (!this.props.onPropertyChangedObservable) {\r\n return;\r\n }\r\n this.props.onPropertyChangedObservable.notifyObservers({\r\n object: this.props.target,\r\n property: this.props.propertyName,\r\n value: this.state.value,\r\n initialValue: previousValue,\r\n });\r\n }\r\n\r\n updateVector3() {\r\n const store = this.props.target[this.props.propertyName].clone();\r\n this.props.target[this.props.propertyName] = this.state.value;\r\n\r\n this.setState({ value: store });\r\n\r\n this.raiseOnPropertyChanged(store);\r\n }\r\n\r\n updateStateX(value: number) {\r\n this._localChange = true;\r\n\r\n this.state.value.x = value;\r\n this.updateVector3();\r\n }\r\n\r\n updateStateY(value: number) {\r\n this._localChange = true;\r\n\r\n this.state.value.y = value;\r\n this.updateVector3();\r\n }\r\n\r\n updateStateZ(value: number) {\r\n this._localChange = true;\r\n\r\n this.state.value.z = value;\r\n this.updateVector3();\r\n }\r\n\r\n render() {\r\n const chevron = this.state.isExpanded ? <FontAwesomeIcon icon={faMinus} /> : <FontAwesomeIcon icon={faPlus} />;\r\n\r\n return (\r\n <div className=\"vector3Line\">\r\n <div className=\"firstLine\">\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} className=\"icon\" />}\r\n <div className=\"label\" title={this.props.label}>\r\n {this.props.label}\r\n </div>\r\n <div className=\"vector\">\r\n {!this.props.useEuler && `X: ${this.state.value.x.toFixed(2)}, Y: ${this.state.value.y.toFixed(2)}, Z: ${this.state.value.z.toFixed(2)}`}\r\n {this.props.useEuler &&\r\n `X: ${Tools.ToDegrees(this.state.value.x).toFixed(2)}, Y: ${Tools.ToDegrees(this.state.value.y).toFixed(2)}, Z: ${Tools.ToDegrees(\r\n this.state.value.z\r\n ).toFixed(2)}`}\r\n </div>\r\n <div className=\"expand hoverIcon\" onClick={() => this.switchExpandState()} title=\"Expand\">\r\n {chevron}\r\n </div>\r\n </div>\r\n {this.state.isExpanded && !this.props.useEuler && (\r\n <div className=\"secondLine\">\r\n <NumericInputComponent\r\n label=\"x\"\r\n lockObject={this.props.lockObject}\r\n step={this.props.step}\r\n value={this.state.value.x}\r\n onChange={(value) => this.updateStateX(value)}\r\n />\r\n <NumericInputComponent\r\n label=\"y\"\r\n lockObject={this.props.lockObject}\r\n step={this.props.step}\r\n value={this.state.value.y}\r\n onChange={(value) => this.updateStateY(value)}\r\n />\r\n <NumericInputComponent\r\n label=\"z\"\r\n lockObject={this.props.lockObject}\r\n step={this.props.step}\r\n value={this.state.value.z}\r\n onChange={(value) => this.updateStateZ(value)}\r\n />\r\n </div>\r\n )}\r\n {this.state.isExpanded && this.props.useEuler && !this.props.noSlider && (\r\n <div className=\"secondLine\">\r\n <SliderLineComponent\r\n lockObject={this.props.lockObject}\r\n margin={true}\r\n label=\"x\"\r\n minimum={0}\r\n maximum={360}\r\n step={0.1}\r\n directValue={Tools.ToDegrees(this.state.value.x)}\r\n onChange={(value) => this.updateStateX(Tools.ToRadians(value))}\r\n />\r\n <SliderLineComponent\r\n lockObject={this.props.lockObject}\r\n margin={true}\r\n label=\"y\"\r\n minimum={0}\r\n maximum={360}\r\n step={0.1}\r\n directValue={Tools.ToDegrees(this.state.value.y)}\r\n onChange={(value) => this.updateStateY(Tools.ToRadians(value))}\r\n />\r\n <SliderLineComponent\r\n lockObject={this.props.lockObject}\r\n margin={true}\r\n label=\"z\"\r\n minimum={0}\r\n maximum={360}\r\n step={0.1}\r\n directValue={Tools.ToDegrees(this.state.value.z)}\r\n onChange={(value) => this.updateStateZ(Tools.ToRadians(value))}\r\n />\r\n </div>\r\n )}\r\n {this.state.isExpanded && this.props.useEuler && this.props.noSlider && (\r\n <div className=\"secondLine\">\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"x\"\r\n step={this.props.step}\r\n value={Tools.ToDegrees(this.state.value.x)}\r\n onChange={(value) => this.updateStateX(Tools.ToRadians(value))}\r\n />\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"y\"\r\n step={this.props.step}\r\n value={Tools.ToDegrees(this.state.value.y)}\r\n onChange={(value) => this.updateStateY(Tools.ToRadians(value))}\r\n />\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"z\"\r\n step={this.props.step}\r\n value={Tools.ToDegrees(this.state.value.z)}\r\n onChange={(value) => this.updateStateZ(Tools.ToRadians(value))}\r\n />\r\n </div>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"vector4LineComponent.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/lines/vector4LineComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAkBpE,MAAM,OAAO,oBAAqB,SAAQ,KAAK,CAAC,SAA8E;IAQ1H,YAAY,KAAiC;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;QAHT,iBAAY,GAAG,KAAK,CAAC;QAKzB,IAAI,CAAC,KAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC;IAC9E,CAAC;IAED,eAAe;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,YAAa,CAAC,CAAC;IAC3E,CAAC;IAED,qBAAqB,CAAC,SAAqC,EAAE,SAAkD;QAC3G,MAAM,cAAc,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAE9C,IAAI,CAAC,cA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AAC,KAAK,CAAC,IAAI,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAC/C,EACF,KAAC,qBAAqB,IAClB,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EACjC,KAAK,EAAC,GAAG,EACT,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAC/C,EACF,KAAC,qBAAqB,IAClB,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EACjC,KAAK,EAAC,GAAG,EACT,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAC/C,IACA,IAER,CACT,CAAC;IACN,CAAC;;AA9ID,gEAAgE;AACzD,iCAAY,GAAG;IAClB,IAAI,EAAE,KAAK,EAAE,KAAK;CACrB,CAAC","sourcesContent":["import * as React from \"react\";\r\nimport type { Vector4 } from \"core/Maths/math.vector\";\r\nimport type { Observable } from \"core/Misc/observable\";\r\n\r\nimport { NumericInputComponent } from \"./numericInputComponent\";\r\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\r\nimport { faMinus, faPlus } from \"@fortawesome/free-solid-svg-icons\";\r\nimport type { PropertyChangedEvent } from \"../propertyChangedEvent\";\r\nimport type { LockObject } from \"../tabs/propertyGrids/lockObject\";\r\n\r\ninterface IVector4LineComponentProps {\r\n label: string;\r\n target?: any;\r\n propertyName?: string;\r\n step?: number;\r\n onChange?: (newvalue: Vector4) => void;\r\n useEuler?: boolean;\r\n onPropertyChangedObservable?: Observable<PropertyChangedEvent>;\r\n icon?: string;\r\n iconLabel?: string;\r\n value?: Vector4;\r\n lockObject: LockObject;\r\n}\r\n\r\nexport class Vector4LineComponent extends React.Component<IVector4LineComponentProps, { isExpanded: boolean; value: Vector4 }> {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n static defaultProps = {\r\n step: 0.001, // cm\r\n };\r\n\r\n private _localChange = false;\r\n\r\n constructor(props: IVector4LineComponentProps) {\r\n super(props);\r\n\r\n this.state = { isExpanded: false, value: this.getCurrentValue().clone() };\r\n }\r\n\r\n getCurrentValue() {\r\n return this.props.value || this.props.target[this.props.propertyName!];\r\n }\r\n\r\n shouldComponentUpdate(nextProps: IVector4LineComponentProps, nextState: { isExpanded: boolean; value: Vector4 }) {\r\n const nextPropsValue = this.getCurrentValue();\r\n\r\n if (!nextPropsValue.equals(nextState.value) || this._localChange) {\r\n nextState.value = nextPropsValue.clone();\r\n this._localChange = false;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n switchExpandState() {\r\n this._localChange = true;\r\n this.setState({ isExpanded: !this.state.isExpanded });\r\n }\r\n\r\n raiseOnPropertyChanged(previousValue: Vector4) {\r\n if (this.props.onChange) {\r\n this.props.onChange(this.state.value);\r\n }\r\n\r\n if (!this.props.onPropertyChangedObservable) {\r\n return;\r\n }\r\n this.props.onPropertyChangedObservable.notifyObservers({\r\n object: this.props.target,\r\n property: this.props.propertyName || \"\",\r\n value: this.state.value,\r\n initialValue: previousValue,\r\n });\r\n }\r\n\r\n updateVector4() {\r\n const store = this.getCurrentValue().clone();\r\n\r\n if (this.props.value) {\r\n this.props.value.copyFrom(this.state.value);\r\n } else {\r\n this.props.target[this.props.propertyName!] = this.state.value;\r\n }\r\n\r\n this.setState({ value: store });\r\n\r\n this.raiseOnPropertyChanged(store);\r\n }\r\n\r\n updateStateX(value: number) {\r\n this._localChange = true;\r\n\r\n this.state.value.x = value;\r\n this.updateVector4();\r\n }\r\n\r\n updateStateY(value: number) {\r\n this._localChange = true;\r\n\r\n this.state.value.y = value;\r\n this.updateVector4();\r\n }\r\n\r\n updateStateZ(value: number) {\r\n this._localChange = true;\r\n\r\n this.state.value.z = value;\r\n this.updateVector4();\r\n }\r\n\r\n updateStateW(value: number) {\r\n this._localChange = true;\r\n\r\n this.state.value.w = value;\r\n this.updateVector4();\r\n }\r\n\r\n render() {\r\n const chevron = this.state.isExpanded ? <FontAwesomeIcon icon={faMinus} /> : <FontAwesomeIcon icon={faPlus} />;\r\n\r\n return (\r\n <div className=\"vector3Line\">\r\n <div className=\"firstLine\">\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} className=\"icon\" />}\r\n <div className=\"label\" title={this.props.label}>\r\n {this.props.label}\r\n </div>\r\n <div className=\"vector\">\r\n {`X: ${this.state.value.x.toFixed(2)}, Y: ${this.state.value.y.toFixed(2)}, Z: ${this.state.value.z.toFixed(2)}, W: ${this.state.value.w.toFixed(2)}`}\r\n </div>\r\n <div className=\"expand hoverIcon\" onClick={() => this.switchExpandState()} title=\"Expand\">\r\n {chevron}\r\n </div>\r\n </div>\r\n {\r\n <div className=\"secondLine\">\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"x\"\r\n step={this.props.step}\r\n value={this.state.value.x}\r\n onChange={(value) => this.updateStateX(value)}\r\n />\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"y\"\r\n step={this.props.step}\r\n value={this.state.value.y}\r\n onChange={(value) => this.updateStateY(value)}\r\n />\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"z\"\r\n step={this.props.step}\r\n value={this.state.value.z}\r\n onChange={(value) => this.updateStateZ(value)}\r\n />\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"w\"\r\n step={this.props.step}\r\n value={this.state.value.w}\r\n onChange={(value) => this.updateStateW(value)}\r\n />\r\n </div>\r\n }\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"vector4LineComponent.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/lines/vector4LineComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAkBpE,MAAM,OAAO,oBAAqB,SAAQ,KAAK,CAAC,SAA8E;IAQ1H,YAAY,KAAiC;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;QAHT,iBAAY,GAAG,KAAK,CAAC;QAKzB,IAAI,CAAC,KAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC;IAC9E,CAAC;IAED,eAAe;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,YAAa,CAAC,CAAC;IAC3E,CAAC;IAED,qBAAqB,CAAC,SAAqC,EAAE,SAAkD;QAC3G,MAAM,cAAc,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAE9C,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE;YAC9D,SAAS,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC;YACzC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;YAC1B,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,iBAAiB;QACb,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC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AAK,CAAC,IAAI,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAC/C,EACF,KAAC,qBAAqB,IAClB,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EACjC,KAAK,EAAC,GAAG,EACT,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAC/C,IACA,IAER,CACT,CAAC;IACN,CAAC;;AA9ID,gEAAgE;AACzD,iCAAY,GAAG;IAClB,IAAI,EAAE,KAAK,EAAE,KAAK;CACrB,AAFkB,CAEjB","sourcesContent":["import * as React from \"react\";\r\nimport type { Vector4 } from \"core/Maths/math.vector\";\r\nimport type { Observable } from \"core/Misc/observable\";\r\n\r\nimport { NumericInputComponent } from \"./numericInputComponent\";\r\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\r\nimport { faMinus, faPlus } from \"@fortawesome/free-solid-svg-icons\";\r\nimport type { PropertyChangedEvent } from \"../propertyChangedEvent\";\r\nimport type { LockObject } from \"../tabs/propertyGrids/lockObject\";\r\n\r\ninterface IVector4LineComponentProps {\r\n label: string;\r\n target?: any;\r\n propertyName?: string;\r\n step?: number;\r\n onChange?: (newvalue: Vector4) => void;\r\n useEuler?: boolean;\r\n onPropertyChangedObservable?: Observable<PropertyChangedEvent>;\r\n icon?: string;\r\n iconLabel?: string;\r\n value?: Vector4;\r\n lockObject: LockObject;\r\n}\r\n\r\nexport class Vector4LineComponent extends React.Component<IVector4LineComponentProps, { isExpanded: boolean; value: Vector4 }> {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n static defaultProps = {\r\n step: 0.001, // cm\r\n };\r\n\r\n private _localChange = false;\r\n\r\n constructor(props: IVector4LineComponentProps) {\r\n super(props);\r\n\r\n this.state = { isExpanded: false, value: this.getCurrentValue().clone() };\r\n }\r\n\r\n getCurrentValue() {\r\n return this.props.value || this.props.target[this.props.propertyName!];\r\n }\r\n\r\n shouldComponentUpdate(nextProps: IVector4LineComponentProps, nextState: { isExpanded: boolean; value: Vector4 }) {\r\n const nextPropsValue = this.getCurrentValue();\r\n\r\n if (!nextPropsValue.equals(nextState.value) || this._localChange) {\r\n nextState.value = nextPropsValue.clone();\r\n this._localChange = false;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n switchExpandState() {\r\n this._localChange = true;\r\n this.setState({ isExpanded: !this.state.isExpanded });\r\n }\r\n\r\n raiseOnPropertyChanged(previousValue: Vector4) {\r\n if (this.props.onChange) {\r\n this.props.onChange(this.state.value);\r\n }\r\n\r\n if (!this.props.onPropertyChangedObservable) {\r\n return;\r\n }\r\n this.props.onPropertyChangedObservable.notifyObservers({\r\n object: this.props.target,\r\n property: this.props.propertyName || \"\",\r\n value: this.state.value,\r\n initialValue: previousValue,\r\n });\r\n }\r\n\r\n updateVector4() {\r\n const store = this.getCurrentValue().clone();\r\n\r\n if (this.props.value) {\r\n this.props.value.copyFrom(this.state.value);\r\n } else {\r\n this.props.target[this.props.propertyName!] = this.state.value;\r\n }\r\n\r\n this.setState({ value: store });\r\n\r\n this.raiseOnPropertyChanged(store);\r\n }\r\n\r\n updateStateX(value: number) {\r\n this._localChange = true;\r\n\r\n this.state.value.x = value;\r\n this.updateVector4();\r\n }\r\n\r\n updateStateY(value: number) {\r\n this._localChange = true;\r\n\r\n this.state.value.y = value;\r\n this.updateVector4();\r\n }\r\n\r\n updateStateZ(value: number) {\r\n this._localChange = true;\r\n\r\n this.state.value.z = value;\r\n this.updateVector4();\r\n }\r\n\r\n updateStateW(value: number) {\r\n this._localChange = true;\r\n\r\n this.state.value.w = value;\r\n this.updateVector4();\r\n }\r\n\r\n render() {\r\n const chevron = this.state.isExpanded ? <FontAwesomeIcon icon={faMinus} /> : <FontAwesomeIcon icon={faPlus} />;\r\n\r\n return (\r\n <div className=\"vector3Line\">\r\n <div className=\"firstLine\">\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} className=\"icon\" />}\r\n <div className=\"label\" title={this.props.label}>\r\n {this.props.label}\r\n </div>\r\n <div className=\"vector\">\r\n {`X: ${this.state.value.x.toFixed(2)}, Y: ${this.state.value.y.toFixed(2)}, Z: ${this.state.value.z.toFixed(2)}, W: ${this.state.value.w.toFixed(2)}`}\r\n </div>\r\n <div className=\"expand hoverIcon\" onClick={() => this.switchExpandState()} title=\"Expand\">\r\n {chevron}\r\n </div>\r\n </div>\r\n {\r\n <div className=\"secondLine\">\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"x\"\r\n step={this.props.step}\r\n value={this.state.value.x}\r\n onChange={(value) => this.updateStateX(value)}\r\n />\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"y\"\r\n step={this.props.step}\r\n value={this.state.value.y}\r\n onChange={(value) => this.updateStateY(value)}\r\n />\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"z\"\r\n step={this.props.step}\r\n value={this.state.value.z}\r\n onChange={(value) => this.updateStateZ(value)}\r\n />\r\n <NumericInputComponent\r\n lockObject={this.props.lockObject}\r\n label=\"w\"\r\n step={this.props.step}\r\n value={this.state.value.w}\r\n onChange={(value) => this.updateStateW(value)}\r\n />\r\n </div>\r\n }\r\n </div>\r\n );\r\n }\r\n}\r\n"]}