Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
lee committed Oct 4, 2024
1 parent 6a341a6 commit 9abe3af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
17 changes: 5 additions & 12 deletions extern/util/CanvasInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -748,7 +740,7 @@
nav.indexOf('android') >= 0; // add support for mobile

var isMobile = typeof window.orientation !== 'undefined';

var hasHiddenFocus = false;
if (
isMobile &&
!isChromeMobile &&
Expand All @@ -774,7 +766,7 @@
input.addEventListener(
'blur',
function() {
if (!self._hasHiddenFocus) {
if (!hasHiddenFocus) {
self.blur(self);
}
},
Expand All @@ -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();
},

Expand Down
14 changes: 4 additions & 10 deletions src/class/pixi/etc/PIXICanvasInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 &&
Expand All @@ -802,7 +795,7 @@ import * as PIXI from 'pixi.js';
input.addEventListener(
'blur',
() => {
if (!self._hasHiddenFocus) {
if (!hasHiddenFocus) {
self.blur(self);
}
},
Expand All @@ -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;

Expand Down

0 comments on commit 9abe3af

Please sign in to comment.