@babylonjs/node-editor 5.31.1 → 5.32.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.
@@ -63131,13 +63131,11 @@ __webpack_require__.r(__webpack_exports__);
63131
63131
 
63132
63132
  // eslint-disable-next-line @typescript-eslint/naming-convention
63133
63133
  const Null_Value = Number.MAX_SAFE_INTEGER;
63134
- const DEFAULT_FALLBACK_VALUE = -1;
63135
63134
  class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
63136
63135
  constructor(props) {
63137
- // Initialize default props
63138
63136
  super(props);
63139
63137
  this._localChange = false;
63140
- this.state = { value: this._remapValueIn(this._getValue(props)), addCustom: false };
63138
+ this.state = { value: this._remapValueIn(this._getValue(props)) };
63141
63139
  }
63142
63140
  _remapValueIn(value) {
63143
63141
  return this.props.allowNullValue && value === null ? Null_Value : value;
@@ -63156,14 +63154,11 @@ class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
63156
63154
  this._localChange = false;
63157
63155
  return true;
63158
63156
  }
63159
- const newValue = this._remapValueIn(nextProps.extractValue ? nextProps.extractValue(nextProps.target) : nextProps.target[nextProps.propertyName]);
63157
+ const newValue = this._remapValueIn(nextProps.extractValue ? nextProps.extractValue(this.props.target) : nextProps.target[nextProps.propertyName]);
63160
63158
  if (newValue != null && newValue !== nextState.value) {
63161
63159
  nextState.value = newValue;
63162
63160
  return true;
63163
63161
  }
63164
- if (this.props.options !== nextProps.options) {
63165
- return true;
63166
- }
63167
63162
  return false;
63168
63163
  }
63169
63164
  raiseOnPropertyChanged(newValue, previousValue) {
@@ -63182,65 +63177,23 @@ class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
63182
63177
  this.setState({ value: value });
63183
63178
  }
63184
63179
  updateValue(valueString) {
63185
- let value = this.props.valuesAreStrings ? valueString : parseInt(valueString);
63186
- if (isNaN(Number(value))) {
63187
- for (let i = 0; i < this.props.options.length; i++) {
63188
- if (this.props.options.at(i)?.label === valueString) {
63189
- value = Number(this.props.options.at(i)?.value);
63190
- }
63191
- }
63192
- }
63193
- if (value === 0 && this.props.fromFontDropdown) {
63194
- this.setState({ addCustom: true });
63195
- }
63180
+ const value = this.props.valuesAreStrings ? valueString : parseInt(valueString);
63196
63181
  this._localChange = true;
63197
63182
  const store = this.props.extractValue ? this.props.extractValue(this.props.target) : this.props.target[this.props.propertyName];
63198
63183
  if (!this.props.noDirectUpdate) {
63199
63184
  this.props.target[this.props.propertyName] = this._remapValueOut(value);
63200
63185
  }
63201
- //selecting a regular option from font dropdown
63202
- if (value != 0 && this.props.fromFontDropdown) {
63203
- this.setState({ value: value });
63204
- if (this.props.onSelect) {
63205
- this.props.onSelect(value);
63206
- }
63207
- //selecting 'custom font' from font dropdown
63208
- }
63209
- else if (this.props.fromFontDropdown) {
63210
- if (this.props.onSelect) {
63211
- this.props.onSelect(this.state.value);
63212
- }
63213
- }
63214
- //selecting from a dropdown that's not font dropdown
63215
- else {
63216
- this.setState({ value: value });
63217
- if (this.props.onSelect) {
63218
- this.props.onSelect(value);
63219
- }
63186
+ this.setState({ value: value });
63187
+ if (this.props.onSelect) {
63188
+ this.props.onSelect(value);
63220
63189
  }
63221
63190
  const newValue = this.props.extractValue ? this.props.extractValue(this.props.target) : this.props.target[this.props.propertyName];
63222
63191
  this.raiseOnPropertyChanged(newValue, store);
63223
63192
  }
63224
- updateCustomValue() {
63225
- this.setState({ addCustom: false });
63226
- }
63227
63193
  render() {
63228
- const fallback = this.props.fallbackValue !== undefined ? this.props.fallbackValue : DEFAULT_FALLBACK_VALUE;
63229
- 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) => {
63230
- event.key === "Enter" && this.props.addVal != undefined
63231
- ? (this.props.addVal({ label: event.target.value, value: this.props.options.length + 1 }, Number(this.state.value)),
63232
- this.updateCustomValue(),
63233
- this.forceUpdate())
63234
- : null;
63235
- }, onBlur: (event) => {
63236
- this.props.addVal != undefined
63237
- ? (this.props.addVal({ label: event.target.value, value: this.props.options.length + 1 }, Number(this.state.value)),
63238
- this.updateCustomValue(),
63239
- this.forceUpdate())
63240
- : null;
63241
- } })) : ((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) => {
63194
+ 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) => {
63242
63195
  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));
