Skip to content

Commit

Permalink
update for format
Browse files Browse the repository at this point in the history
  • Loading branch information
NeylMahfouf2608 committed Jan 21, 2025
1 parent fbddfa5 commit 3a893e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
16 changes: 7 additions & 9 deletions Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ namespace gdjs {
throw new Error('Tried to recreate an input while it already exists.');

this._form = document.createElement('form');

const isTextArea = this._object.getInputType() === 'text area';
this._input = document.createElement(isTextArea ? 'textarea' : 'input');

this._form.style.border = '0px';
this._form.style.borderRadius = '0px';
this._form.style.backgroundColor = 'transparent';
Expand All @@ -63,7 +63,7 @@ namespace gdjs {
this._form.style.display = 'none'; // Hide while object is being set up.
this._form.style.boxSizing = 'border-box';
this._form.style.textAlign = this._object.getTextAlign();

this._input.autocomplete = 'off';
this._input.style.backgroundColor = 'white';
this._input.style.border = '1px solid black';
Expand All @@ -72,7 +72,7 @@ namespace gdjs {
this._input.style.height = '100%';
this._input.maxLength = this._object.getMaxLength();
this._input.style.padding = this._object.getPadding() + 'px';

this._form.appendChild(this._input);

this._input.addEventListener('input', () => {
Expand Down Expand Up @@ -239,7 +239,7 @@ namespace gdjs {
this._form.style.transform =
'rotate3d(0,0,1,' + (this._object.getAngle() % 360) + 'deg)';
this._form.style.textAlign = this._object.getTextAlign();

this._input.style.padding = this._object.getPadding() + 'px';

// Automatically adjust the font size to follow the game scale.
Expand Down Expand Up @@ -365,8 +365,6 @@ namespace gdjs {
this._input.focus();
}
}
export const TextInputRuntimeObjectRenderer =
TextInputRuntimeObjectPixiRenderer;
export type TextInputRuntimeObjectRenderer =
TextInputRuntimeObjectPixiRenderer;
export const TextInputRuntimeObjectRenderer = TextInputRuntimeObjectPixiRenderer;
export type TextInputRuntimeObjectRenderer = TextInputRuntimeObjectPixiRenderer;
}
11 changes: 4 additions & 7 deletions Extensions/TextInput/textinputruntimeobject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ namespace gdjs {
*/
export class TextInputRuntimeObject
extends gdjs.RuntimeObject
implements gdjs.TextContainer, gdjs.Resizable, gdjs.OpacityHandler
{
implements gdjs.TextContainer, gdjs.Resizable, gdjs.OpacityHandler {
private _string: string;
private _placeholder: string;
private opacity: float = 255;
Expand Down Expand Up @@ -544,8 +543,7 @@ namespace gdjs {
return this._maxLength;
}
setMaxLength(value: integer) {
if(this._maxLength === value)
return;
if (this._maxLength === value) return;

this._maxLength = value;
this._renderer.updateMaxLength();
Expand All @@ -554,8 +552,7 @@ namespace gdjs {
return this._padding;
}
setPadding(value: integer) {
if(this._padding === value)
return;
if (this._padding === value) return;

this._padding = value;
this._renderer.updatePadding();
Expand All @@ -568,7 +565,7 @@ namespace gdjs {
setTextAlign(newTextAlign: string) {
const parsedTextAlign = parseTextAlign(newTextAlign);
if (parsedTextAlign === this._textAlign) return;

this._textAlign = parsedTextAlign;
this._renderer.updateTextAlign();
}
Expand Down

0 comments on commit 3a893e8

Please sign in to comment.