UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

63 lines (62 loc) 1.7 kB
"use strict"; import { ParamEvent } from "./../poly/ParamEvent"; import { ParamType } from "../poly/ParamType"; import { isString } from "../../core/Type"; import { TypedStringParam } from "./_BaseString"; export class StringParam extends TypedStringParam { static type() { return ParamType.STRING; } defaultValueSerialized() { return this._default_value; } _cloneRawInput(raw_input) { return `${raw_input}`; } rawInputSerialized() { return `${this._raw_input}`; } valueSerialized() { return `${this.value}`; } _copyValue(param) { this.set(param.value); } static areRawInputEqual(raw_input1, raw_input2) { return raw_input1 == raw_input2; } static areValuesEqual(val1, val2) { return val1 == val2; } isDefault() { return this._raw_input == this._default_value; } convert(rawVal) { if (isString(rawVal)) { return rawVal; } return `${rawVal}`; } rawInput() { return this._raw_input; } _assignValue(value) { this._value = value; } async processRawInputWithoutExpression() { const wasErrored = this.states.error.active(); if (this._raw_input != this._value || this._expression_controller || wasErrored) { this._assignValue(this._raw_input); this.states.error.clear(); this.removeDirtyState(); this.setSuccessorsDirty(this); this.emitController.emit(ParamEvent.VALUE_UPDATED); this.options.executeCallback(); if (this._expression_controller) { this._expression_controller.setExpression(void 0, false); this._expression_controller = void 0; this.emitController.emit(ParamEvent.EXPRESSION_UPDATED); } } } }