63243
- }) })) })] }));
63196
+ }) }) })] }));
63244
63197
  }
63245
63198
  }
63246
63199
 
@@ -65195,7 +65148,7 @@ __webpack_require__.r(__webpack_exports__);
65195
65148
  /* harmony import */ var _stringTools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../stringTools */ "../../../dev/sharedUiComponents/dist/stringTools.js");
65196
65149
  /* harmony import */ var _graphFrame_modules_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./graphFrame.modules.scss */ "../../../dev/sharedUiComponents/dist/nodeGraphSystem/graphFrame.modules.scss");
65197
65150
  /* harmony import */ var _common_modules_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./common.modules.scss */ "../../../dev/sharedUiComponents/dist/nodeGraphSystem/common.modules.scss");
65198
- /* harmony import */ var shared_ui_components_components_classNames__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! shared-ui-components/components/classNames */ "../../../dev/sharedUiComponents/dist/components/classNames.js");
65151
+ /* harmony import */ var _components_classNames__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/classNames */ "../../../dev/sharedUiComponents/dist/components/classNames.js");
65199
65152
 
65200
65153
 
65201
65154
 
@@ -65666,19 +65619,19 @@ class GraphFrame {
65666
65619
  this.element.appendChild(topHandle);
65667
65620
  topHandle.addEventListener("pointerdown", this._onTopHandlePointerDown);
65668
65621
  const topRightCornerHandle = root.ownerDocument.createElement("div");
65669
- topRightCornerHandle.className = (0,shared_ui_components_components_classNames__WEBPACK_IMPORTED_MODULE_5__.ClassNames)({ "right-handle": true, "top-right-corner-handle": true }, _graphFrame_modules_scss__WEBPACK_IMPORTED_MODULE_3__["default"]);
65622
+ topRightCornerHandle.className = (0,_components_classNames__WEBPACK_IMPORTED_MODULE_5__.ClassNames)({ "right-handle": true, "top-right-corner-handle": true }, _graphFrame_modules_scss__WEBPACK_IMPORTED_MODULE_3__["default"]);
65670
65623
  this.element.appendChild(topRightCornerHandle);
65671
65624
  topRightCornerHandle.addEventListener("pointerdown", this._onTopRightHandlePointerDown);
65672
65625
  const bottomRightCornerHandle = root.ownerDocument.createElement("div");
65673
- bottomRightCornerHandle.className = (0,shared_ui_components_components_classNames__WEBPACK_IMPORTED_MODULE_5__.ClassNames)({ "right-handle": true, "bottom-right-corner-handle": true }, _graphFrame_modules_scss__WEBPACK_IMPORTED_MODULE_3__["default"]);
65626
+ bottomRightCornerHandle.className = (0,_components_classNames__WEBPACK_IMPORTED_MODULE_5__.ClassNames)({ "right-handle": true, "bottom-right-corner-handle": true }, _graphFrame_modules_scss__WEBPACK_IMPORTED_MODULE_3__["default"]);
65674
65627
  this.element.appendChild(bottomRightCornerHandle);
65675
65628
  bottomRightCornerHandle.addEventListener("pointerdown", this._onBottomRightHandlePointerDown);
65676
65629
  const topLeftCornerHandle = root.ownerDocument.createElement("div");
65677
- topLeftCornerHandle.className = (0,shared_ui_components_components_classNames__WEBPACK_IMPORTED_MODULE_5__.ClassNames)({ "left-handle": true, "top-left-corner-handle": true }, _graphFrame_modules_scss__WEBPACK_IMPORTED_MODULE_3__["default"]);
65630
+ topLeftCornerHandle.className = (0,_components_classNames__WEBPACK_IMPORTED_MODULE_5__.ClassNames)({ "left-handle": true, "top-left-corner-handle": true }, _graphFrame_modules_scss__WEBPACK_IMPORTED_MODULE_3__["default"]);
65678
65631
  this.element.appendChild(topLeftCornerHandle);
65679
65632
  topLeftCornerHandle.addEventListener("pointerdown", this._onTopLeftHandlePointerDown);
65680
65633
  const bottomLeftCornerHandle = root.ownerDocument.createElement("div");
65681
- bottomLeftCornerHandle.className = (0,shared_ui_components_components_classNames__WEBPACK_IMPORTED_MODULE_5__.ClassNames)({ "left-handle": true, "bottom-left-corner-handle": true }, _graphFrame_modules_scss__WEBPACK_IMPORTED_MODULE_3__["default"]);
65634
+ bottomLeftCornerHandle.className = (0,_components_classNames__WEBPACK_IMPORTED_MODULE_5__.ClassNames)({ "left-handle": true, "bottom-left-corner-handle": true }, _graphFrame_modules_scss__WEBPACK_IMPORTED_MODULE_3__["default"]);
65682
65635
  this.element.appendChild(bottomLeftCornerHandle);
65683
65636
  bottomLeftCornerHandle.addEventListener("pointerdown", this._onBottomLeftHandlePointerDown);
65684
65637
  // add header elements
@@ -72091,34 +72044,34 @@ class GenericPropertyTabComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Com
72091
72044
  }
