Files

3 lines
8.3 KiB
JavaScript
Raw Permalink Normal View History

2026-07-28 10:47:32 -04:00
var gdjs;(function(i){const d=["text","email","password","number","telephone number","url","search","text area"],l=["left","center","right"],n=r=>{const e=r.toLowerCase();return d.includes(e)?r:"text"},o=r=>{if(!r)return"left";const e=r.toLowerCase();return l.includes(e)?r:"left"},p=300,h=30,s=(r,e,t)=>Math.max(0,Math.min(e/2-t,r));class g extends i.RuntimeObject{constructor(e,t,u){super(e,t,u);this.opacity=255;this._width=p;this._height=h;this._string=t.content.initialValue,this._placeholder=t.content.placeholder,this._fontResourceName=t.content.fontResourceName,this._fontSize=t.content.fontSize||20,this._inputType=n(t.content.inputType),this._textColor=i.rgbOrHexToRGBColor(t.content.textColor),this._fillColor=i.rgbOrHexToRGBColor(t.content.fillColor),this._fillOpacity=t.content.fillOpacity,this._borderColor=i.rgbOrHexToRGBColor(t.content.borderColor),this._borderOpacity=t.content.borderOpacity,this._borderWidth=t.content.borderWidth,this._disabled=e.getGame().isInGameEdition()?!0:t.content.disabled,this._readOnly=t.content.readOnly,this._spellCheck=t.content.spellCheck!==void 0?t.content.spellCheck:!1,this._textAlign=o(t.content.textAlign),this._maxLength=t.content.maxLength||0,this._paddingX=t.content.paddingX!==void 0?t.content.paddingX:2,this._paddingY=t.content.paddingY!==void 0?t.content.paddingY:1,this._isSubmitted=!1,this._renderer=new i.TextInputRuntimeObjectRenderer(this,e),this.onCreated()}getRendererObject(){return null}updateFromObjectData(e,t){return e.content.initialValue!==t.content.initialValue&&this._string===e.content.initialValue&&this.setString(t.content.initialValue),e.content.placeholder!==t.content.placeholder&&this.setPlaceholder(t.content.placeholder),e.content.fontResourceName!==t.content.fontResourceName&&this.setFontResourceName(t.content.fontResourceName),e.content.fontSize!==t.content.fontSize&&this.setFontSize(t.content.fontSize),e.content.inputType!==t.content.inputType&&this.setInputType(t.content.inputType),e.content.textColor!==t.content.textColor&&this.setTextColor(t.content.textColor),e.content.fillColor!==t.content.fillColor&&this.setFillColor(t.content.fillColor),e.content.fillOpacity!==t.content.fillOpacity&&this.setFillOpacity(t.content.fillOpacity),e.content.borderColor!==t.content.borderColor&&this.setBorderColor(t.content.borderColor),e.content.borderOpacity!==t.content.borderOpacity&&this.setBorderOpacity(t.content.borderOpacity),e.content.borderWidth!==t.content.borderWidth&&this.setBorderWidth(t.content.borderWidth),e.content.disabled!==t.content.disabled&&this.setDisabled(t.content.disabled),e.content.readOnly!==t.content.readOnly&&this.setReadOnly(t.content.readOnly),t.content.spellCheck!==void 0&&e.content.spellCheck!==t.content.spellCheck&&this.setSpellCheck(t.content.spellCheck),t.content.maxLength!==void 0&&e.content.maxLength!==t.content.maxLength&&this.setMaxLength(t.content.maxLength),t.content.textAlign&&e.content.textAlign!==t.content.textAlign&&(this._textAlign=t.content.textAlign),t.content.paddingX!==void 0&&e.content.paddingX!==t.content.paddingX&&this.setPaddingX(t.content.paddingX),t.content.paddingY!==void 0&&e.content.paddingY!==t.content.paddingY&&this.setPaddingY(t.content.paddingY),!0}getNetworkSyncData(e){return{...super.getNetworkSyncData(e),opa:this.getOpacity(),txt:this.getText(),frn:this.getFontResourceName(),fs:this.getFontSize(),place:this.getPlaceholder(),it:this.getInputType(),tc:this.getTextColor(),fc:this.getFillColor(),fo:this.getFillOpacity(),bc:this.getBorderColor(),bo:this.getBorderOpacity(),bw:this.getBorderWidth(),dis:this.isDisabled(),ro:this.isReadOnly(),sc:this.isSpellCheckEnabled()}}updateFromNetworkSyncData(e,t){super.updateFromNetworkSyncData(e,t),e.opa!==void 0&&this.setOpacity(e.opa),e.txt!==void 0&&this.setText(e.txt),e.frn!==void 0&&this.setFontResourceName(e.frn),e.fs!==void 0&&this.setFontSize(e.fs),e.place!==void 0&&this.setPlaceholder(e.place),e.it!==void 0&&this.setInputType(e.it),e.tc!==void 0&&this.setTextColor(e.tc),e.fc!==void 0&&this.setFillColor(e.fc),e.fo!==void 0&&this.setFillOpacity(e.fo),e.bc!==void 0&&this.s
//# sourceMappingURL=textinputruntimeobject.js.map