PIXI.Input icon indicating copy to clipboard operation
PIXI.Input copied to clipboard

focus out when clicked out of object

Open ttstAABB opened this issue 8 years ago • 0 comments

When I used this 'pixi.input.js', textbox of PIXI.Input doesn't work at 'focus out'. If I click out of canvas(ex : javascript console), it works. but in the canvas, 'focus out' didn't happen. So I added some codes, it is crude, but 'focus out' operates well. insert these lines to pixi.input.js 1123 ("extend(PIXI.Input.prototype, { ~~~ onMouseDown") (document's 'mousedown' is later than pixi object's 'mousedown'.)

        this.clicked = true;
        if (this.focused == undefined) {
            this.focused = true;
            var func = (e) => {
                if (this.clicked == false) {
                    this.blur();
                    this.focused = undefined;
                    document.removeEventListener('mousedown', func);
                }
                this.clicked = false;
            };
            document.addEventListener('mousedown', func);
        }

ttstAABB avatar Oct 06 '16 17:10 ttstAABB