@babylonjs/inspector 5.24.0 → 5.26.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.
@@ -69177,7 +69177,7 @@ void main(void)
69177
69177
  }
69178
69178
  }`;
69179
69179
  core_Materials_effect__WEBPACK_IMPORTED_MODULE_0__.Effect.ShadersStore[name] = shader;
69180
- /** @hidden */
69180
+ /** @internal */
69181
69181
  // eslint-disable-next-line no-var
69182
69182
  var lodPixelShader = { name, shader };
69183
69183
 
@@ -69234,7 +69234,7 @@ void main(void)
69234
69234
  }
69235
69235
  }`;
69236
69236
  core_Materials_effect__WEBPACK_IMPORTED_MODULE_0__.Effect.ShadersStore[name] = shader;
69237
- /** @hidden */
69237
+ /** @internal */
69238
69238
  // eslint-disable-next-line no-var
69239
69239
  var lodCubePixelShader = { name, shader };
69240
69240
 
@@ -70976,11 +70976,13 @@ __webpack_require__.r(__webpack_exports__);
70976
70976
 
70977
70977
  // eslint-disable-next-line @typescript-eslint/naming-convention
70978
70978
  const Null_Value = Number.MAX_SAFE_INTEGER;
70979
+ const DEFAULT_FALLBACK_VALUE = -1;
70979
70980
  class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
70980
70981
  constructor(props) {
70982
+ // Initialize default props
70981
70983
  super(props);
70982
70984
  this._localChange = false;
70983
- this.state = { value: this._remapValueIn(this._getValue(props)) };
70985
+ this.state = { value: this._remapValueIn(this._getValue(props)), addCustom: false };
70984
70986
  }
70985
70987
  _remapValueIn(value) {
70986
70988
  return this.props.allowNullValue && value === null ? Null_Value : value;
@@ -70999,11 +71001,14 @@ class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
70999
71001
  this._localChange = false;
71000
71002
  return true;
71001
71003
  }
71002
- const newValue = this._remapValueIn(nextProps.extractValue ? nextProps.extractValue(this.props.target) : nextProps.target[nextProps.propertyName]);
71004
+ const newValue = this._remapValueIn(nextProps.extractValue ? nextProps.extractValue(nextProps.target) : nextProps.target[nextProps.propertyName]);
71003
71005
  if (newValue != null && newValue !== nextState.value) {
71004
71006
  nextState.value = newValue;
71005
71007
  return true;
71006
71008
  }
71009
+ if (this.props.options !== nextProps.options) {
71010
+ return true;
71011
+ }
71007
71012
  return false;
71008
71013
  }
71009
71014
  raiseOnPropertyChanged(newValue, previousValue) {
@@ -71022,23 +71027,65 @@ class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
71022
71027
  this.setState({ value: value });
71023
71028
  }
71024
71029
  updateValue(valueString) {
71025
- const value = this.props.valuesAreStrings ? valueString : parseInt(valueString);
71030
+ let value = this.props.valuesAreStrings ? valueString : parseInt(valueString);
71031
+ if (isNaN(Number(value))) {
71032
+ for (let i = 0; i < this.props.options.length; i++) {
71033
+ if (this.props.options.at(i)?.label === valueString) {
71034
+ value = Number(this.props.options.at(i)?.value);
71035
+ }
71036
+ }
71037
+ }
71038
+ if (value === 0 && this.props.fromFontDropdown) {
71039
+ this.setState({ addCustom: true });
71040
+ }
71026
71041
  this._localChange = true;
71027
71042
  const store = this.props.extractValue ? this.props.extractValue(this.props.target) : this.props.target[this.props.propertyName];
71028
71043
  if (!this.props.noDirectUpdate) {
71029
71044
  this.props.target[this.props.propertyName] = this._remapValueOut(value);
71030
71045
  }
71031
- this.setState({ value: value });
71032
- if (this.props.onSelect) {
71033
- this.props.onSelect(value);
71046
+ //selecting a regular option from font dropdown
71047
+ if (value != 0 && this.props.fromFontDropdown) {
71048
+ this.setState({ value: value });
71049
+ if (this.props.onSelect) {
71050
+ this.props.onSelect(value);
71051
+ }
71052
+ //selecting 'custom font' from font dropdown
71053
+ }
71054
+ else if (this.props.fromFontDropdown) {
71055
+ if (this.props.onSelect) {
71056
+ this.props.onSelect(this.state.value);
71057
+ }
71058
+ }
71059
+ //selecting from a dropdown that's not font dropdown
71060
+ else {
71061
+ this.setState({ value: value });
71062
+ if (this.props.onSelect) {
71063
+ this.props.onSelect(value);
71064
+ }
71034
71065
  }
71035
71066
  const newValue = this.props.extractValue ? this.props.extractValue(this.props.target) : this.props.target[this.props.propertyName];
71036
71067
  this.raiseOnPropertyChanged(newValue, store);
71037
71068
  }
71069
+ updateCustomValue() {
71070
+ this.setState({ addCustom: false });
71071
+ }
71038
71072
  render() {
71039
- return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { className: "listLine" + (this.props.className ? " " + this.props.className : ""), children: [this.props.icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, color: "black", className: "icon" }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { className: "label", title: this.props.label, children: this.props.label }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { className: "options", children: (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("select", { onChange: (evt) => this.updateValue(evt.target.value), value: this.state.value ?? "", children: this.props.options.map((option, i) => {
71073
+ const fallback = this.props.fallbackValue !== undefined ? this.props.fallbackValue : DEFAULT_FALLBACK_VALUE;
71074
+ return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", { className: `listLine ${this.props.className ?? ""}`, children: [this.props.icon && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, color: "black", className: "icon" }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { className: "label", title: this.props.label, children: this.props.label }), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { className: "options", children: this.state.addCustom ? ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input", { type: "text", placeholder: "Enter a custom font here", onKeyDown: (event) => {
71075
+ event.key === "Enter" && this.props.addVal != undefined
71076
+ ? (this.props.addVal({ label: event.target.value, value: this.props.options.length + 1 }, Number(this.state.value)),
71077
+ this.updateCustomValue(),
71078
+ this.forceUpdate())
71079
+ : null;
71080
+ }, onBlur: (event) => {
71081
+ this.props.addVal != undefined
71082
+ ? (this.props.addVal({ label: event.target.value, value: this.props.options.length + 1 }, Number(this.state.value)),
71083
+ this.updateCustomValue(),
71084
+ this.forceUpdate())
71085
+ : null;
71086
+ } })) : ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("select", { onChange: (evt) => this.updateValue(evt.target.value), value: this.state.value === null || this.state.value === undefined ? fallback : this.state.value, children: this.props.options.map((option, i) => {
71040
71087
  return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("option", { selected: option.selected, value: option.value, title: option.label, children: option.label }, option.label + i));
71041
- }) }) })] }));
71088
+ }) })) })] }));
71042
71089
  }
71043
71090
  }
71044
71091