From 9abe3af102d39b7caa26b256eee6c33a815fda94 Mon Sep 17 00:00:00 2001 From: lee Date: Fri, 4 Oct 2024 23:55:32 +0900 Subject: [PATCH] test --- extern/util/CanvasInput.js | 17 +++++------------ src/class/pixi/etc/PIXICanvasInput.js | 14 ++++---------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/extern/util/CanvasInput.js b/extern/util/CanvasInput.js index a6091802ff..dd6931e69e 100755 --- a/extern/util/CanvasInput.js +++ b/extern/util/CanvasInput.js @@ -62,7 +62,6 @@ self._selection = [0, 0]; self._wasOver = false; self._topPosition = o.topPosition; // parse box shadow - self._hasHiddenFocus = false; self.boxShadow(self._boxShadow, true); // calculate the full width and height with padding, borders and shadows self._calcWH(); // setup the off-DOM canvas @@ -181,13 +180,6 @@ } }); // add this to the buffer - self._hiddenInput.addEventListener('focus', function(e) { - self._hasHiddenFocus = true; - }); - self._hiddenInput.addEventListener('blur', function(e) { - self._hasHiddenFocus = false; - }); - inputs.push(self); self._inputsIndex = inputs.length - 1; // draw the text box @@ -748,7 +740,7 @@ nav.indexOf('android') >= 0; // add support for mobile var isMobile = typeof window.orientation !== 'undefined'; - + var hasHiddenFocus = false; if ( isMobile && !isChromeMobile && @@ -774,7 +766,7 @@ input.addEventListener( 'blur', function() { - if (!self._hasHiddenFocus) { + if (!hasHiddenFocus) { self.blur(self); } }, @@ -785,11 +777,12 @@ } // move the real focus to the hidden input var hasSelection = self._selection[0] > 0 || self._selection[1] > 0; - self._hasHiddenFocus = true; + hasHiddenFocus = true; self._hiddenInput.focus(); - + hasHiddenFocus = false; self._hiddenInput.selectionStart = hasSelection ? self._selection[0] : self._cursorPos; self._hiddenInput.selectionEnd = hasSelection ? self._selection[1] : self._cursorPos; + return self.render(); }, diff --git a/src/class/pixi/etc/PIXICanvasInput.js b/src/class/pixi/etc/PIXICanvasInput.js index e800e4407e..a70a9d9365 100644 --- a/src/class/pixi/etc/PIXICanvasInput.js +++ b/src/class/pixi/etc/PIXICanvasInput.js @@ -59,7 +59,6 @@ import * as PIXI from 'pixi.js'; self._selection = [0, 0]; self._wasOver = false; self._topPosition = o.topPosition; - self._hasHiddenFocus = false; // parse box shadow self.boxShadow(self._boxShadow, true); @@ -184,13 +183,6 @@ import * as PIXI from 'pixi.js'; } }); - self._hiddenInput.addEventListener('focus', function(e) { - self._hasHiddenFocus = true; - }); - self._hiddenInput.addEventListener('blur', function(e) { - self._hasHiddenFocus = false; - }); - // add this to the buffer inputs.push(self); self._inputsIndex = inputs.length - 1; @@ -779,6 +771,7 @@ import * as PIXI from 'pixi.js'; // add support for mobile const isMobile = typeof window.orientation !== 'undefined'; + var hasHiddenFocus = false; if ( isMobile && !isChromeMobile && @@ -802,7 +795,7 @@ import * as PIXI from 'pixi.js'; input.addEventListener( 'blur', () => { - if (!self._hasHiddenFocus) { + if (!hasHiddenFocus) { self.blur(self); } }, @@ -814,8 +807,9 @@ import * as PIXI from 'pixi.js'; // move the real focus to the hidden input const hasSelection = self._selection[0] > 0 || self._selection[1] > 0; - self._hasHiddenFocus = true; + hasHiddenFocus = true; self._hiddenInput.focus(); + hasHiddenFocus = false; self._hiddenInput.selectionStart = hasSelection ? self._selection[0] : self._cursorPos; self._hiddenInput.selectionEnd = hasSelection ? self._selection[1] : self._cursorPos;