Socket
Socket
Sign inDemoInstall

@pixi/accessibility

Package Overview
Dependencies
Maintainers
1
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/accessibility - npm Package Compare versions

Comparing version 6.0.0-rc to 6.0.0-rc.2

64

dist/browser/accessibility.js
/*!
* @pixi/accessibility - v6.0.0-rc
* Compiled Tue, 29 Dec 2020 19:58:03 UTC
* @pixi/accessibility - v6.0.0-rc.2
* Compiled Thu, 14 Jan 2021 00:40:28 UTC
*

@@ -175,3 +175,3 @@ * @pixi/accessibility is licensed under the MIT License.

*
* @member {PIXI.AbstractRenderer}
* @member {PIXI.CanvasRenderer|PIXI.Renderer}
*/

@@ -283,2 +283,3 @@ this.renderer = renderer;

AccessibilityManager.prototype.activate = function () {
var _a;
if (this._isActive) {

@@ -290,7 +291,4 @@ return;

self.removeEventListener('keydown', this._onKeyDown, false);
// TODO: Remove casting when CanvasRenderer is converted
this.renderer.on('postrender', this.update, this);
if (this.renderer.view.parentNode) {
this.renderer.view.parentNode.appendChild(this.div);
}
(_a = this.renderer.view.parentNode) === null || _a === void 0 ? void 0 : _a.appendChild(this.div);
};

@@ -304,2 +302,3 @@ /**

AccessibilityManager.prototype.deactivate = function () {
var _a;
if (!this._isActive || this._isMobileAccessibility) {

@@ -311,7 +310,4 @@ return;

self.addEventListener('keydown', this._onKeyDown, false);
// TODO: Remove casting when CanvasRenderer is converted
this.renderer.off('postrender', this.update);
if (this.div.parentNode) {
this.div.parentNode.removeChild(this.div);
}
(_a = this.div.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.div);
};

@@ -361,12 +357,11 @@ /**

}
// TODO: Remove casting when CanvasRenderer is converted
var rect = this.renderer.view.getBoundingClientRect();
var resolution = this.renderer.resolution;
var sx = (rect.width / this.renderer.width) * resolution;
var sy = (rect.height / this.renderer.height) * resolution;
var _a = this.renderer.view.getBoundingClientRect(), left = _a.left, top = _a.top, width = _a.width, height = _a.height;
var _b = this.renderer, viewWidth = _b.width, viewHeight = _b.height, resolution = _b.resolution;
var sx = (width / viewWidth) * resolution;
var sy = (height / viewHeight) * resolution;
var div = this.div;
div.style.left = rect.left + "px";
div.style.top = rect.top + "px";
div.style.width = this.renderer.width + "px";
div.style.height = this.renderer.height + "px";
div.style.left = left + "px";
div.style.top = top + "px";
div.style.width = viewWidth + "px";
div.style.height = viewHeight + "px";
for (var i = 0; i < this.children.length; i++) {

@@ -444,8 +439,8 @@ var child = this.children[i];

}
// TODO: Remove casting when CanvasRenderer is converted
if (hitArea.x + hitArea.width > this.renderer.width) {
hitArea.width = this.renderer.width - hitArea.x;
var _a = this.renderer, viewWidth = _a.width, viewHeight = _a.height;
if (hitArea.x + hitArea.width > viewWidth) {
hitArea.width = viewWidth - hitArea.x;
}
if (hitArea.y + hitArea.height > this.renderer.height) {
hitArea.height = this.renderer.height - hitArea.y;
if (hitArea.y + hitArea.height > viewHeight) {
hitArea.height = viewHeight - hitArea.y;
}

@@ -521,7 +516,8 @@ };

AccessibilityManager.prototype._onClick = function (e) {
// TODO: Remove casting when CanvasRenderer is converted
var interactionManager = this.renderer.plugins.interaction;
interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData);
interactionManager.dispatchEvent(e.target.displayObject, 'pointertap', interactionManager.eventData);
interactionManager.dispatchEvent(e.target.displayObject, 'tap', interactionManager.eventData);
var displayObject = e.target.displayObject;
var eventData = interactionManager.eventData;
interactionManager.dispatchEvent(displayObject, 'click', eventData);
interactionManager.dispatchEvent(displayObject, 'pointertap', eventData);
interactionManager.dispatchEvent(displayObject, 'tap', eventData);
};

@@ -538,5 +534,6 @@ /**

}
// TODO: Remove casting when CanvasRenderer is converted
var interactionManager = this.renderer.plugins.interaction;
interactionManager.dispatchEvent(e.target.displayObject, 'mouseover', interactionManager.eventData);
var displayObject = e.target.displayObject;
var eventData = interactionManager.eventData;
interactionManager.dispatchEvent(displayObject, 'mouseover', eventData);
};

@@ -553,5 +550,6 @@ /**

}
// TODO: Remove casting when CanvasRenderer is converted
var interactionManager = this.renderer.plugins.interaction;
interactionManager.dispatchEvent(e.target.displayObject, 'mouseout', interactionManager.eventData);
var displayObject = e.target.displayObject;
var eventData = interactionManager.eventData;
interactionManager.dispatchEvent(displayObject, 'mouseout', eventData);
};

@@ -558,0 +556,0 @@ /**

/*!
* @pixi/accessibility - v6.0.0-rc
* Compiled Tue, 29 Dec 2020 19:58:03 UTC
* @pixi/accessibility - v6.0.0-rc.2
* Compiled Thu, 14 Jan 2021 00:40:28 UTC
*

@@ -8,3 +8,3 @@ * @pixi/accessibility is licensed under the MIT License.

*/
this.PIXI=this.PIXI||{};var _pixi_accessibility=function(e,t,i){"use strict";var s={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};t.DisplayObject.mixin(s);var n=100,r=0,o=0,l=2,a=function(){function e(e){this._hookDiv=null,(i.isMobile.tablet||i.isMobile.phone)&&this.createTouchHook();var t=document.createElement("div");t.style.width=n+"px",t.style.height=n+"px",t.style.position="absolute",t.style.top=r+"px",t.style.left=o+"px",t.style.zIndex=l.toString(),this.div=t,this.pool=[],this.renderId=0,this.debug=!1,this.renderer=e,this.children=[],this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._isActive=!1,this._isMobileAccessibility=!1,this.androidUpdateCount=0,this.androidUpdateFrequency=500,self.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(e.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),e.prototype.createTouchHook=function(){var e=this,t=document.createElement("button");t.style.width="1px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",t.style.zIndex=2..toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",function(){e._isMobileAccessibility=!0,e.activate(),e.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t},e.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},e.prototype.activate=function(){this._isActive||(this._isActive=!0,self.document.addEventListener("mousemove",this._onMouseMove,!0),self.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),this.renderer.view.parentNode&&this.renderer.view.parentNode.appendChild(this.div))},e.prototype.deactivate=function(){this._isActive&&!this._isMobileAccessibility&&(this._isActive=!1,self.document.removeEventListener("mousemove",this._onMouseMove,!0),self.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),this.div.parentNode&&this.div.parentNode.removeChild(this.div))},e.prototype.updateAccessibleObjects=function(e){if(e.visible&&e.accessibleChildren){e.accessible&&e.interactive&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);for(var t=e.children,i=0;i<t.length;i++)this.updateAccessibleObjects(t[i])}},e.prototype.update=function(){var e=performance.now();if(!(i.isMobile.android.device&&e<this.androidUpdateCount)&&(this.androidUpdateCount=e+this.androidUpdateFrequency,this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var t=this.renderer.view.getBoundingClientRect(),s=this.renderer.resolution,n=t.width/this.renderer.width*s,r=t.height/this.renderer.height*s,o=this.div;o.style.left=t.left+"px",o.style.top=t.top+"px",o.style.width=this.renderer.width+"px",o.style.height=this.renderer.height+"px";for(var l=0;l<this.children.length;l++){var a=this.children[l];if(a.renderId!==this.renderId)a._accessibleActive=!1,i.removeItems(this.children,l,1),this.div.removeChild(a._accessibleDiv),this.pool.push(a._accessibleDiv),a._accessibleDiv=null,l--;else{o=a._accessibleDiv;var c=a.hitArea,d=a.worldTransform;a.hitArea?(o.style.left=(d.tx+c.x*d.a)*n+"px",o.style.top=(d.ty+c.y*d.d)*r+"px",o.style.width=c.width*d.a*n+"px",o.style.height=c.height*d.d*r+"px"):(c=a.getBounds(),this.capHitArea(c),o.style.left=c.x*n+"px",o.style.top=c.y*r+"px",o.style.width=c.width*n+"px",o.style.height=c.height*r+"px",o.title!==a.accessibleTitle&&null!==a.accessibleTitle&&(o.title=a.accessibleTitle),o.getAttribute("aria-label")!==a.accessibleHint&&null!==a.accessibleHint&&o.setAttribute("aria-label",a.accessibleHint)),a.accessibleTitle===o.title&&a.tabIndex===o.tabIndex||(o.title=a.accessibleTitle,o.tabIndex=a.tabIndex,this.debug&&this.updateDebugHTML(o))}}this.renderId++}},e.prototype.updateDebugHTML=function(e){e.innerHTML="type: "+e.type+"</br> title : "+e.title+"</br> tabIndex: "+e.tabIndex},e.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0),e.x+e.width>this.renderer.width&&(e.width=this.renderer.width-e.x),e.y+e.height>this.renderer.height&&(e.height=this.renderer.height-e.y)},e.prototype.addChild=function(e){var t=this.pool.pop();t||((t=document.createElement("button")).style.width=n+"px",t.style.height=n+"px",t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=l.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&null!==e.accessibleTitle?t.title=e.accessibleTitle:e.accessibleHint&&null!==e.accessibleHint||(t.title="displayObject "+e.tabIndex),e.accessibleHint&&null!==e.accessibleHint&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this.updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex},e.prototype._onClick=function(e){var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"click",t.eventData),t.dispatchEvent(e.target.displayObject,"pointertap",t.eventData),t.dispatchEvent(e.target.displayObject,"tap",t.eventData)},e.prototype._onFocus=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive");var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"mouseover",t.eventData)},e.prototype._onFocusOut=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite");var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"mouseout",t.eventData)},e.prototype._onKeyDown=function(e){9===e.keyCode&&this.activate()},e.prototype._onMouseMove=function(e){0===e.movementX&&0===e.movementY||this.deactivate()},e.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,self.document.removeEventListener("mousemove",this._onMouseMove,!0),self.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},e}();return e.AccessibilityManager=a,e.accessibleTarget=s,e}({},PIXI,PIXI.utils);Object.assign(this.PIXI,_pixi_accessibility);
this.PIXI=this.PIXI||{};var _pixi_accessibility=function(e,t,i){"use strict";var s={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};t.DisplayObject.mixin(s);var n=100,o=0,r=0,l=2,c=function(){function e(e){this._hookDiv=null,(i.isMobile.tablet||i.isMobile.phone)&&this.createTouchHook();var t=document.createElement("div");t.style.width=n+"px",t.style.height=n+"px",t.style.position="absolute",t.style.top=o+"px",t.style.left=r+"px",t.style.zIndex=l.toString(),this.div=t,this.pool=[],this.renderId=0,this.debug=!1,this.renderer=e,this.children=[],this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._isActive=!1,this._isMobileAccessibility=!1,this.androidUpdateCount=0,this.androidUpdateFrequency=500,self.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(e.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),e.prototype.createTouchHook=function(){var e=this,t=document.createElement("button");t.style.width="1px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",t.style.zIndex=2..toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",function(){e._isMobileAccessibility=!0,e.activate(),e.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t},e.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},e.prototype.activate=function(){var e;this._isActive||(this._isActive=!0,self.document.addEventListener("mousemove",this._onMouseMove,!0),self.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),null===(e=this.renderer.view.parentNode)||void 0===e||e.appendChild(this.div))},e.prototype.deactivate=function(){var e;this._isActive&&!this._isMobileAccessibility&&(this._isActive=!1,self.document.removeEventListener("mousemove",this._onMouseMove,!0),self.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),null===(e=this.div.parentNode)||void 0===e||e.removeChild(this.div))},e.prototype.updateAccessibleObjects=function(e){if(e.visible&&e.accessibleChildren){e.accessible&&e.interactive&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);for(var t=e.children,i=0;i<t.length;i++)this.updateAccessibleObjects(t[i])}},e.prototype.update=function(){var e=performance.now();if(!(i.isMobile.android.device&&e<this.androidUpdateCount)&&(this.androidUpdateCount=e+this.androidUpdateFrequency,this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var t=this.renderer.view.getBoundingClientRect(),s=t.left,n=t.top,o=t.width,r=t.height,l=this.renderer,c=l.width,a=l.height,d=l.resolution,h=o/c*d,u=r/a*d,p=this.div;p.style.left=s+"px",p.style.top=n+"px",p.style.width=c+"px",p.style.height=a+"px";for(var b=0;b<this.children.length;b++){var v=this.children[b];if(v.renderId!==this.renderId)v._accessibleActive=!1,i.removeItems(this.children,b,1),this.div.removeChild(v._accessibleDiv),this.pool.push(v._accessibleDiv),v._accessibleDiv=null,b--;else{p=v._accessibleDiv;var y=v.hitArea,g=v.worldTransform;v.hitArea?(p.style.left=(g.tx+y.x*g.a)*h+"px",p.style.top=(g.ty+y.y*g.d)*u+"px",p.style.width=y.width*g.a*h+"px",p.style.height=y.height*g.d*u+"px"):(y=v.getBounds(),this.capHitArea(y),p.style.left=y.x*h+"px",p.style.top=y.y*u+"px",p.style.width=y.width*h+"px",p.style.height=y.height*u+"px",p.title!==v.accessibleTitle&&null!==v.accessibleTitle&&(p.title=v.accessibleTitle),p.getAttribute("aria-label")!==v.accessibleHint&&null!==v.accessibleHint&&p.setAttribute("aria-label",v.accessibleHint)),v.accessibleTitle===p.title&&v.tabIndex===p.tabIndex||(p.title=v.accessibleTitle,p.tabIndex=v.tabIndex,this.debug&&this.updateDebugHTML(p))}}this.renderId++}},e.prototype.updateDebugHTML=function(e){e.innerHTML="type: "+e.type+"</br> title : "+e.title+"</br> tabIndex: "+e.tabIndex},e.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);var t=this.renderer,i=t.width,s=t.height;e.x+e.width>i&&(e.width=i-e.x),e.y+e.height>s&&(e.height=s-e.y)},e.prototype.addChild=function(e){var t=this.pool.pop();t||((t=document.createElement("button")).style.width=n+"px",t.style.height=n+"px",t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=l.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&null!==e.accessibleTitle?t.title=e.accessibleTitle:e.accessibleHint&&null!==e.accessibleHint||(t.title="displayObject "+e.tabIndex),e.accessibleHint&&null!==e.accessibleHint&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this.updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex},e.prototype._onClick=function(e){var t=this.renderer.plugins.interaction,i=e.target.displayObject,s=t.eventData;t.dispatchEvent(i,"click",s),t.dispatchEvent(i,"pointertap",s),t.dispatchEvent(i,"tap",s)},e.prototype._onFocus=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive");var t=this.renderer.plugins.interaction,i=e.target.displayObject,s=t.eventData;t.dispatchEvent(i,"mouseover",s)},e.prototype._onFocusOut=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite");var t=this.renderer.plugins.interaction,i=e.target.displayObject,s=t.eventData;t.dispatchEvent(i,"mouseout",s)},e.prototype._onKeyDown=function(e){9===e.keyCode&&this.activate()},e.prototype._onMouseMove=function(e){0===e.movementX&&0===e.movementY||this.deactivate()},e.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,self.document.removeEventListener("mousemove",this._onMouseMove,!0),self.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},e}();return e.AccessibilityManager=c,e.accessibleTarget=s,e}({},PIXI,PIXI.utils);Object.assign(this.PIXI,_pixi_accessibility);
//# sourceMappingURL=accessibility.min.js.map
/*!
* @pixi/accessibility - v6.0.0-rc
* Compiled Tue, 29 Dec 2020 19:58:03 UTC
* @pixi/accessibility - v6.0.0-rc.2
* Compiled Thu, 14 Jan 2021 00:40:28 UTC
*

@@ -178,3 +178,3 @@ * @pixi/accessibility is licensed under the MIT License.

*
* @member {PIXI.AbstractRenderer}
* @member {PIXI.CanvasRenderer|PIXI.Renderer}
*/

@@ -286,2 +286,3 @@ this.renderer = renderer;

AccessibilityManager.prototype.activate = function () {
var _a;
if (this._isActive) {

@@ -293,7 +294,4 @@ return;

self.removeEventListener('keydown', this._onKeyDown, false);
// TODO: Remove casting when CanvasRenderer is converted
this.renderer.on('postrender', this.update, this);
if (this.renderer.view.parentNode) {
this.renderer.view.parentNode.appendChild(this.div);
}
(_a = this.renderer.view.parentNode) === null || _a === void 0 ? void 0 : _a.appendChild(this.div);
};

@@ -307,2 +305,3 @@ /**

AccessibilityManager.prototype.deactivate = function () {
var _a;
if (!this._isActive || this._isMobileAccessibility) {

@@ -314,7 +313,4 @@ return;

self.addEventListener('keydown', this._onKeyDown, false);
// TODO: Remove casting when CanvasRenderer is converted
this.renderer.off('postrender', this.update);
if (this.div.parentNode) {
this.div.parentNode.removeChild(this.div);
}
(_a = this.div.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.div);
};

@@ -364,12 +360,11 @@ /**

}
// TODO: Remove casting when CanvasRenderer is converted
var rect = this.renderer.view.getBoundingClientRect();
var resolution = this.renderer.resolution;
var sx = (rect.width / this.renderer.width) * resolution;
var sy = (rect.height / this.renderer.height) * resolution;
var _a = this.renderer.view.getBoundingClientRect(), left = _a.left, top = _a.top, width = _a.width, height = _a.height;
var _b = this.renderer, viewWidth = _b.width, viewHeight = _b.height, resolution = _b.resolution;
var sx = (width / viewWidth) * resolution;
var sy = (height / viewHeight) * resolution;
var div = this.div;
div.style.left = rect.left + "px";
div.style.top = rect.top + "px";
div.style.width = this.renderer.width + "px";
div.style.height = this.renderer.height + "px";
div.style.left = left + "px";
div.style.top = top + "px";
div.style.width = viewWidth + "px";
div.style.height = viewHeight + "px";
for (var i = 0; i < this.children.length; i++) {

@@ -447,8 +442,8 @@ var child = this.children[i];

}
// TODO: Remove casting when CanvasRenderer is converted
if (hitArea.x + hitArea.width > this.renderer.width) {
hitArea.width = this.renderer.width - hitArea.x;
var _a = this.renderer, viewWidth = _a.width, viewHeight = _a.height;
if (hitArea.x + hitArea.width > viewWidth) {
hitArea.width = viewWidth - hitArea.x;
}
if (hitArea.y + hitArea.height > this.renderer.height) {
hitArea.height = this.renderer.height - hitArea.y;
if (hitArea.y + hitArea.height > viewHeight) {
hitArea.height = viewHeight - hitArea.y;
}

@@ -524,7 +519,8 @@ };

AccessibilityManager.prototype._onClick = function (e) {
// TODO: Remove casting when CanvasRenderer is converted
var interactionManager = this.renderer.plugins.interaction;
interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData);
interactionManager.dispatchEvent(e.target.displayObject, 'pointertap', interactionManager.eventData);
interactionManager.dispatchEvent(e.target.displayObject, 'tap', interactionManager.eventData);
var displayObject = e.target.displayObject;
var eventData = interactionManager.eventData;
interactionManager.dispatchEvent(displayObject, 'click', eventData);
interactionManager.dispatchEvent(displayObject, 'pointertap', eventData);
interactionManager.dispatchEvent(displayObject, 'tap', eventData);
};

@@ -541,5 +537,6 @@ /**

}
// TODO: Remove casting when CanvasRenderer is converted
var interactionManager = this.renderer.plugins.interaction;
interactionManager.dispatchEvent(e.target.displayObject, 'mouseover', interactionManager.eventData);
var displayObject = e.target.displayObject;
var eventData = interactionManager.eventData;
interactionManager.dispatchEvent(displayObject, 'mouseover', eventData);
};

@@ -556,5 +553,6 @@ /**

}
// TODO: Remove casting when CanvasRenderer is converted
var interactionManager = this.renderer.plugins.interaction;
interactionManager.dispatchEvent(e.target.displayObject, 'mouseout', interactionManager.eventData);
var displayObject = e.target.displayObject;
var eventData = interactionManager.eventData;
interactionManager.dispatchEvent(displayObject, 'mouseout', eventData);
};

@@ -561,0 +559,0 @@ /**

/*!
* @pixi/accessibility - v6.0.0-rc
* Compiled Tue, 29 Dec 2020 19:58:03 UTC
* @pixi/accessibility - v6.0.0-rc.2
* Compiled Thu, 14 Jan 2021 00:40:28 UTC
*

@@ -8,3 +8,3 @@ * @pixi/accessibility is licensed under the MIT License.

*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var display=require("@pixi/display"),utils=require("@pixi/utils"),accessibleTarget={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};display.DisplayObject.mixin(accessibleTarget);var KEY_CODE_TAB=9,DIV_TOUCH_SIZE=100,DIV_TOUCH_POS_X=0,DIV_TOUCH_POS_Y=0,DIV_TOUCH_ZINDEX=2,DIV_HOOK_SIZE=1,DIV_HOOK_POS_X=-1e3,DIV_HOOK_POS_Y=-1e3,DIV_HOOK_ZINDEX=2,AccessibilityManager=function(){function e(e){this._hookDiv=null,(utils.isMobile.tablet||utils.isMobile.phone)&&this.createTouchHook();var t=document.createElement("div");t.style.width=DIV_TOUCH_SIZE+"px",t.style.height=DIV_TOUCH_SIZE+"px",t.style.position="absolute",t.style.top=DIV_TOUCH_POS_X+"px",t.style.left=DIV_TOUCH_POS_Y+"px",t.style.zIndex=DIV_TOUCH_ZINDEX.toString(),this.div=t,this.pool=[],this.renderId=0,this.debug=!1,this.renderer=e,this.children=[],this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._isActive=!1,this._isMobileAccessibility=!1,this.androidUpdateCount=0,this.androidUpdateFrequency=500,self.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(e.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),e.prototype.createTouchHook=function(){var e=this,t=document.createElement("button");t.style.width=DIV_HOOK_SIZE+"px",t.style.height=DIV_HOOK_SIZE+"px",t.style.position="absolute",t.style.top=DIV_HOOK_POS_X+"px",t.style.left=DIV_HOOK_POS_Y+"px",t.style.zIndex=DIV_HOOK_ZINDEX.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",function(){e._isMobileAccessibility=!0,e.activate(),e.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t},e.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},e.prototype.activate=function(){this._isActive||(this._isActive=!0,self.document.addEventListener("mousemove",this._onMouseMove,!0),self.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),this.renderer.view.parentNode&&this.renderer.view.parentNode.appendChild(this.div))},e.prototype.deactivate=function(){this._isActive&&!this._isMobileAccessibility&&(this._isActive=!1,self.document.removeEventListener("mousemove",this._onMouseMove,!0),self.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),this.div.parentNode&&this.div.parentNode.removeChild(this.div))},e.prototype.updateAccessibleObjects=function(e){if(e.visible&&e.accessibleChildren){e.accessible&&e.interactive&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);for(var t=e.children,i=0;i<t.length;i++)this.updateAccessibleObjects(t[i])}},e.prototype.update=function(){var e=performance.now();if(!(utils.isMobile.android.device&&e<this.androidUpdateCount)&&(this.androidUpdateCount=e+this.androidUpdateFrequency,this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var t=this.renderer.view.getBoundingClientRect(),i=this.renderer.resolution,s=t.width/this.renderer.width*i,n=t.height/this.renderer.height*i,r=this.div;r.style.left=t.left+"px",r.style.top=t.top+"px",r.style.width=this.renderer.width+"px",r.style.height=this.renderer.height+"px";for(var o=0;o<this.children.length;o++){var l=this.children[o];if(l.renderId!==this.renderId)l._accessibleActive=!1,utils.removeItems(this.children,o,1),this.div.removeChild(l._accessibleDiv),this.pool.push(l._accessibleDiv),l._accessibleDiv=null,o--;else{r=l._accessibleDiv;var a=l.hitArea,c=l.worldTransform;l.hitArea?(r.style.left=(c.tx+a.x*c.a)*s+"px",r.style.top=(c.ty+a.y*c.d)*n+"px",r.style.width=a.width*c.a*s+"px",r.style.height=a.height*c.d*n+"px"):(a=l.getBounds(),this.capHitArea(a),r.style.left=a.x*s+"px",r.style.top=a.y*n+"px",r.style.width=a.width*s+"px",r.style.height=a.height*n+"px",r.title!==l.accessibleTitle&&null!==l.accessibleTitle&&(r.title=l.accessibleTitle),r.getAttribute("aria-label")!==l.accessibleHint&&null!==l.accessibleHint&&r.setAttribute("aria-label",l.accessibleHint)),l.accessibleTitle===r.title&&l.tabIndex===r.tabIndex||(r.title=l.accessibleTitle,r.tabIndex=l.tabIndex,this.debug&&this.updateDebugHTML(r))}}this.renderId++}},e.prototype.updateDebugHTML=function(e){e.innerHTML="type: "+e.type+"</br> title : "+e.title+"</br> tabIndex: "+e.tabIndex},e.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0),e.x+e.width>this.renderer.width&&(e.width=this.renderer.width-e.x),e.y+e.height>this.renderer.height&&(e.height=this.renderer.height-e.y)},e.prototype.addChild=function(e){var t=this.pool.pop();t||((t=document.createElement("button")).style.width=DIV_TOUCH_SIZE+"px",t.style.height=DIV_TOUCH_SIZE+"px",t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=DIV_TOUCH_ZINDEX.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&null!==e.accessibleTitle?t.title=e.accessibleTitle:e.accessibleHint&&null!==e.accessibleHint||(t.title="displayObject "+e.tabIndex),e.accessibleHint&&null!==e.accessibleHint&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this.updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex},e.prototype._onClick=function(e){var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"click",t.eventData),t.dispatchEvent(e.target.displayObject,"pointertap",t.eventData),t.dispatchEvent(e.target.displayObject,"tap",t.eventData)},e.prototype._onFocus=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive");var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"mouseover",t.eventData)},e.prototype._onFocusOut=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite");var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"mouseout",t.eventData)},e.prototype._onKeyDown=function(e){e.keyCode===KEY_CODE_TAB&&this.activate()},e.prototype._onMouseMove=function(e){0===e.movementX&&0===e.movementY||this.deactivate()},e.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,self.document.removeEventListener("mousemove",this._onMouseMove,!0),self.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},e}();exports.AccessibilityManager=AccessibilityManager,exports.accessibleTarget=accessibleTarget;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var display=require("@pixi/display"),utils=require("@pixi/utils"),accessibleTarget={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};display.DisplayObject.mixin(accessibleTarget);var KEY_CODE_TAB=9,DIV_TOUCH_SIZE=100,DIV_TOUCH_POS_X=0,DIV_TOUCH_POS_Y=0,DIV_TOUCH_ZINDEX=2,DIV_HOOK_SIZE=1,DIV_HOOK_POS_X=-1e3,DIV_HOOK_POS_Y=-1e3,DIV_HOOK_ZINDEX=2,AccessibilityManager=function(){function e(e){this._hookDiv=null,(utils.isMobile.tablet||utils.isMobile.phone)&&this.createTouchHook();var t=document.createElement("div");t.style.width=DIV_TOUCH_SIZE+"px",t.style.height=DIV_TOUCH_SIZE+"px",t.style.position="absolute",t.style.top=DIV_TOUCH_POS_X+"px",t.style.left=DIV_TOUCH_POS_Y+"px",t.style.zIndex=DIV_TOUCH_ZINDEX.toString(),this.div=t,this.pool=[],this.renderId=0,this.debug=!1,this.renderer=e,this.children=[],this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._isActive=!1,this._isMobileAccessibility=!1,this.androidUpdateCount=0,this.androidUpdateFrequency=500,self.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(e.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),e.prototype.createTouchHook=function(){var e=this,t=document.createElement("button");t.style.width=DIV_HOOK_SIZE+"px",t.style.height=DIV_HOOK_SIZE+"px",t.style.position="absolute",t.style.top=DIV_HOOK_POS_X+"px",t.style.left=DIV_HOOK_POS_Y+"px",t.style.zIndex=DIV_HOOK_ZINDEX.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",function(){e._isMobileAccessibility=!0,e.activate(),e.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t},e.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},e.prototype.activate=function(){var e;this._isActive||(this._isActive=!0,self.document.addEventListener("mousemove",this._onMouseMove,!0),self.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),null===(e=this.renderer.view.parentNode)||void 0===e||e.appendChild(this.div))},e.prototype.deactivate=function(){var e;this._isActive&&!this._isMobileAccessibility&&(this._isActive=!1,self.document.removeEventListener("mousemove",this._onMouseMove,!0),self.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),null===(e=this.div.parentNode)||void 0===e||e.removeChild(this.div))},e.prototype.updateAccessibleObjects=function(e){if(e.visible&&e.accessibleChildren){e.accessible&&e.interactive&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);for(var t=e.children,i=0;i<t.length;i++)this.updateAccessibleObjects(t[i])}},e.prototype.update=function(){var e=performance.now();if(!(utils.isMobile.android.device&&e<this.androidUpdateCount)&&(this.androidUpdateCount=e+this.androidUpdateFrequency,this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var t=this.renderer.view.getBoundingClientRect(),i=t.left,s=t.top,n=t.width,o=t.height,r=this.renderer,l=r.width,a=r.height,c=r.resolution,d=n/l*c,h=o/a*c,u=this.div;u.style.left=i+"px",u.style.top=s+"px",u.style.width=l+"px",u.style.height=a+"px";for(var p=0;p<this.children.length;p++){var b=this.children[p];if(b.renderId!==this.renderId)b._accessibleActive=!1,utils.removeItems(this.children,p,1),this.div.removeChild(b._accessibleDiv),this.pool.push(b._accessibleDiv),b._accessibleDiv=null,p--;else{u=b._accessibleDiv;var v=b.hitArea,y=b.worldTransform;b.hitArea?(u.style.left=(y.tx+v.x*y.a)*d+"px",u.style.top=(y.ty+v.y*y.d)*h+"px",u.style.width=v.width*y.a*d+"px",u.style.height=v.height*y.d*h+"px"):(v=b.getBounds(),this.capHitArea(v),u.style.left=v.x*d+"px",u.style.top=v.y*h+"px",u.style.width=v.width*d+"px",u.style.height=v.height*h+"px",u.title!==b.accessibleTitle&&null!==b.accessibleTitle&&(u.title=b.accessibleTitle),u.getAttribute("aria-label")!==b.accessibleHint&&null!==b.accessibleHint&&u.setAttribute("aria-label",b.accessibleHint)),b.accessibleTitle===u.title&&b.tabIndex===u.tabIndex||(u.title=b.accessibleTitle,u.tabIndex=b.tabIndex,this.debug&&this.updateDebugHTML(u))}}this.renderId++}},e.prototype.updateDebugHTML=function(e){e.innerHTML="type: "+e.type+"</br> title : "+e.title+"</br> tabIndex: "+e.tabIndex},e.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);var t=this.renderer,i=t.width,s=t.height;e.x+e.width>i&&(e.width=i-e.x),e.y+e.height>s&&(e.height=s-e.y)},e.prototype.addChild=function(e){var t=this.pool.pop();t||((t=document.createElement("button")).style.width=DIV_TOUCH_SIZE+"px",t.style.height=DIV_TOUCH_SIZE+"px",t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=DIV_TOUCH_ZINDEX.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&null!==e.accessibleTitle?t.title=e.accessibleTitle:e.accessibleHint&&null!==e.accessibleHint||(t.title="displayObject "+e.tabIndex),e.accessibleHint&&null!==e.accessibleHint&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this.updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex},e.prototype._onClick=function(e){var t=this.renderer.plugins.interaction,i=e.target.displayObject,s=t.eventData;t.dispatchEvent(i,"click",s),t.dispatchEvent(i,"pointertap",s),t.dispatchEvent(i,"tap",s)},e.prototype._onFocus=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive");var t=this.renderer.plugins.interaction,i=e.target.displayObject,s=t.eventData;t.dispatchEvent(i,"mouseover",s)},e.prototype._onFocusOut=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite");var t=this.renderer.plugins.interaction,i=e.target.displayObject,s=t.eventData;t.dispatchEvent(i,"mouseout",s)},e.prototype._onKeyDown=function(e){e.keyCode===KEY_CODE_TAB&&this.activate()},e.prototype._onMouseMove=function(e){0===e.movementX&&0===e.movementY||this.deactivate()},e.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,self.document.removeEventListener("mousemove",this._onMouseMove,!0),self.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},e}();exports.AccessibilityManager=AccessibilityManager,exports.accessibleTarget=accessibleTarget;
//# sourceMappingURL=accessibility.min.js.map
/*!
* @pixi/accessibility - v6.0.0-rc
* Compiled Tue, 29 Dec 2020 19:58:03 UTC
* @pixi/accessibility - v6.0.0-rc.2
* Compiled Thu, 14 Jan 2021 00:40:28 UTC
*

@@ -174,3 +174,3 @@ * @pixi/accessibility is licensed under the MIT License.

*
* @member {PIXI.AbstractRenderer}
* @member {PIXI.CanvasRenderer|PIXI.Renderer}
*/

@@ -282,2 +282,3 @@ this.renderer = renderer;

AccessibilityManager.prototype.activate = function () {
var _a;
if (this._isActive) {

@@ -289,7 +290,4 @@ return;

self.removeEventListener('keydown', this._onKeyDown, false);
// TODO: Remove casting when CanvasRenderer is converted
this.renderer.on('postrender', this.update, this);
if (this.renderer.view.parentNode) {
this.renderer.view.parentNode.appendChild(this.div);
}
(_a = this.renderer.view.parentNode) === null || _a === void 0 ? void 0 : _a.appendChild(this.div);
};

@@ -303,2 +301,3 @@ /**

AccessibilityManager.prototype.deactivate = function () {
var _a;
if (!this._isActive || this._isMobileAccessibility) {

@@ -310,7 +309,4 @@ return;

self.addEventListener('keydown', this._onKeyDown, false);
// TODO: Remove casting when CanvasRenderer is converted
this.renderer.off('postrender', this.update);
if (this.div.parentNode) {
this.div.parentNode.removeChild(this.div);
}
(_a = this.div.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.div);
};

@@ -360,12 +356,11 @@ /**

}
// TODO: Remove casting when CanvasRenderer is converted
var rect = this.renderer.view.getBoundingClientRect();
var resolution = this.renderer.resolution;
var sx = (rect.width / this.renderer.width) * resolution;
var sy = (rect.height / this.renderer.height) * resolution;
var _a = this.renderer.view.getBoundingClientRect(), left = _a.left, top = _a.top, width = _a.width, height = _a.height;
var _b = this.renderer, viewWidth = _b.width, viewHeight = _b.height, resolution = _b.resolution;
var sx = (width / viewWidth) * resolution;
var sy = (height / viewHeight) * resolution;
var div = this.div;
div.style.left = rect.left + "px";
div.style.top = rect.top + "px";
div.style.width = this.renderer.width + "px";
div.style.height = this.renderer.height + "px";
div.style.left = left + "px";
div.style.top = top + "px";
div.style.width = viewWidth + "px";
div.style.height = viewHeight + "px";
for (var i = 0; i < this.children.length; i++) {

@@ -443,8 +438,8 @@ var child = this.children[i];

}
// TODO: Remove casting when CanvasRenderer is converted
if (hitArea.x + hitArea.width > this.renderer.width) {
hitArea.width = this.renderer.width - hitArea.x;
var _a = this.renderer, viewWidth = _a.width, viewHeight = _a.height;
if (hitArea.x + hitArea.width > viewWidth) {
hitArea.width = viewWidth - hitArea.x;
}
if (hitArea.y + hitArea.height > this.renderer.height) {
hitArea.height = this.renderer.height - hitArea.y;
if (hitArea.y + hitArea.height > viewHeight) {
hitArea.height = viewHeight - hitArea.y;
}

@@ -520,7 +515,8 @@ };

AccessibilityManager.prototype._onClick = function (e) {
// TODO: Remove casting when CanvasRenderer is converted
var interactionManager = this.renderer.plugins.interaction;
interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData);
interactionManager.dispatchEvent(e.target.displayObject, 'pointertap', interactionManager.eventData);
interactionManager.dispatchEvent(e.target.displayObject, 'tap', interactionManager.eventData);
var displayObject = e.target.displayObject;
var eventData = interactionManager.eventData;
interactionManager.dispatchEvent(displayObject, 'click', eventData);
interactionManager.dispatchEvent(displayObject, 'pointertap', eventData);
interactionManager.dispatchEvent(displayObject, 'tap', eventData);
};

@@ -537,5 +533,6 @@ /**

}
// TODO: Remove casting when CanvasRenderer is converted
var interactionManager = this.renderer.plugins.interaction;
interactionManager.dispatchEvent(e.target.displayObject, 'mouseover', interactionManager.eventData);
var displayObject = e.target.displayObject;
var eventData = interactionManager.eventData;
interactionManager.dispatchEvent(displayObject, 'mouseover', eventData);
};

@@ -552,5 +549,6 @@ /**

}
// TODO: Remove casting when CanvasRenderer is converted
var interactionManager = this.renderer.plugins.interaction;
interactionManager.dispatchEvent(e.target.displayObject, 'mouseout', interactionManager.eventData);
var displayObject = e.target.displayObject;
var eventData = interactionManager.eventData;
interactionManager.dispatchEvent(displayObject, 'mouseout', eventData);
};

@@ -557,0 +555,0 @@ /**

/*!
* @pixi/accessibility - v6.0.0-rc
* Compiled Tue, 29 Dec 2020 19:58:03 UTC
* @pixi/accessibility - v6.0.0-rc.2
* Compiled Thu, 14 Jan 2021 00:40:28 UTC
*

@@ -8,3 +8,3 @@ * @pixi/accessibility is licensed under the MIT License.

*/
import{DisplayObject as e}from"@pixi/display";import{isMobile as t,removeItems as i}from"@pixi/utils";var s={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};e.mixin(s);var n=100,o=0,r=0,l=2,a=function(){function e(e){this._hookDiv=null,(t.tablet||t.phone)&&this.createTouchHook();var i=document.createElement("div");i.style.width=n+"px",i.style.height=n+"px",i.style.position="absolute",i.style.top=o+"px",i.style.left=r+"px",i.style.zIndex=l.toString(),this.div=i,this.pool=[],this.renderId=0,this.debug=!1,this.renderer=e,this.children=[],this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._isActive=!1,this._isMobileAccessibility=!1,this.androidUpdateCount=0,this.androidUpdateFrequency=500,self.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(e.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),e.prototype.createTouchHook=function(){var e=this,t=document.createElement("button");t.style.width="1px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",t.style.zIndex=2..toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",function(){e._isMobileAccessibility=!0,e.activate(),e.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t},e.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},e.prototype.activate=function(){this._isActive||(this._isActive=!0,self.document.addEventListener("mousemove",this._onMouseMove,!0),self.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),this.renderer.view.parentNode&&this.renderer.view.parentNode.appendChild(this.div))},e.prototype.deactivate=function(){this._isActive&&!this._isMobileAccessibility&&(this._isActive=!1,self.document.removeEventListener("mousemove",this._onMouseMove,!0),self.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),this.div.parentNode&&this.div.parentNode.removeChild(this.div))},e.prototype.updateAccessibleObjects=function(e){if(e.visible&&e.accessibleChildren){e.accessible&&e.interactive&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);for(var t=e.children,i=0;i<t.length;i++)this.updateAccessibleObjects(t[i])}},e.prototype.update=function(){var e=performance.now();if(!(t.android.device&&e<this.androidUpdateCount)&&(this.androidUpdateCount=e+this.androidUpdateFrequency,this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var s=this.renderer.view.getBoundingClientRect(),n=this.renderer.resolution,o=s.width/this.renderer.width*n,r=s.height/this.renderer.height*n,l=this.div;l.style.left=s.left+"px",l.style.top=s.top+"px",l.style.width=this.renderer.width+"px",l.style.height=this.renderer.height+"px";for(var a=0;a<this.children.length;a++){var c=this.children[a];if(c.renderId!==this.renderId)c._accessibleActive=!1,i(this.children,a,1),this.div.removeChild(c._accessibleDiv),this.pool.push(c._accessibleDiv),c._accessibleDiv=null,a--;else{l=c._accessibleDiv;var d=c.hitArea,h=c.worldTransform;c.hitArea?(l.style.left=(h.tx+d.x*h.a)*o+"px",l.style.top=(h.ty+d.y*h.d)*r+"px",l.style.width=d.width*h.a*o+"px",l.style.height=d.height*h.d*r+"px"):(d=c.getBounds(),this.capHitArea(d),l.style.left=d.x*o+"px",l.style.top=d.y*r+"px",l.style.width=d.width*o+"px",l.style.height=d.height*r+"px",l.title!==c.accessibleTitle&&null!==c.accessibleTitle&&(l.title=c.accessibleTitle),l.getAttribute("aria-label")!==c.accessibleHint&&null!==c.accessibleHint&&l.setAttribute("aria-label",c.accessibleHint)),c.accessibleTitle===l.title&&c.tabIndex===l.tabIndex||(l.title=c.accessibleTitle,l.tabIndex=c.tabIndex,this.debug&&this.updateDebugHTML(l))}}this.renderId++}},e.prototype.updateDebugHTML=function(e){e.innerHTML="type: "+e.type+"</br> title : "+e.title+"</br> tabIndex: "+e.tabIndex},e.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0),e.x+e.width>this.renderer.width&&(e.width=this.renderer.width-e.x),e.y+e.height>this.renderer.height&&(e.height=this.renderer.height-e.y)},e.prototype.addChild=function(e){var t=this.pool.pop();t||((t=document.createElement("button")).style.width=n+"px",t.style.height=n+"px",t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=l.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&null!==e.accessibleTitle?t.title=e.accessibleTitle:e.accessibleHint&&null!==e.accessibleHint||(t.title="displayObject "+e.tabIndex),e.accessibleHint&&null!==e.accessibleHint&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this.updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex},e.prototype._onClick=function(e){var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"click",t.eventData),t.dispatchEvent(e.target.displayObject,"pointertap",t.eventData),t.dispatchEvent(e.target.displayObject,"tap",t.eventData)},e.prototype._onFocus=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive");var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"mouseover",t.eventData)},e.prototype._onFocusOut=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite");var t=this.renderer.plugins.interaction;t.dispatchEvent(e.target.displayObject,"mouseout",t.eventData)},e.prototype._onKeyDown=function(e){9===e.keyCode&&this.activate()},e.prototype._onMouseMove=function(e){0===e.movementX&&0===e.movementY||this.deactivate()},e.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,self.document.removeEventListener("mousemove",this._onMouseMove,!0),self.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},e}();export{a as AccessibilityManager,s as accessibleTarget};
import{DisplayObject as e}from"@pixi/display";import{isMobile as t,removeItems as i}from"@pixi/utils";var s={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};e.mixin(s);var n=100,o=0,r=0,l=2,a=function(){function e(e){this._hookDiv=null,(t.tablet||t.phone)&&this.createTouchHook();var i=document.createElement("div");i.style.width=n+"px",i.style.height=n+"px",i.style.position="absolute",i.style.top=o+"px",i.style.left=r+"px",i.style.zIndex=l.toString(),this.div=i,this.pool=[],this.renderId=0,this.debug=!1,this.renderer=e,this.children=[],this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._isActive=!1,this._isMobileAccessibility=!1,this.androidUpdateCount=0,this.androidUpdateFrequency=500,self.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(e.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),e.prototype.createTouchHook=function(){var e=this,t=document.createElement("button");t.style.width="1px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",t.style.zIndex=2..toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",function(){e._isMobileAccessibility=!0,e.activate(),e.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t},e.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},e.prototype.activate=function(){var e;this._isActive||(this._isActive=!0,self.document.addEventListener("mousemove",this._onMouseMove,!0),self.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),null===(e=this.renderer.view.parentNode)||void 0===e||e.appendChild(this.div))},e.prototype.deactivate=function(){var e;this._isActive&&!this._isMobileAccessibility&&(this._isActive=!1,self.document.removeEventListener("mousemove",this._onMouseMove,!0),self.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),null===(e=this.div.parentNode)||void 0===e||e.removeChild(this.div))},e.prototype.updateAccessibleObjects=function(e){if(e.visible&&e.accessibleChildren){e.accessible&&e.interactive&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);for(var t=e.children,i=0;i<t.length;i++)this.updateAccessibleObjects(t[i])}},e.prototype.update=function(){var e=performance.now();if(!(t.android.device&&e<this.androidUpdateCount)&&(this.androidUpdateCount=e+this.androidUpdateFrequency,this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var s=this.renderer.view.getBoundingClientRect(),n=s.left,o=s.top,r=s.width,l=s.height,a=this.renderer,c=a.width,d=a.height,h=a.resolution,p=r/c*h,u=l/d*h,b=this.div;b.style.left=n+"px",b.style.top=o+"px",b.style.width=c+"px",b.style.height=d+"px";for(var v=0;v<this.children.length;v++){var y=this.children[v];if(y.renderId!==this.renderId)y._accessibleActive=!1,i(this.children,v,1),this.div.removeChild(y._accessibleDiv),this.pool.push(y._accessibleDiv),y._accessibleDiv=null,v--;else{b=y._accessibleDiv;var f=y.hitArea,g=y.worldTransform;y.hitArea?(b.style.left=(g.tx+f.x*g.a)*p+"px",b.style.top=(g.ty+f.y*g.d)*u+"px",b.style.width=f.width*g.a*p+"px",b.style.height=f.height*g.d*u+"px"):(f=y.getBounds(),this.capHitArea(f),b.style.left=f.x*p+"px",b.style.top=f.y*u+"px",b.style.width=f.width*p+"px",b.style.height=f.height*u+"px",b.title!==y.accessibleTitle&&null!==y.accessibleTitle&&(b.title=y.accessibleTitle),b.getAttribute("aria-label")!==y.accessibleHint&&null!==y.accessibleHint&&b.setAttribute("aria-label",y.accessibleHint)),y.accessibleTitle===b.title&&y.tabIndex===b.tabIndex||(b.title=y.accessibleTitle,b.tabIndex=y.tabIndex,this.debug&&this.updateDebugHTML(b))}}this.renderId++}},e.prototype.updateDebugHTML=function(e){e.innerHTML="type: "+e.type+"</br> title : "+e.title+"</br> tabIndex: "+e.tabIndex},e.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);var t=this.renderer,i=t.width,s=t.height;e.x+e.width>i&&(e.width=i-e.x),e.y+e.height>s&&(e.height=s-e.y)},e.prototype.addChild=function(e){var t=this.pool.pop();t||((t=document.createElement("button")).style.width=n+"px",t.style.height=n+"px",t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=l.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&null!==e.accessibleTitle?t.title=e.accessibleTitle:e.accessibleHint&&null!==e.accessibleHint||(t.title="displayObject "+e.tabIndex),e.accessibleHint&&null!==e.accessibleHint&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this.updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex},e.prototype._onClick=function(e){var t=this.renderer.plugins.interaction,i=e.target.displayObject,s=t.eventData;t.dispatchEvent(i,"click",s),t.dispatchEvent(i,"pointertap",s),t.dispatchEvent(i,"tap",s)},e.prototype._onFocus=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive");var t=this.renderer.plugins.interaction,i=e.target.displayObject,s=t.eventData;t.dispatchEvent(i,"mouseover",s)},e.prototype._onFocusOut=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite");var t=this.renderer.plugins.interaction,i=e.target.displayObject,s=t.eventData;t.dispatchEvent(i,"mouseout",s)},e.prototype._onKeyDown=function(e){9===e.keyCode&&this.activate()},e.prototype._onMouseMove=function(e){0===e.movementX&&0===e.movementY||this.deactivate()},e.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,self.document.removeEventListener("mousemove",this._onMouseMove,!0),self.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},e}();export{a as AccessibilityManager,s as accessibleTarget};
//# sourceMappingURL=accessibility.min.js.map
/// <reference path="./global.d.ts" />
import type { AbstractRenderer } from '@pixi/core';
import type { CanvasRenderer } from '@pixi/canvas-renderer';
import type { DisplayObject } from '@pixi/display';

@@ -22,3 +22,3 @@ import type { Rectangle } from '@pixi/math';

debug: boolean;
renderer: AbstractRenderer | Renderer;
renderer: CanvasRenderer | Renderer;
private _isActive;

@@ -36,3 +36,3 @@ private _isMobileAccessibility;

*/
constructor(renderer: AbstractRenderer | Renderer);
constructor(renderer: CanvasRenderer | Renderer);
/**

@@ -39,0 +39,0 @@ * A flag

{
"name": "@pixi/accessibility",
"version": "6.0.0-rc",
"version": "6.0.0-rc.2",
"main": "dist/cjs/accessibility.js",

@@ -28,10 +28,8 @@ "module": "dist/esm/accessibility.js",

"dependencies": {
"@pixi/core": "6.0.0-rc",
"@pixi/display": "6.0.0-rc",
"@pixi/utils": "6.0.0-rc"
"@pixi/canvas-renderer": "6.0.0-rc.2",
"@pixi/core": "6.0.0-rc.2",
"@pixi/display": "6.0.0-rc.2",
"@pixi/utils": "6.0.0-rc.2"
},
"devDependencies": {
"@pixi/canvas-renderer": "6.0.0-rc"
},
"gitHead": "15513755f4d9f2112df5cc261b44f2dc1f05e00c"
"gitHead": "48e4870fd31b2ea731120fa12bcabb4155fd3b08"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc