idk
This commit is contained in:
1 parent
1cf1d1988e
commit
40fdf2a04e
714 files changed
+3
-3
No files matched your search
@@ -0,0 +1,2 @@
|
||||
var gdjs;(function(a){const m={text:"text",email:"email",password:"password",number:"number","telephone number":"tel",url:"url",search:"search"},n=(o,e)=>"rgba("+o[0]+","+o[1]+","+o[2]+","+e/255+")";class s{constructor(e,t){this._input=null;this._object=e,this._instanceContainer=t,this._runtimeGame=this._instanceContainer.getGame(),this._createElement()}_createElement(){if(this._input)throw new Error("Tried to recreate an input while it already exists.");const e=this._object.getInputType()==="text area";this._input=document.createElement(e?"textarea":"input"),this._input.style.border="1px solid black",this._input.autocomplete="off",this._input.style.borderRadius="0px",this._input.style.backgroundColor="white",this._input.style.position="absolute",this._input.style.resize="none",this._input.style.outline="none",this._input.style.pointerEvents="auto",this._input.style.display="none",this._input.style.boxSizing="border-box",this._input.addEventListener("input",()=>{!this._input||this._object.onRendererInputValueChanged(this._input.value)}),this._input.addEventListener("touchstart",()=>{!this._input||document.activeElement!==this._input&&this._input.focus()}),this.updateString(),this.updateFont(),this.updatePlaceholder(),this.updateOpacity(),this.updateInputType(),this.updateTextColor(),this.updateFillColorAndOpacity(),this.updateBorderColorAndOpacity(),this.updateBorderWidth(),this.updateDisabled(),this.updateReadOnly(),this._runtimeGame.getRenderer().getDomElementContainer().appendChild(this._input)}_destroyElement(){!this._input||(this._input.remove(),this._input=null)}onScenePaused(){this._destroyElement()}onSceneResumed(){this._createElement()}onDestroy(){this._destroyElement()}updatePreRender(){if(!this._input)return;if(this._object.isHidden()){this._input.style.display="none";return}const e=this._instanceContainer.getLayer(this._object.getLayer());if(!e.isVisible()){this._input.style.display="none";return}const t=a.staticArray(s.prototype.updatePreRender),i=this._instanceContainer.getGame(),r=i.getRenderer(),u=e.convertInverseCoords(this._object.x,this._object.y,0,t),p=u[0],h=u[1],l=e.convertInverseCoords(this._object.x+this._object.getWidth(),this._object.y+this._object.getHeight(),0,t),c=l[0],d=l[1];if(c<0||d<0||p>i.getGameResolutionWidth()||h>i.getGameResolutionHeight()){this._input.style.display="none";return}t[0]=p,t[1]=h,r.convertCanvasToDomElementContainerCoords(t,t);const _=t[0],y=t[1];t[0]=c,t[1]=d,r.convertCanvasToDomElementContainerCoords(t,t);const g=t[0],b=t[1],f=g-_,C=b-y;this._input.style.left=_+"px",this._input.style.top=y+"px",this._input.style.width=f+"px",this._input.style.height=C+"px",this._input.style.transform="rotate3d(0,0,1,"+this._object.getAngle()%360+"deg)",this._input.style.fontSize=this._object.getFontSize()*r.getCanvasToDomElementContainerHeightScale()+"px",this._input.style.display="initial"}updateString(){!this._input||(this._input.value=this._object.getString())}updatePlaceholder(){!this._input||(this._input.placeholder=this._object.getPlaceholder())}updateFont(){!this._input||(this._input.style.fontFamily=this._instanceContainer.getGame().getFontManager().getFontFamily(this._object.getFontResourceName()))}updateOpacity(){!this._input||(this._input.style.opacity=""+this._object.getOpacity()/255)}updateInputType(){if(!this._input)return;const e=this._input instanceof HTMLTextAreaElement,t=this._object.getInputType()==="text area";e!==t&&(this._destroyElement(),this._createElement());const i=m[this._object.getInputType()]||"text";this._input.setAttribute("type",i)}updateTextColor(){!this._input||(this._input.style.color=n(this._object._getRawTextColor(),255))}updateFillColorAndOpacity(){!this._input||(this._input.style.backgroundColor=n(this._object._getRawFillColor(),this._object.getFillOpacity()))}updateBorderColorAndOpacity(){!this._input||(this._input.style.borderColor=n(this._object._getRawBorderColor(),this._object.getBorderOpacity()))}updateBorderWidth(){!this._input||(this._input.style.borderWidth=this._object.getBorderWidth()+"px")}updateDisabled(){!this._input||(this._input.disabled=this._object.isDisabled())}updateReadOnly(){!this._input||(this._input.readOnly=this._object.isReadOnly())}isFocused(){return this._input===document.activeElement}focus(){!this._input||this._input.focus()}}a.TextInputRuntimeObjectRenderer=s})(gdjs||(gdjs={}));
|
||||
//# sourceMappingURL=textinputruntimeobject-pixi-renderer.js.map
|
||||
@@ -0,0 +1,2 @@
|
||||
var gdjs;(function(r){const n=["text","email","password","number","telephone number","url","search","text area"],i=o=>{const t=o.toLowerCase();return n.includes(t)?o:"text"},s=300,l=30;class d extends r.RuntimeObject{constructor(t,e){super(t,e);this.opacity=255;this._width=s;this._height=l;this._string=e.content.initialValue,this._placeholder=e.content.placeholder,this._fontResourceName=e.content.fontResourceName,this._fontSize=e.content.fontSize||20,this._inputType=i(e.content.inputType),this._textColor=r.rgbOrHexToRGBColor(e.content.textColor),this._fillColor=r.rgbOrHexToRGBColor(e.content.fillColor),this._fillOpacity=e.content.fillOpacity,this._borderColor=r.rgbOrHexToRGBColor(e.content.borderColor),this._borderOpacity=e.content.borderOpacity,this._borderWidth=e.content.borderWidth,this._disabled=e.content.disabled,this._readOnly=e.content.readOnly,this._renderer=new r.TextInputRuntimeObjectRenderer(this,t),this.onCreated()}getRendererObject(){return null}updateFromObjectData(t,e){return t.content.initialValue!==e.content.initialValue&&this._string===t.content.initialValue&&this.setString(e.content.initialValue),t.content.placeholder!==e.content.placeholder&&this.setPlaceholder(e.content.placeholder),t.content.fontResourceName!==e.content.fontResourceName&&this.setFontResourceName(e.content.fontResourceName),t.content.fontSize!==e.content.fontSize&&this.setFontSize(e.content.fontSize),t.content.inputType!==e.content.inputType&&this.setInputType(e.content.inputType),t.content.textColor!==e.content.textColor&&this.setTextColor(e.content.textColor),t.content.fillColor!==e.content.fillColor&&this.setFillColor(e.content.fillColor),t.content.fillOpacity!==e.content.fillOpacity&&this.setFillOpacity(e.content.fillOpacity),t.content.borderColor!==e.content.borderColor&&this.setBorderColor(e.content.borderColor),t.content.borderOpacity!==e.content.borderOpacity&&this.setBorderOpacity(e.content.borderOpacity),t.content.borderWidth!==e.content.borderWidth&&this.setBorderWidth(e.content.borderWidth),t.content.disabled!==e.content.disabled&&this.setDisabled(e.content.disabled),t.content.readOnly!==e.content.readOnly&&this.setReadOnly(e.content.readOnly),!0}updatePreRender(t){this._renderer.updatePreRender()}extraInitializationFromInitialInstance(t){for(const e of t.stringProperties)e.name==="initialValue"?this.setString(e.value):e.name==="placeholder"&&this.setPlaceholder(e.value);t.customSize&&(this.setWidth(t.width),this.setHeight(t.height))}onScenePaused(t){this._renderer.onScenePaused()}onSceneResumed(t){this._renderer.onSceneResumed()}onDestroyed(){super.onDestroyed(),this._renderer.onDestroy()}setOpacity(t){this.opacity=Math.max(0,Math.min(255,t)),this._renderer.updateOpacity()}getOpacity(){return this.opacity}setSize(t,e){this.setWidth(t),this.setHeight(e)}setWidth(t){this._width=t}setHeight(t){this._height=t}getWidth(){return this._width}getHeight(){return this._height}getString(){return this.getText()}setString(t){this.setText(t)}getText(){return this._string}setText(t){t!==this._string&&(this._string=t,this._renderer.updateString())}onRendererInputValueChanged(t){this._string=t}getFontResourceName(){return this._fontResourceName}setFontResourceName(t){this._fontResourceName!==t&&(this._fontResourceName=t,this._renderer.updateFont())}getFontSize(){return this._fontSize}setFontSize(t){this._fontSize=t}getPlaceholder(){return this._placeholder}setPlaceholder(t){t!==this._placeholder&&(this._placeholder=t,this._renderer.updatePlaceholder())}getInputType(){return this._inputType}setInputType(t){const e=t.toLowerCase();e!==this._inputType&&(this._inputType=i(e),this._renderer.updateInputType())}setTextColor(t){this._textColor=r.rgbOrHexToRGBColor(t),this._renderer.updateTextColor()}getTextColor(){return this._textColor[0]+";"+this._textColor[1]+";"+this._textColor[2]}_getRawTextColor(){return this._textColor}setFillColor(t){this._fillColor=r.rgbOrHexToRGBColor(t),this._renderer.updateFillColorAndOpacity()}getFillColor(){return this._fillColor[0]+";"+this._fillColor[1]+";"+this._fillColor[2]}_getRawFillColor(){return this._fillColor}setFillOpacity(t){this._fillOpacity=Math.max(0,Math.min(255,t)),this._renderer.updateFillColorAndOpacity()}getFillOpacity(){return this._fillOpacity}setBorderColor(t){this._borderColor=r.rgbOrHexToRGBColor(t),this._renderer.updateBorderColorAndOpacity()}getBorderColor(){return this._borderColor[0]+";"+this._borderColor[1]+";"+this._borderColor[2]}_getRawBorderColor(){return this._borderColor}setBorderOpacity(t){this._borderOpacity=Math.max(0,Math.min(255,t)),this._renderer.updateBorderColorAndOpacity()}getBorderOpacity(){return this._borderOpacity}setBorderWidth(t){this._borderWidth=Math.max(0,t),this._renderer.updateBorderWidth()}getBorderWidth(){return this._borderWidth}setDisabled(t){this._disabled=t,this._renderer.updateDisabled()}isDisabled(){return this._disabled}setReadOnly(t){this._readOnly=t,this._renderer.updateReadOnly()}isReadOnly(){return this._readOnly}isFocused(){return
Line truncated
|
||||
//# sourceMappingURL=textinputruntimeobject.js.map
|
||||
Reference in new issue
Block a user