Add button to open context menu (#728)
* Add button to open context menu
In some contexts, it's hard or impossible to open the context menu of the emulator, which is required to access important secondary options such as quick states, screen recording, and software information. Primarily, it's apparently impossible to open the context menu on a mobile web browser, since a long press on the screen is, for good reason, not registered like a right mouse click is on desktop. This commit adds what I think is the ideal solution to the issue: a button on the menu bar/drawer that opens up the context menu, without cluttering it up with multiple options, just a single new one.
* Update en locale (en.json, Translate.html)
* Fix contextMenuButton dimensions
* Set contextMenu to be centered when open via button
2023-12-12 14:58:46 +00:00
|
|
|
!function(){var e,t;e=window,t=function(){return n=[function(e,t,n){"use strict";n.r(t);function b(e,t){var n=t.x-e.x,t=t.y-e.y;return Math.sqrt(n*n+t*t)}function _(e){return e*(Math.PI/180)}function o(e){f.has(e)&&clearTimeout(f.get(e)),f.set(e,setTimeout(e,100))}function a(e,t,n){for(var i,o=t.split(/[ ,]+/g),a=0;a<o.length;a+=1)i=o[a],e.addEventListener?e.addEventListener(i,n,!1):e.attachEvent&&e.attachEvent(i,n)}function i(e,t,n){for(var i,o=t.split(/[ ,]+/g),a=0;a<o.length;a+=1)i=o[a],e.removeEventListener?e.removeEventListener(i,n):e.detachEvent&&e.detachEvent(i,n)}function s(e){return e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e}function r(){return{x:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}}function l(e,t){t.top||t.right||t.bottom||t.left?(e.style.top=t.top,e.style.right=t.right,e.style.bottom=t.bottom,e.style.left=t.left):(e.style.left=t.x+"px",e.style.top=t.y+"px")}function c(e,t,n){var i,o=h(e);for(i in o)if(o.hasOwnProperty(i))if("string"==typeof t)o[i]=t+" "+n;else{for(var a="",s=0,r=t.length;s<r;s+=1)a+=t[s]+" "+n+", ";o[i]=a.slice(0,-2)}return o}function h(t){var n={};return n[t]="",["webkit","Moz","o"].forEach(function(e){n[e+t.charAt(0).toUpperCase()+t.slice(1)]=""}),n}function d(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function u(e,t){if(e.length)for(var n=0,i=e.length;n<i;n+=1)t(e[n]);else t(e)}var p,f=new Map,n=!!("ontouchstart"in window),m=!!window.PointerEvent,g=!!window.MSPointerEvent,y={start:"mousedown",move:"mousemove",end:"mouseup"},v={};function T(){}m?p={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:g?p={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:n?(p={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},v=y):p=y,T.prototype.on=function(e,t){var n,i=e.split(/[ ,]+/g);this._handlers_=this._handlers_||{};for(var o=0;o<i.length;o+=1)n=i[o],this._handlers_[n]=this._handlers_[n]||[],this._handlers_[n].push(t);return this},T.prototype.off=function(e,t){return this._handlers_=this._handlers_||{},void 0===e?this._handlers_={}:void 0===t?this._handlers_[e]=null:this._handlers_[e]&&0<=this._handlers_[e].indexOf(t)&&this._handlers_[e].splice(this._handlers_[e].indexOf(t),1),this},T.prototype.trigger=function(e,t){var n,i=this,o=e.split(/[ ,]+/g);i._handlers_=i._handlers_||{};for(var a=0;a<o.length;a+=1)n=o[a],i._handlers_[n]&&i._handlers_[n].length&&i._handlers_[n].forEach(function(e){e.call(i,{type:n,target:i},t)})},T.prototype.config=function(e){this.options=this.defaults||{},e&&(this.options=function(e,t){var n,i={};for(n in e)e.hasOwnProperty(n)&&t.hasOwnProperty(n)?i[n]=t[n]:e.hasOwnProperty(n)&&(i[n]=e[n]);return i}(this.options,e))},T.prototype.bindEvt=function(e,t){var n=this;return n._domHandlers_=n._domHandlers_||{},n._domHandlers_[t]=function(){"function"==typeof n["on"+t]?n["on"+t].apply(n,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},a(e,p[t],n._domHandlers_[t]),v[t]&&a(e,v[t],n._domHandlers_[t]),n},T.prototype.unbindEvt=function(e,t){return this._domHandlers_=this._domHandlers_||{},i(e,p[t],this._domHandlers_[t]),v[t]&&i(e,v[t],this._domHandlers_[t]),delete this._domHandlers_[t],this};m=T;function w(e,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=e,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),"dynamic"===this.options.mode&&(this.options.restOpacity=0),this.id=w.id,w.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirect
|