72092
72045
  switch (type) {
72093
72046
  case core_Materials_Node_nodeMaterialDecorator__WEBPACK_IMPORTED_MODULE_4__.PropertyTypeForEdition.Boolean: {
72094
- components.push((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_sharedComponents_checkBoxLineComponent__WEBPACK_IMPORTED_MODULE_3__.CheckBoxLineComponent, { label: displayName, target: block, propertyName: propertyName, onValueChanged: () => this.forceRebuild(options.notifiers) }));
72047
+ components.push((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_sharedComponents_checkBoxLineComponent__WEBPACK_IMPORTED_MODULE_3__.CheckBoxLineComponent, { label: displayName, target: block, propertyName: propertyName, onValueChanged: () => this.forceRebuild(options.notifiers) }, `checkBox-${propertyName}`));
72095
72048
  break;
72096
72049
  }
72097
72050
  case core_Materials_Node_nodeMaterialDecorator__WEBPACK_IMPORTED_MODULE_4__.PropertyTypeForEdition.Float: {
72098
72051
  const cantDisplaySlider = isNaN(options.min) || isNaN(options.max) || options.min === options.max;
72099
72052
  if (cantDisplaySlider) {
72100
- components.push((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_floatLineComponent__WEBPACK_IMPORTED_MODULE_9__.FloatLineComponent, { lockObject: this.props.stateManager.lockObject, label: displayName, propertyName: propertyName, target: block, onChange: () => this.forceRebuild(options.notifiers) }));
72053
+ components.push((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_floatLineComponent__WEBPACK_IMPORTED_MODULE_9__.FloatLineComponent, { lockObject: this.props.stateManager.lockObject, label: displayName, propertyName: propertyName, target: block, onChange: () => this.forceRebuild(options.notifiers) }, `float-${propertyName}`));
72101
72054
  }
72102
72055
  else {
72103
- components.push((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_sliderLineComponent__WEBPACK_IMPORTED_MODULE_10__.SliderLineComponent, { lockObject: this.props.stateManager.lockObject, label: displayName, target: block, propertyName: propertyName, step: Math.abs(options.max - options.min) / 100.0, minimum: Math.min(options.min, options.max), maximum: options.max, onChange: () => this.forceRebuild(options.notifiers) }));
72056
+ components.push((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_sliderLineComponent__WEBPACK_IMPORTED_MODULE_10__.SliderLineComponent, { lockObject: this.props.stateManager.lockObject, label: displayName, target: block, propertyName: propertyName, step: Math.abs(options.max - options.min) / 100.0, minimum: Math.min(options.min, options.max), maximum: options.max, onChange: () => this.forceRebuild(options.notifiers) }, `slider-${propertyName}`));
72104
72057
  }
72105
72058
  break;
72106
72059
  }
72107
72060
  case core_Materials_Node_nodeMaterialDecorator__WEBPACK_IMPORTED_MODULE_4__.PropertyTypeForEdition.Int: {
72108
- components.push((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_floatLineComponent__WEBPACK_IMPORTED_MODULE_9__.FloatLineComponent, { lockObject: this.props.stateManager.lockObject, digits: 0, step: "1", isInteger: true, label: displayName, propertyName: propertyName, target: block, onChange: () => this.forceRebuild(options.notifiers) }));
72061
+ components.push((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_floatLineComponent__WEBPACK_IMPORTED_MODULE_9__.FloatLineComponent, { lockObject: this.props.stateManager.lockObject, digits: 0, step: "1", isInteger: true, label: displayName, propertyName: propertyName, target: block, onChange: () => this.forceRebuild(options.notifiers) }, `int-${propertyName}`));
72109
72062
  break;
72110
72063
  }
72111
72064
  case core_Materials_Node_nodeMaterialDecorator__WEBPACK_IMPORTED_MODULE_4__.PropertyTypeForEdition.Vector2: {
72112
- components.push((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_vector2LineComponent__WEBPACK_IMPORTED_MODULE_6__.Vector2LineComponent, { lockObject: this.props.stateManager.lockObject, label: displayName, propertyName: propertyName, target: block, onChange: () => this.forceRebuild(options.notifiers) }));
72065
+ components.push((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_vector2LineComponent__WEBPACK_IMPORTED_MODULE_6__.Vector2LineComponent, { lockObject: this.props.stateManager.lockObject, label: displayName, propertyName: propertyName, target: block, onChange: () => this.forceRebuild(options.notifiers) }, `vector2-${propertyName}`));
72113
72066
  break;
72114
72067
  }
72115
72068
  case core_Materials_Node_nodeMaterialDecorator__WEBPACK_IMPORTED_MODULE_4__.PropertyTypeForEdition.List: {
72116
- components.push((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_optionsLineComponent__WEBPACK_IMPORTED_MODULE_7__.OptionsLineComponent, { label: displayName, options: options.options, target: block, propertyName: propertyName, onSelect: () => this.forceRebuild(options.notifiers) }));
72069
+ components.push((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(shared_ui_components_lines_optionsLineComponent__WEBPACK_IMPORTED_MODULE_7__.OptionsLineComponent, { label: displayName, options: options.options, target: block, propertyName: propertyName, onSelect: () => this.forceRebuild(options.notifiers) }, `options-${propertyName}`));
72117
72070
  break;
72118
72071
  }
72119
72072
  }
72120
72073
  }
72121
- return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: groups.map((group) => ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__.LineContainerComponent, { title: group, children: componentList[group] }))) }));
72074
+ return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, { children: groups.map((group) => ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_2__.LineContainerComponent, { title: group, children: componentList[group] }, `group-${group}`))) }));
72122
72075
  }
72123
72076
  }
72124
72077