mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-26 13:37:58 +01:00
[516] Scaling and TGUI fixes (#28809)
* [516] Scaling and TGUI fixes * fuck it we go with this * ??? * final changes * whoops
This commit is contained in:
@@ -86,6 +86,15 @@
|
||||
for(var/file in scripts)
|
||||
head_content += "<script type='text/javascript' src='[SSassets.transport.get_asset_url(file)]'></script>"
|
||||
|
||||
if(user.client.window_scaling && user.client.window_scaling != 1)
|
||||
head_content += {"
|
||||
<style>
|
||||
body {
|
||||
zoom: [100 / user.client.window_scaling]%;
|
||||
}
|
||||
</style>
|
||||
"}
|
||||
|
||||
return {"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
@@ -122,6 +131,10 @@
|
||||
var/window_size = ""
|
||||
if(width && height)
|
||||
window_size = "size=[width]x[height];"
|
||||
if(user?.client?.window_scaling)
|
||||
window_size = "size=[width * user.client.window_scaling]x[height * user.client.window_scaling];"
|
||||
else
|
||||
window_size = "size=[width]x[height];"
|
||||
if(include_default_stylesheet)
|
||||
var/datum/asset/simple/common/common_asset = get_asset_datum(/datum/asset/simple/common)
|
||||
common_asset.send(user)
|
||||
|
||||
@@ -255,6 +255,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>[title]</title>
|
||||
<link rel="stylesheet" type="text/css" href="[SSassets.transport.get_asset_url("view_variables.css")]">
|
||||
[window_scaling ? "<style>body {zoom: [100 / window_scaling]%;}</style>" : ""]
|
||||
</head>
|
||||
<body onload='selectTextField(); updateSearch()' onkeydown='return checkreload()' onkeyup='updateSearch()'>
|
||||
<script type="text/javascript">
|
||||
@@ -453,7 +454,9 @@
|
||||
|
||||
if(istype(D, /datum))
|
||||
log_admin("[key_name(usr)] opened VV for [D] ([D.UID()])")
|
||||
usr << browse(html, "window=variables[refid];size=475x650")
|
||||
|
||||
var/size_string = window_scaling ? "size=[475 * window_scaling]x[650 * window_scaling]" : "size=[475]x[650]"
|
||||
usr << browse(html, "window=variables[refid];[size_string]")
|
||||
|
||||
#define VV_HTML_ENCODE(thing) ( sanitize ? html_encode(thing) : thing )
|
||||
/proc/debug_variable(name, value, level, datum/owner, sanitize = TRUE)
|
||||
|
||||
@@ -232,3 +232,6 @@
|
||||
|
||||
/// Cache of MD5'd UIDs. This is to stop clients from poking at object UIDs and being exploity with them
|
||||
var/list/m5_uid_cache = list()
|
||||
|
||||
/// If this client has any windows scaling applied
|
||||
var/window_scaling
|
||||
|
||||
@@ -414,6 +414,8 @@
|
||||
to_chat(src, message)
|
||||
GLOB.clientmessages.Remove(ckey)
|
||||
|
||||
acquire_dpi()
|
||||
|
||||
if(SSinput.initialized)
|
||||
set_macros()
|
||||
|
||||
@@ -1327,6 +1329,15 @@
|
||||
to_chat(src, "All sounds stopped.")
|
||||
tgui_panel?.stop_music()
|
||||
|
||||
/client/proc/acquire_dpi()
|
||||
set waitfor = FALSE
|
||||
|
||||
// Remove with 516
|
||||
if(byond_version < 516)
|
||||
return
|
||||
|
||||
window_scaling = text2num(winget(src, null, "dpi"))
|
||||
|
||||
#undef LIMITER_SIZE
|
||||
#undef CURRENT_SECOND
|
||||
#undef SECOND_COUNT
|
||||
|
||||
@@ -74,6 +74,7 @@ export class TguiSay extends Component<{}, State> {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
windowSet(WINDOW_SIZES.small);
|
||||
Byond.subscribeTo('props', this.handleProps);
|
||||
Byond.subscribeTo('open', this.handleOpen);
|
||||
}
|
||||
@@ -284,6 +285,7 @@ export class TguiSay extends Component<{}, State> {
|
||||
const { maxLength, lightMode } = data;
|
||||
this.maxLength = maxLength;
|
||||
this.lightMode = !!lightMode;
|
||||
window.document.body.style['zoom'] = `${100 / window.devicePixelRatio}%`;
|
||||
};
|
||||
|
||||
reset() {
|
||||
|
||||
@@ -39,8 +39,13 @@ export const windowSet = (size = WINDOW_SIZES.small) => {
|
||||
|
||||
/** Helper function to set window size and visibility */
|
||||
const setWindowVisibility = (visible: boolean) => {
|
||||
let sizeStr = `${WINDOW_SIZES.width}x${WINDOW_SIZES.small}`;
|
||||
Byond.winset('tgui_say', {
|
||||
'is-visible': visible,
|
||||
size: `${WINDOW_SIZES.width}x${WINDOW_SIZES.small}`,
|
||||
size: sizeStr,
|
||||
});
|
||||
|
||||
Byond.winset('tgui_say.browser', {
|
||||
size: sizeStr,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -156,6 +156,7 @@ export class Input extends Component {
|
||||
<input
|
||||
ref={this.inputRef}
|
||||
className="Input__input"
|
||||
type="search"
|
||||
placeholder={placeholder}
|
||||
onInput={this.handleInput}
|
||||
onFocus={this.handleFocus}
|
||||
|
||||
@@ -102,6 +102,7 @@ export const recallWindowGeometry = async (options = {}) => {
|
||||
size = [Math.min(areaAvailable[0], size[0]), Math.min(areaAvailable[1], size[1])];
|
||||
setWindowSize(size);
|
||||
}
|
||||
window.document.body.style['zoom'] = `${100 / window.devicePixelRatio}%`;
|
||||
// Set window position
|
||||
if (pos) {
|
||||
// Constraint window position if monitor lock was set in preferences.
|
||||
|
||||
@@ -308,7 +308,7 @@
|
||||
* @file
|
||||
* @copyright 2020 Aleksej Komarov
|
||||
* @license MIT
|
||||
*/var s=e.toInputValue=function(){function c(g){return typeof g!="number"&&typeof g!="string"?"":String(g)}return c}(),d=e.Input=function(c){function g(){var v;return v=c.call(this)||this,v.inputRef=(0,n.createRef)(),v.state={editing:!1},v.handleInput=function(m){var E=v.state.editing,I=v.props.onInput;E||v.setEditing(!0),I&&I(m,m.target.value)},v.handleFocus=function(m){var E=v.state.editing;E||v.setEditing(!0)},v.handleBlur=function(m){var E=v.state.editing,I=v.props.onChange;E&&(v.setEditing(!1),I&&I(m,m.target.value))},v.handleKeyDown=function(m){var E=v.props,I=E.onInput,O=E.onChange,b=E.onEnter;if(m.keyCode===a.KEY_ENTER){v.setEditing(!1),O&&O(m,m.target.value),I&&I(m,m.target.value),b&&b(m,m.target.value),v.props.selfClear?m.target.value="":m.target.blur();return}if(m.keyCode===a.KEY_ESCAPE){v.setEditing(!1),m.target.value=s(v.props.value),m.target.blur();return}},v}p(g,c);var f=g.prototype;return f.componentDidMount=function(){function v(){var m=this,E=this.props.value,I=this.inputRef.current;I&&(I.value=s(E),I.selectionStart=0,I.selectionEnd=I.value.length),(this.props.autoFocus||this.props.autoSelect)&&setTimeout(function(){I.focus(),m.props.autoSelect&&I.select()},1)}return v}(),f.componentDidUpdate=function(){function v(m,E){var I=this.state.editing,O=m.value,b=this.props.value,S=this.inputRef.current;S&&!I&&O!==b&&(S.value=s(b))}return v}(),f.setEditing=function(){function v(m){this.setState({editing:m})}return v}(),f.render=function(){function v(){var m=this.props,E=m.selfClear,I=m.onInput,O=m.onChange,b=m.onEnter,S=m.value,T=m.maxLength,C=m.placeholder,A=m.autofocus,P=m.disabled,M=m.multiline,w=m.cols,V=w===void 0?32:w,U=m.rows,j=U===void 0?4:U,G=l(m,u),$=G.className,x=G.fluid,B=G.monospace,F=l(G,i);return(0,n.normalizeProps)((0,n.createComponentVNode)(2,o.Box,Object.assign({className:(0,r.classes)(["Input",x&&"Input--fluid",B&&"Input--monospace",P&&"Input--disabled",$])},F,{children:[(0,n.createVNode)(1,"div","Input__baseline",".",16),M?(0,n.createVNode)(128,"textarea","Input__textarea",null,1,{placeholder:C,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,maxLength:T,cols:V,rows:j,disabled:P},null,this.inputRef):(0,n.createVNode)(64,"input","Input__input",null,1,{placeholder:C,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,maxLength:T,disabled:P},null,this.inputRef)]})))}return v}(),g}(n.Component)},4454:function(y,e,t){"use strict";e.__esModule=!0,e.Interactive=void 0;var n=t(89005),r=t(44879);function o(p,h){p.prototype=Object.create(h.prototype),p.prototype.constructor=p,a(p,h)}function a(p,h){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,d){return s.__proto__=d,s},a(p,h)}var u=function(h){return h&&h.ownerDocument.defaultView||self},i=function(h,s){var d=h.getBoundingClientRect(),c=s;return{left:(0,r.clamp)((c.pageX-(d.left+u(h).pageXOffset))/d.width,0,1),top:(0,r.clamp)((c.pageY-(d.top+u(h).pageYOffset))/d.height,0,1)}},l=e.Interactive=function(p){function h(d){var c;return c=p.call(this)||this,c.containerRef=void 0,c.props=void 0,c.handleMoveStart=function(g){var f,v=(f=c.containerRef)==null?void 0:f.current;v&&(g.preventDefault(),v.focus(),c.props.onMove(i(v,g)),c.toggleDocumentEvents(!0))},c.handleMove=function(g){var f;g.preventDefault();var v=g.buttons>0;v&&(f=c.containerRef)!=null&&f.current?c.props.onMove(i(c.containerRef.current,g)):c.toggleDocumentEvents(!1)},c.handleMoveEnd=function(){c.toggleDocumentEvents(!1)},c.handleKeyDown=function(g){var f=g.which||g.keyCode;f<37||f>40||(g.preventDefault(),c.props.onKey({left:f===39?.05:f===37?-.05:0,top:f===40?.05:f===38?-.05:0}))},c.props=d,c.containerRef=(0,n.createRef)(),c}o(h,p);var s=h.prototype;return s.toggleDocumentEvents=function(){function d(c){var g,f=(g=this.containerRef)==null?void 0:g.current,v=u(f),m=c?v.addEventListener:v.removeEventListener;m("mousemove",this.handleMove),m("mouseup",this.handleMoveEnd)}return d}(),s.componentDidMount=function(){function d(){this.toggleDocumentEvents(!0)}return d}(),s.componentWillUnmount=function(){function d(){this.toggleDocumentEvents(!1)}return d}(),s.render=function(){function d(){return(0,n.normalizeProps)((0,n.createVNode)(1,"div","react-colorful__interactive",this.props.children,0,Object.assign({},this.props,{style:this.props.style,onMouseDown:this.handleMoveStart,onKeyDown:this.handleKeyDown,tabIndex:0,role:"slider"}),null,this.containerRef))}return d}(),h}(n.Component)},76334:function(y,e,t){"use strict";e.__esModule=!0,e.Knob=void 0;var n=t(89005),r=t(44879),o=t(35840),a=t(55937),u=t(20342),i=t(59263),l=["animated","format","maxValue","minValue","onChange","onDrag","step","stepPixelSize","suppressFlicker","unit","value","className","style","fillValue","color","ranges","size","bipolar","children","popUpPosition"];/**
|
||||
*/var s=e.toInputValue=function(){function c(g){return typeof g!="number"&&typeof g!="string"?"":String(g)}return c}(),d=e.Input=function(c){function g(){var v;return v=c.call(this)||this,v.inputRef=(0,n.createRef)(),v.state={editing:!1},v.handleInput=function(m){var E=v.state.editing,I=v.props.onInput;E||v.setEditing(!0),I&&I(m,m.target.value)},v.handleFocus=function(m){var E=v.state.editing;E||v.setEditing(!0)},v.handleBlur=function(m){var E=v.state.editing,I=v.props.onChange;E&&(v.setEditing(!1),I&&I(m,m.target.value))},v.handleKeyDown=function(m){var E=v.props,I=E.onInput,O=E.onChange,b=E.onEnter;if(m.keyCode===a.KEY_ENTER){v.setEditing(!1),O&&O(m,m.target.value),I&&I(m,m.target.value),b&&b(m,m.target.value),v.props.selfClear?m.target.value="":m.target.blur();return}if(m.keyCode===a.KEY_ESCAPE){v.setEditing(!1),m.target.value=s(v.props.value),m.target.blur();return}},v}p(g,c);var f=g.prototype;return f.componentDidMount=function(){function v(){var m=this,E=this.props.value,I=this.inputRef.current;I&&(I.value=s(E),I.selectionStart=0,I.selectionEnd=I.value.length),(this.props.autoFocus||this.props.autoSelect)&&setTimeout(function(){I.focus(),m.props.autoSelect&&I.select()},1)}return v}(),f.componentDidUpdate=function(){function v(m,E){var I=this.state.editing,O=m.value,b=this.props.value,S=this.inputRef.current;S&&!I&&O!==b&&(S.value=s(b))}return v}(),f.setEditing=function(){function v(m){this.setState({editing:m})}return v}(),f.render=function(){function v(){var m=this.props,E=m.selfClear,I=m.onInput,O=m.onChange,b=m.onEnter,S=m.value,T=m.maxLength,C=m.placeholder,A=m.autofocus,P=m.disabled,M=m.multiline,w=m.cols,V=w===void 0?32:w,U=m.rows,j=U===void 0?4:U,G=l(m,u),$=G.className,x=G.fluid,B=G.monospace,F=l(G,i);return(0,n.normalizeProps)((0,n.createComponentVNode)(2,o.Box,Object.assign({className:(0,r.classes)(["Input",x&&"Input--fluid",B&&"Input--monospace",P&&"Input--disabled",$])},F,{children:[(0,n.createVNode)(1,"div","Input__baseline",".",16),M?(0,n.createVNode)(128,"textarea","Input__textarea",null,1,{placeholder:C,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,maxLength:T,cols:V,rows:j,disabled:P},null,this.inputRef):(0,n.createVNode)(64,"input","Input__input",null,1,{type:"search",placeholder:C,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,maxLength:T,disabled:P},null,this.inputRef)]})))}return v}(),g}(n.Component)},4454:function(y,e,t){"use strict";e.__esModule=!0,e.Interactive=void 0;var n=t(89005),r=t(44879);function o(p,h){p.prototype=Object.create(h.prototype),p.prototype.constructor=p,a(p,h)}function a(p,h){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,d){return s.__proto__=d,s},a(p,h)}var u=function(h){return h&&h.ownerDocument.defaultView||self},i=function(h,s){var d=h.getBoundingClientRect(),c=s;return{left:(0,r.clamp)((c.pageX-(d.left+u(h).pageXOffset))/d.width,0,1),top:(0,r.clamp)((c.pageY-(d.top+u(h).pageYOffset))/d.height,0,1)}},l=e.Interactive=function(p){function h(d){var c;return c=p.call(this)||this,c.containerRef=void 0,c.props=void 0,c.handleMoveStart=function(g){var f,v=(f=c.containerRef)==null?void 0:f.current;v&&(g.preventDefault(),v.focus(),c.props.onMove(i(v,g)),c.toggleDocumentEvents(!0))},c.handleMove=function(g){var f;g.preventDefault();var v=g.buttons>0;v&&(f=c.containerRef)!=null&&f.current?c.props.onMove(i(c.containerRef.current,g)):c.toggleDocumentEvents(!1)},c.handleMoveEnd=function(){c.toggleDocumentEvents(!1)},c.handleKeyDown=function(g){var f=g.which||g.keyCode;f<37||f>40||(g.preventDefault(),c.props.onKey({left:f===39?.05:f===37?-.05:0,top:f===40?.05:f===38?-.05:0}))},c.props=d,c.containerRef=(0,n.createRef)(),c}o(h,p);var s=h.prototype;return s.toggleDocumentEvents=function(){function d(c){var g,f=(g=this.containerRef)==null?void 0:g.current,v=u(f),m=c?v.addEventListener:v.removeEventListener;m("mousemove",this.handleMove),m("mouseup",this.handleMoveEnd)}return d}(),s.componentDidMount=function(){function d(){this.toggleDocumentEvents(!0)}return d}(),s.componentWillUnmount=function(){function d(){this.toggleDocumentEvents(!1)}return d}(),s.render=function(){function d(){return(0,n.normalizeProps)((0,n.createVNode)(1,"div","react-colorful__interactive",this.props.children,0,Object.assign({},this.props,{style:this.props.style,onMouseDown:this.handleMoveStart,onKeyDown:this.handleKeyDown,tabIndex:0,role:"slider"}),null,this.containerRef))}return d}(),h}(n.Component)},76334:function(y,e,t){"use strict";e.__esModule=!0,e.Knob=void 0;var n=t(89005),r=t(44879),o=t(35840),a=t(55937),u=t(20342),i=t(59263),l=["animated","format","maxValue","minValue","onChange","onDrag","step","stepPixelSize","suppressFlicker","unit","value","className","style","fillValue","color","ranges","size","bipolar","children","popUpPosition"];/**
|
||||
* @file
|
||||
* @copyright 2020 Aleksej Komarov
|
||||
* @license MIT
|
||||
@@ -393,7 +393,7 @@
|
||||
* @file
|
||||
* @copyright 2020 Aleksej Komarov
|
||||
* @license MIT
|
||||
*/var l=(0,o.createLogger)("drag"),p=Byond.windowId,h=!1,s=!1,d=[0,0],c,g,f,v,m,E=e.setWindowKey=function(){function F(H){p=H}return F}(),I=e.getWindowPosition=function(){function F(){return[window.screenLeft,window.screenTop]}return F}(),O=e.getWindowSize=function(){function F(){return[window.innerWidth,window.innerHeight]}return F}(),b=e.setWindowPosition=function(){function F(H){var K=(0,r.vecAdd)(H,d);return Byond.winset(Byond.windowId,{pos:K[0]+","+K[1]})}return F}(),S=e.setWindowSize=function(){function F(H){return Byond.winset(Byond.windowId,{size:H[0]+"x"+H[1]})}return F}(),T=e.getScreenPosition=function(){function F(){return[0-d[0],0-d[1]]}return F}(),C=e.getScreenSize=function(){function F(){return[window.screen.availWidth,window.screen.availHeight]}return F}(),A=function(H,K,W){W===void 0&&(W=50);for(var q=[K],ut,ct=0;ct<H.length;ct++){var Q=H[ct];Q!==K&&(q.length<W?q.push(Q):ut=Q)}return[q,ut]},P=e.storeWindowGeometry=function(){var F=i(a().mark(function(){function H(){var K,W,q,ut;return a().wrap(function(){function ct(Q){for(;;)switch(Q.prev=Q.next){case 0:return l.log("storing geometry"),K={pos:I(),size:O()},n.storage.set(p,K),Q.t0=A,Q.next=6,n.storage.get("geometries");case 6:if(Q.t1=Q.sent,Q.t1){Q.next=9;break}Q.t1=[];case 9:Q.t2=Q.t1,Q.t3=p,W=(0,Q.t0)(Q.t2,Q.t3),q=W[0],ut=W[1],ut&&n.storage.remove(ut),n.storage.set("geometries",q);case 16:case"end":return Q.stop()}}return ct}(),H)}return H}()));return function(){function H(){return F.apply(this,arguments)}return H}()}(),M=e.recallWindowGeometry=function(){var F=i(a().mark(function(){function H(K){var W,q,ut,ct;return a().wrap(function(){function Q(X){for(;;)switch(X.prev=X.next){case 0:if(K===void 0&&(K={}),X.t0=K.fancy,!X.t0){X.next=6;break}return X.next=5,n.storage.get(p);case 5:X.t0=X.sent;case 6:return W=X.t0,W&&l.log("recalled geometry:",W),q=(W==null?void 0:W.pos)||K.pos,ut=K.size,X.next=12,c;case 12:ct=[window.screen.availWidth,window.screen.availHeight],ut&&(ut=[Math.min(ct[0],ut[0]),Math.min(ct[1],ut[1])],S(ut)),q?(ut&&K.locked&&(q=V(q,ut)[1]),b(q)):ut&&(q=(0,r.vecAdd)((0,r.vecScale)(ct,.5),(0,r.vecScale)(ut,-.5),(0,r.vecScale)(d,-1)),b(q));case 15:case"end":return X.stop()}}return Q}(),H)}return H}()));return function(){function H(K){return F.apply(this,arguments)}return H}()}(),w=e.setupDrag=function(){var F=i(a().mark(function(){function H(){return a().wrap(function(){function K(W){for(;;)switch(W.prev=W.next){case 0:return c=Byond.winget(Byond.windowId,"pos").then(function(q){return[q.x-window.screenLeft,q.y-window.screenTop]}),W.next=3,c;case 3:d=W.sent,l.debug("screen offset",d);case 5:case"end":return W.stop()}}return K}(),H)}return H}()));return function(){function H(){return F.apply(this,arguments)}return H}()}(),V=function(H,K){for(var W=T(),q=C(),ut=[H[0],H[1]],ct=!1,Q=0;Q<2;Q++){var X=W[Q],at=W[Q]+q[Q];H[Q]<X?(ut[Q]=X,ct=!0):H[Q]+K[Q]>at&&(ut[Q]=at-K[Q],ct=!0)}return[ct,ut]},U=e.dragStartHandler=function(){function F(H){l.log("drag start"),h=!0,g=[window.screenLeft-H.screenX,window.screenTop-H.screenY],document.addEventListener("mousemove",G),document.addEventListener("mouseup",j),G(H)}return F}(),j=function F(H){l.log("drag end"),G(H),document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",F),h=!1,P()},G=function(H){h&&(H.preventDefault(),b((0,r.vecAdd)([H.screenX,H.screenY],g)))},$=e.resizeStartHandler=function(){function F(H,K){return function(W){f=[H,K],l.log("resize start",f),s=!0,g=[window.screenLeft-W.screenX,window.screenTop-W.screenY],v=[window.innerWidth,window.innerHeight],document.addEventListener("mousemove",B),document.addEventListener("mouseup",x),B(W)}}return F}(),x=function F(H){l.log("resize end",m),B(H),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",F),s=!1,P()},B=function(H){s&&(H.preventDefault(),m=(0,r.vecAdd)(v,(0,r.vecMultiply)(f,(0,r.vecAdd)([H.screenX,H.screenY],(0,r.vecInverse)([window.screenLeft,window.screenTop]),g,[1,1]))),m[0]=Math.max(m[0],150),m[1]=Math.max(m[1],50),S(m))}},24826:function(y,e,t){"use strict";e.__esModule=!0,e.setupGlobalEvents=e.removeScrollableNode=e.globalEvents=e.canStealFocus=e.addScrollableNode=e.KeyEvent=void 0;var n=t(92868),r=t(92986);/**
|
||||
*/var l=(0,o.createLogger)("drag"),p=Byond.windowId,h=!1,s=!1,d=[0,0],c,g,f,v,m,E=e.setWindowKey=function(){function F(H){p=H}return F}(),I=e.getWindowPosition=function(){function F(){return[window.screenLeft,window.screenTop]}return F}(),O=e.getWindowSize=function(){function F(){return[window.innerWidth,window.innerHeight]}return F}(),b=e.setWindowPosition=function(){function F(H){var K=(0,r.vecAdd)(H,d);return Byond.winset(Byond.windowId,{pos:K[0]+","+K[1]})}return F}(),S=e.setWindowSize=function(){function F(H){return Byond.winset(Byond.windowId,{size:H[0]+"x"+H[1]})}return F}(),T=e.getScreenPosition=function(){function F(){return[0-d[0],0-d[1]]}return F}(),C=e.getScreenSize=function(){function F(){return[window.screen.availWidth,window.screen.availHeight]}return F}(),A=function(H,K,W){W===void 0&&(W=50);for(var q=[K],ut,ct=0;ct<H.length;ct++){var Q=H[ct];Q!==K&&(q.length<W?q.push(Q):ut=Q)}return[q,ut]},P=e.storeWindowGeometry=function(){var F=i(a().mark(function(){function H(){var K,W,q,ut;return a().wrap(function(){function ct(Q){for(;;)switch(Q.prev=Q.next){case 0:return l.log("storing geometry"),K={pos:I(),size:O()},n.storage.set(p,K),Q.t0=A,Q.next=6,n.storage.get("geometries");case 6:if(Q.t1=Q.sent,Q.t1){Q.next=9;break}Q.t1=[];case 9:Q.t2=Q.t1,Q.t3=p,W=(0,Q.t0)(Q.t2,Q.t3),q=W[0],ut=W[1],ut&&n.storage.remove(ut),n.storage.set("geometries",q);case 16:case"end":return Q.stop()}}return ct}(),H)}return H}()));return function(){function H(){return F.apply(this,arguments)}return H}()}(),M=e.recallWindowGeometry=function(){var F=i(a().mark(function(){function H(K){var W,q,ut,ct;return a().wrap(function(){function Q(X){for(;;)switch(X.prev=X.next){case 0:if(K===void 0&&(K={}),X.t0=K.fancy,!X.t0){X.next=6;break}return X.next=5,n.storage.get(p);case 5:X.t0=X.sent;case 6:return W=X.t0,W&&l.log("recalled geometry:",W),q=(W==null?void 0:W.pos)||K.pos,ut=K.size,X.next=12,c;case 12:ct=[window.screen.availWidth,window.screen.availHeight],ut&&(ut=[Math.min(ct[0],ut[0]),Math.min(ct[1],ut[1])],S(ut)),window.document.body.style.zoom=100/window.devicePixelRatio+"%",q?(ut&&K.locked&&(q=V(q,ut)[1]),b(q)):ut&&(q=(0,r.vecAdd)((0,r.vecScale)(ct,.5),(0,r.vecScale)(ut,-.5),(0,r.vecScale)(d,-1)),b(q));case 16:case"end":return X.stop()}}return Q}(),H)}return H}()));return function(){function H(K){return F.apply(this,arguments)}return H}()}(),w=e.setupDrag=function(){var F=i(a().mark(function(){function H(){return a().wrap(function(){function K(W){for(;;)switch(W.prev=W.next){case 0:return c=Byond.winget(Byond.windowId,"pos").then(function(q){return[q.x-window.screenLeft,q.y-window.screenTop]}),W.next=3,c;case 3:d=W.sent,l.debug("screen offset",d);case 5:case"end":return W.stop()}}return K}(),H)}return H}()));return function(){function H(){return F.apply(this,arguments)}return H}()}(),V=function(H,K){for(var W=T(),q=C(),ut=[H[0],H[1]],ct=!1,Q=0;Q<2;Q++){var X=W[Q],at=W[Q]+q[Q];H[Q]<X?(ut[Q]=X,ct=!0):H[Q]+K[Q]>at&&(ut[Q]=at-K[Q],ct=!0)}return[ct,ut]},U=e.dragStartHandler=function(){function F(H){l.log("drag start"),h=!0,g=[window.screenLeft-H.screenX,window.screenTop-H.screenY],document.addEventListener("mousemove",G),document.addEventListener("mouseup",j),G(H)}return F}(),j=function F(H){l.log("drag end"),G(H),document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",F),h=!1,P()},G=function(H){h&&(H.preventDefault(),b((0,r.vecAdd)([H.screenX,H.screenY],g)))},$=e.resizeStartHandler=function(){function F(H,K){return function(W){f=[H,K],l.log("resize start",f),s=!0,g=[window.screenLeft-W.screenX,window.screenTop-W.screenY],v=[window.innerWidth,window.innerHeight],document.addEventListener("mousemove",B),document.addEventListener("mouseup",x),B(W)}}return F}(),x=function F(H){l.log("resize end",m),B(H),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",F),s=!1,P()},B=function(H){s&&(H.preventDefault(),m=(0,r.vecAdd)(v,(0,r.vecMultiply)(f,(0,r.vecAdd)([H.screenX,H.screenY],(0,r.vecInverse)([window.screenLeft,window.screenTop]),g,[1,1]))),m[0]=Math.max(m[0],150),m[1]=Math.max(m[1],50),S(m))}},24826:function(y,e,t){"use strict";e.__esModule=!0,e.setupGlobalEvents=e.removeScrollableNode=e.globalEvents=e.canStealFocus=e.addScrollableNode=e.KeyEvent=void 0;var n=t(92868),r=t(92986);/**
|
||||
* Normalized browser focus events and BYOND-specific focus helpers.
|
||||
*
|
||||
* @file
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -137,7 +137,7 @@
|
||||
* @file
|
||||
* @copyright 2020 Aleksej Komarov
|
||||
* @license MIT
|
||||
*/var g=r.toInputValue=function(){function c(m){return typeof m!="number"&&typeof m!="string"?"":String(m)}return c}(),i=r.Input=function(c){function m(){var u;return u=c.call(this)||this,u.inputRef=(0,e.createRef)(),u.state={editing:!1},u.handleInput=function(s){var d=u.state.editing,v=u.props.onInput;d||u.setEditing(!0),v&&v(s,s.target.value)},u.handleFocus=function(s){var d=u.state.editing;d||u.setEditing(!0)},u.handleBlur=function(s){var d=u.state.editing,v=u.props.onChange;d&&(u.setEditing(!1),v&&v(s,s.target.value))},u.handleKeyDown=function(s){var d=u.props,v=d.onInput,C=d.onChange,h=d.onEnter;if(s.keyCode===o.KEY_ENTER){u.setEditing(!1),C&&C(s,s.target.value),v&&v(s,s.target.value),h&&h(s,s.target.value),u.props.selfClear?s.target.value="":s.target.blur();return}if(s.keyCode===o.KEY_ESCAPE){u.setEditing(!1),s.target.value=g(u.props.value),s.target.blur();return}},u}B(m,c);var l=m.prototype;return l.componentDidMount=function(){function u(){var s=this,d=this.props.value,v=this.inputRef.current;v&&(v.value=g(d),v.selectionStart=0,v.selectionEnd=v.value.length),(this.props.autoFocus||this.props.autoSelect)&&setTimeout(function(){v.focus(),s.props.autoSelect&&v.select()},1)}return u}(),l.componentDidUpdate=function(){function u(s,d){var v=this.state.editing,C=s.value,h=this.props.value,p=this.inputRef.current;p&&!v&&C!==h&&(p.value=g(h))}return u}(),l.setEditing=function(){function u(s){this.setState({editing:s})}return u}(),l.render=function(){function u(){var s=this.props,d=s.selfClear,v=s.onInput,C=s.onChange,h=s.onEnter,p=s.value,N=s.maxLength,V=s.placeholder,y=s.autofocus,I=s.disabled,L=s.multiline,w=s.cols,A=w===void 0?32:w,x=s.rows,E=x===void 0?4:x,P=S(s,f),D=P.className,M=P.fluid,R=P.monospace,O=S(P,b);return(0,e.normalizeProps)((0,e.createComponentVNode)(2,t.Box,Object.assign({className:(0,a.classes)(["Input",M&&"Input--fluid",R&&"Input--monospace",I&&"Input--disabled",D])},O,{children:[(0,e.createVNode)(1,"div","Input__baseline",".",16),L?(0,e.createVNode)(128,"textarea","Input__textarea",null,1,{placeholder:V,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,maxLength:N,cols:A,rows:E,disabled:I},null,this.inputRef):(0,e.createVNode)(64,"input","Input__input",null,1,{placeholder:V,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,maxLength:N,disabled:I},null,this.inputRef)]})))}return u}(),m}(e.Component)},4454:function(T,r,n){"use strict";r.__esModule=!0,r.Interactive=void 0;var e=n(89005),a=n(44879);function t(B,k){B.prototype=Object.create(k.prototype),B.prototype.constructor=B,o(B,k)}function o(B,k){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(g,i){return g.__proto__=i,g},o(B,k)}var f=function(k){return k&&k.ownerDocument.defaultView||self},b=function(k,g){var i=k.getBoundingClientRect(),c=g;return{left:(0,a.clamp)((c.pageX-(i.left+f(k).pageXOffset))/i.width,0,1),top:(0,a.clamp)((c.pageY-(i.top+f(k).pageYOffset))/i.height,0,1)}},S=r.Interactive=function(B){function k(i){var c;return c=B.call(this)||this,c.containerRef=void 0,c.props=void 0,c.handleMoveStart=function(m){var l,u=(l=c.containerRef)==null?void 0:l.current;u&&(m.preventDefault(),u.focus(),c.props.onMove(b(u,m)),c.toggleDocumentEvents(!0))},c.handleMove=function(m){var l;m.preventDefault();var u=m.buttons>0;u&&(l=c.containerRef)!=null&&l.current?c.props.onMove(b(c.containerRef.current,m)):c.toggleDocumentEvents(!1)},c.handleMoveEnd=function(){c.toggleDocumentEvents(!1)},c.handleKeyDown=function(m){var l=m.which||m.keyCode;l<37||l>40||(m.preventDefault(),c.props.onKey({left:l===39?.05:l===37?-.05:0,top:l===40?.05:l===38?-.05:0}))},c.props=i,c.containerRef=(0,e.createRef)(),c}t(k,B);var g=k.prototype;return g.toggleDocumentEvents=function(){function i(c){var m,l=(m=this.containerRef)==null?void 0:m.current,u=f(l),s=c?u.addEventListener:u.removeEventListener;s("mousemove",this.handleMove),s("mouseup",this.handleMoveEnd)}return i}(),g.componentDidMount=function(){function i(){this.toggleDocumentEvents(!0)}return i}(),g.componentWillUnmount=function(){function i(){this.toggleDocumentEvents(!1)}return i}(),g.render=function(){function i(){return(0,e.normalizeProps)((0,e.createVNode)(1,"div","react-colorful__interactive",this.props.children,0,Object.assign({},this.props,{style:this.props.style,onMouseDown:this.handleMoveStart,onKeyDown:this.handleKeyDown,tabIndex:0,role:"slider"}),null,this.containerRef))}return i}(),k}(e.Component)},76334:function(T,r,n){"use strict";r.__esModule=!0,r.Knob=void 0;var e=n(89005),a=n(44879),t=n(35840),o=n(55937),f=n(20342),b=n(59263),S=["animated","format","maxValue","minValue","onChange","onDrag","step","stepPixelSize","suppressFlicker","unit","value","className","style","fillValue","color","ranges","size","bipolar","children","popUpPosition"];/**
|
||||
*/var g=r.toInputValue=function(){function c(m){return typeof m!="number"&&typeof m!="string"?"":String(m)}return c}(),i=r.Input=function(c){function m(){var u;return u=c.call(this)||this,u.inputRef=(0,e.createRef)(),u.state={editing:!1},u.handleInput=function(s){var d=u.state.editing,v=u.props.onInput;d||u.setEditing(!0),v&&v(s,s.target.value)},u.handleFocus=function(s){var d=u.state.editing;d||u.setEditing(!0)},u.handleBlur=function(s){var d=u.state.editing,v=u.props.onChange;d&&(u.setEditing(!1),v&&v(s,s.target.value))},u.handleKeyDown=function(s){var d=u.props,v=d.onInput,C=d.onChange,h=d.onEnter;if(s.keyCode===o.KEY_ENTER){u.setEditing(!1),C&&C(s,s.target.value),v&&v(s,s.target.value),h&&h(s,s.target.value),u.props.selfClear?s.target.value="":s.target.blur();return}if(s.keyCode===o.KEY_ESCAPE){u.setEditing(!1),s.target.value=g(u.props.value),s.target.blur();return}},u}B(m,c);var l=m.prototype;return l.componentDidMount=function(){function u(){var s=this,d=this.props.value,v=this.inputRef.current;v&&(v.value=g(d),v.selectionStart=0,v.selectionEnd=v.value.length),(this.props.autoFocus||this.props.autoSelect)&&setTimeout(function(){v.focus(),s.props.autoSelect&&v.select()},1)}return u}(),l.componentDidUpdate=function(){function u(s,d){var v=this.state.editing,C=s.value,h=this.props.value,p=this.inputRef.current;p&&!v&&C!==h&&(p.value=g(h))}return u}(),l.setEditing=function(){function u(s){this.setState({editing:s})}return u}(),l.render=function(){function u(){var s=this.props,d=s.selfClear,v=s.onInput,C=s.onChange,h=s.onEnter,p=s.value,N=s.maxLength,V=s.placeholder,y=s.autofocus,I=s.disabled,L=s.multiline,w=s.cols,A=w===void 0?32:w,x=s.rows,E=x===void 0?4:x,P=S(s,f),D=P.className,M=P.fluid,R=P.monospace,O=S(P,b);return(0,e.normalizeProps)((0,e.createComponentVNode)(2,t.Box,Object.assign({className:(0,a.classes)(["Input",M&&"Input--fluid",R&&"Input--monospace",I&&"Input--disabled",D])},O,{children:[(0,e.createVNode)(1,"div","Input__baseline",".",16),L?(0,e.createVNode)(128,"textarea","Input__textarea",null,1,{placeholder:V,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,maxLength:N,cols:A,rows:E,disabled:I},null,this.inputRef):(0,e.createVNode)(64,"input","Input__input",null,1,{type:"search",placeholder:V,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,maxLength:N,disabled:I},null,this.inputRef)]})))}return u}(),m}(e.Component)},4454:function(T,r,n){"use strict";r.__esModule=!0,r.Interactive=void 0;var e=n(89005),a=n(44879);function t(B,k){B.prototype=Object.create(k.prototype),B.prototype.constructor=B,o(B,k)}function o(B,k){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(g,i){return g.__proto__=i,g},o(B,k)}var f=function(k){return k&&k.ownerDocument.defaultView||self},b=function(k,g){var i=k.getBoundingClientRect(),c=g;return{left:(0,a.clamp)((c.pageX-(i.left+f(k).pageXOffset))/i.width,0,1),top:(0,a.clamp)((c.pageY-(i.top+f(k).pageYOffset))/i.height,0,1)}},S=r.Interactive=function(B){function k(i){var c;return c=B.call(this)||this,c.containerRef=void 0,c.props=void 0,c.handleMoveStart=function(m){var l,u=(l=c.containerRef)==null?void 0:l.current;u&&(m.preventDefault(),u.focus(),c.props.onMove(b(u,m)),c.toggleDocumentEvents(!0))},c.handleMove=function(m){var l;m.preventDefault();var u=m.buttons>0;u&&(l=c.containerRef)!=null&&l.current?c.props.onMove(b(c.containerRef.current,m)):c.toggleDocumentEvents(!1)},c.handleMoveEnd=function(){c.toggleDocumentEvents(!1)},c.handleKeyDown=function(m){var l=m.which||m.keyCode;l<37||l>40||(m.preventDefault(),c.props.onKey({left:l===39?.05:l===37?-.05:0,top:l===40?.05:l===38?-.05:0}))},c.props=i,c.containerRef=(0,e.createRef)(),c}t(k,B);var g=k.prototype;return g.toggleDocumentEvents=function(){function i(c){var m,l=(m=this.containerRef)==null?void 0:m.current,u=f(l),s=c?u.addEventListener:u.removeEventListener;s("mousemove",this.handleMove),s("mouseup",this.handleMoveEnd)}return i}(),g.componentDidMount=function(){function i(){this.toggleDocumentEvents(!0)}return i}(),g.componentWillUnmount=function(){function i(){this.toggleDocumentEvents(!1)}return i}(),g.render=function(){function i(){return(0,e.normalizeProps)((0,e.createVNode)(1,"div","react-colorful__interactive",this.props.children,0,Object.assign({},this.props,{style:this.props.style,onMouseDown:this.handleMoveStart,onKeyDown:this.handleKeyDown,tabIndex:0,role:"slider"}),null,this.containerRef))}return i}(),k}(e.Component)},76334:function(T,r,n){"use strict";r.__esModule=!0,r.Knob=void 0;var e=n(89005),a=n(44879),t=n(35840),o=n(55937),f=n(20342),b=n(59263),S=["animated","format","maxValue","minValue","onChange","onDrag","step","stepPixelSize","suppressFlicker","unit","value","className","style","fillValue","color","ranges","size","bipolar","children","popUpPosition"];/**
|
||||
* @file
|
||||
* @copyright 2020 Aleksej Komarov
|
||||
* @license MIT
|
||||
@@ -222,7 +222,7 @@
|
||||
* @file
|
||||
* @copyright 2020 Aleksej Komarov
|
||||
* @license MIT
|
||||
*/var S=(0,t.createLogger)("drag"),B=Byond.windowId,k=!1,g=!1,i=[0,0],c,m,l,u,s,d=r.setWindowKey=function(){function O(_){B=_}return O}(),v=r.getWindowPosition=function(){function O(){return[window.screenLeft,window.screenTop]}return O}(),C=r.getWindowSize=function(){function O(){return[window.innerWidth,window.innerHeight]}return O}(),h=r.setWindowPosition=function(){function O(_){var F=(0,a.vecAdd)(_,i);return Byond.winset(Byond.windowId,{pos:F[0]+","+F[1]})}return O}(),p=r.setWindowSize=function(){function O(_){return Byond.winset(Byond.windowId,{size:_[0]+"x"+_[1]})}return O}(),N=r.getScreenPosition=function(){function O(){return[0-i[0],0-i[1]]}return O}(),V=r.getScreenSize=function(){function O(){return[window.screen.availWidth,window.screen.availHeight]}return O}(),y=function(_,F,U){U===void 0&&(U=50);for(var z=[F],$,G=0;G<_.length;G++){var X=_[G];X!==F&&(z.length<U?z.push(X):$=X)}return[z,$]},I=r.storeWindowGeometry=function(){var O=b(o().mark(function(){function _(){var F,U,z,$;return o().wrap(function(){function G(X){for(;;)switch(X.prev=X.next){case 0:return S.log("storing geometry"),F={pos:v(),size:C()},e.storage.set(B,F),X.t0=y,X.next=6,e.storage.get("geometries");case 6:if(X.t1=X.sent,X.t1){X.next=9;break}X.t1=[];case 9:X.t2=X.t1,X.t3=B,U=(0,X.t0)(X.t2,X.t3),z=U[0],$=U[1],$&&e.storage.remove($),e.storage.set("geometries",z);case 16:case"end":return X.stop()}}return G}(),_)}return _}()));return function(){function _(){return O.apply(this,arguments)}return _}()}(),L=r.recallWindowGeometry=function(){var O=b(o().mark(function(){function _(F){var U,z,$,G;return o().wrap(function(){function X(J){for(;;)switch(J.prev=J.next){case 0:if(F===void 0&&(F={}),J.t0=F.fancy,!J.t0){J.next=6;break}return J.next=5,e.storage.get(B);case 5:J.t0=J.sent;case 6:return U=J.t0,U&&S.log("recalled geometry:",U),z=(U==null?void 0:U.pos)||F.pos,$=F.size,J.next=12,c;case 12:G=[window.screen.availWidth,window.screen.availHeight],$&&($=[Math.min(G[0],$[0]),Math.min(G[1],$[1])],p($)),z?($&&F.locked&&(z=A(z,$)[1]),h(z)):$&&(z=(0,a.vecAdd)((0,a.vecScale)(G,.5),(0,a.vecScale)($,-.5),(0,a.vecScale)(i,-1)),h(z));case 15:case"end":return J.stop()}}return X}(),_)}return _}()));return function(){function _(F){return O.apply(this,arguments)}return _}()}(),w=r.setupDrag=function(){var O=b(o().mark(function(){function _(){return o().wrap(function(){function F(U){for(;;)switch(U.prev=U.next){case 0:return c=Byond.winget(Byond.windowId,"pos").then(function(z){return[z.x-window.screenLeft,z.y-window.screenTop]}),U.next=3,c;case 3:i=U.sent,S.debug("screen offset",i);case 5:case"end":return U.stop()}}return F}(),_)}return _}()));return function(){function _(){return O.apply(this,arguments)}return _}()}(),A=function(_,F){for(var U=N(),z=V(),$=[_[0],_[1]],G=!1,X=0;X<2;X++){var J=U[X],se=U[X]+z[X];_[X]<J?($[X]=J,G=!0):_[X]+F[X]>se&&($[X]=se-F[X],G=!0)}return[G,$]},x=r.dragStartHandler=function(){function O(_){S.log("drag start"),k=!0,m=[window.screenLeft-_.screenX,window.screenTop-_.screenY],document.addEventListener("mousemove",P),document.addEventListener("mouseup",E),P(_)}return O}(),E=function O(_){S.log("drag end"),P(_),document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",O),k=!1,I()},P=function(_){k&&(_.preventDefault(),h((0,a.vecAdd)([_.screenX,_.screenY],m)))},D=r.resizeStartHandler=function(){function O(_,F){return function(U){l=[_,F],S.log("resize start",l),g=!0,m=[window.screenLeft-U.screenX,window.screenTop-U.screenY],u=[window.innerWidth,window.innerHeight],document.addEventListener("mousemove",R),document.addEventListener("mouseup",M),R(U)}}return O}(),M=function O(_){S.log("resize end",s),R(_),document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",O),g=!1,I()},R=function(_){g&&(_.preventDefault(),s=(0,a.vecAdd)(u,(0,a.vecMultiply)(l,(0,a.vecAdd)([_.screenX,_.screenY],(0,a.vecInverse)([window.screenLeft,window.screenTop]),m,[1,1]))),s[0]=Math.max(s[0],150),s[1]=Math.max(s[1],50),p(s))}},24826:function(T,r,n){"use strict";r.__esModule=!0,r.setupGlobalEvents=r.removeScrollableNode=r.globalEvents=r.canStealFocus=r.addScrollableNode=r.KeyEvent=void 0;var e=n(92868),a=n(92986);/**
|
||||
*/var S=(0,t.createLogger)("drag"),B=Byond.windowId,k=!1,g=!1,i=[0,0],c,m,l,u,s,d=r.setWindowKey=function(){function O(_){B=_}return O}(),v=r.getWindowPosition=function(){function O(){return[window.screenLeft,window.screenTop]}return O}(),C=r.getWindowSize=function(){function O(){return[window.innerWidth,window.innerHeight]}return O}(),h=r.setWindowPosition=function(){function O(_){var F=(0,a.vecAdd)(_,i);return Byond.winset(Byond.windowId,{pos:F[0]+","+F[1]})}return O}(),p=r.setWindowSize=function(){function O(_){return Byond.winset(Byond.windowId,{size:_[0]+"x"+_[1]})}return O}(),N=r.getScreenPosition=function(){function O(){return[0-i[0],0-i[1]]}return O}(),V=r.getScreenSize=function(){function O(){return[window.screen.availWidth,window.screen.availHeight]}return O}(),y=function(_,F,U){U===void 0&&(U=50);for(var z=[F],$,G=0;G<_.length;G++){var X=_[G];X!==F&&(z.length<U?z.push(X):$=X)}return[z,$]},I=r.storeWindowGeometry=function(){var O=b(o().mark(function(){function _(){var F,U,z,$;return o().wrap(function(){function G(X){for(;;)switch(X.prev=X.next){case 0:return S.log("storing geometry"),F={pos:v(),size:C()},e.storage.set(B,F),X.t0=y,X.next=6,e.storage.get("geometries");case 6:if(X.t1=X.sent,X.t1){X.next=9;break}X.t1=[];case 9:X.t2=X.t1,X.t3=B,U=(0,X.t0)(X.t2,X.t3),z=U[0],$=U[1],$&&e.storage.remove($),e.storage.set("geometries",z);case 16:case"end":return X.stop()}}return G}(),_)}return _}()));return function(){function _(){return O.apply(this,arguments)}return _}()}(),L=r.recallWindowGeometry=function(){var O=b(o().mark(function(){function _(F){var U,z,$,G;return o().wrap(function(){function X(J){for(;;)switch(J.prev=J.next){case 0:if(F===void 0&&(F={}),J.t0=F.fancy,!J.t0){J.next=6;break}return J.next=5,e.storage.get(B);case 5:J.t0=J.sent;case 6:return U=J.t0,U&&S.log("recalled geometry:",U),z=(U==null?void 0:U.pos)||F.pos,$=F.size,J.next=12,c;case 12:G=[window.screen.availWidth,window.screen.availHeight],$&&($=[Math.min(G[0],$[0]),Math.min(G[1],$[1])],p($)),window.document.body.style.zoom=100/window.devicePixelRatio+"%",z?($&&F.locked&&(z=A(z,$)[1]),h(z)):$&&(z=(0,a.vecAdd)((0,a.vecScale)(G,.5),(0,a.vecScale)($,-.5),(0,a.vecScale)(i,-1)),h(z));case 16:case"end":return J.stop()}}return X}(),_)}return _}()));return function(){function _(F){return O.apply(this,arguments)}return _}()}(),w=r.setupDrag=function(){var O=b(o().mark(function(){function _(){return o().wrap(function(){function F(U){for(;;)switch(U.prev=U.next){case 0:return c=Byond.winget(Byond.windowId,"pos").then(function(z){return[z.x-window.screenLeft,z.y-window.screenTop]}),U.next=3,c;case 3:i=U.sent,S.debug("screen offset",i);case 5:case"end":return U.stop()}}return F}(),_)}return _}()));return function(){function _(){return O.apply(this,arguments)}return _}()}(),A=function(_,F){for(var U=N(),z=V(),$=[_[0],_[1]],G=!1,X=0;X<2;X++){var J=U[X],se=U[X]+z[X];_[X]<J?($[X]=J,G=!0):_[X]+F[X]>se&&($[X]=se-F[X],G=!0)}return[G,$]},x=r.dragStartHandler=function(){function O(_){S.log("drag start"),k=!0,m=[window.screenLeft-_.screenX,window.screenTop-_.screenY],document.addEventListener("mousemove",P),document.addEventListener("mouseup",E),P(_)}return O}(),E=function O(_){S.log("drag end"),P(_),document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",O),k=!1,I()},P=function(_){k&&(_.preventDefault(),h((0,a.vecAdd)([_.screenX,_.screenY],m)))},D=r.resizeStartHandler=function(){function O(_,F){return function(U){l=[_,F],S.log("resize start",l),g=!0,m=[window.screenLeft-U.screenX,window.screenTop-U.screenY],u=[window.innerWidth,window.innerHeight],document.addEventListener("mousemove",R),document.addEventListener("mouseup",M),R(U)}}return O}(),M=function O(_){S.log("resize end",s),R(_),document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",O),g=!1,I()},R=function(_){g&&(_.preventDefault(),s=(0,a.vecAdd)(u,(0,a.vecMultiply)(l,(0,a.vecAdd)([_.screenX,_.screenY],(0,a.vecInverse)([window.screenLeft,window.screenTop]),m,[1,1]))),s[0]=Math.max(s[0],150),s[1]=Math.max(s[1],50),p(s))}},24826:function(T,r,n){"use strict";r.__esModule=!0,r.setupGlobalEvents=r.removeScrollableNode=r.globalEvents=r.canStealFocus=r.addScrollableNode=r.KeyEvent=void 0;var e=n(92868),a=n(92986);/**
|
||||
* Normalized browser focus events and BYOND-specific focus helpers.
|
||||
*
|
||||
* @file
|
||||
|
||||
Reference in New Issue
Block a user