Fix screenshot bug
This commit is contained in:
1 parent
1bb3c0187c
commit
84a6d572c9
4 files changed
+8
-6
No files matched your search
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name Pixel canvas overlay
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 2024-07-30
|
||||
// @version 2025-02-07
|
||||
// @description Scripts renders pixelated overlays over the tile map!
|
||||
// @author 0xa663, Terncode
|
||||
// @match https://pixelcanvas.io/*
|
||||
@@ -78,7 +78,7 @@ Error generating stack: `+s.message+`
|
||||
background-color: rgba(158, 158, 158, 0.75);
|
||||
}
|
||||
transition: background-color 250ms;
|
||||
`,x1=class e{static _ref;static active;static root;static alert(c,r){return new Promise(n=>{e.clear();let i=()=>{n(),this.active=void 0,this.clear()};this.active=i,e.renderContent(G2.default.createElement("div",null,G2.default.createElement("h5",null,r||`${location.host} says`),G2.default.createElement(O9,null,c),G2.default.createElement(z8,{onClick:()=>i()},"OK")))})}static async confirm(c,r){return new Promise(n=>{e.clear();let i=s=>{n(s),this.active=void 0,this.clear()};this.active=()=>i(!1),e.renderContent(G2.default.createElement("div",null,G2.default.createElement("h5",null,r||`${location.host} says`),G2.default.createElement(O9,null,c),G2.default.createElement(F9,null,G2.default.createElement(z8,{onClick:()=>i(!0)},"OK"),G2.default.createElement(z8,{onClick:()=>i(!1)},"Cancel"))))})}static async prompt(c,r,n){return new Promise(i=>{e.clear();let s=u=>{i(u),this.active=void 0,this.clear()};this.active=()=>s("");let l=(0,G2.createRef)();e.renderContent(G2.default.createElement("div",null,G2.default.createElement("h5",null,n||`${location.host} says`),G2.default.createElement(O9,null,c),G2.default.createElement(Nw,{ref:l,type:"text"}),G2.default.createElement(F9,null,G2.default.createElement(z8,{onClick:()=>s(l.current&&l.current.value)},"OK"),G2.default.createElement(z8,{onClick:()=>s(null)},"Cancel")))),l.current&&(l.current.focus(),l.current.value=r||"",l.current.addEventListener("keyup",u=>{u.key.toLowerCase()==="enter"&&l.current&&s(l.current.value)}))})}static custom(c,r){return new Promise(n=>{e.clear();let i=()=>{this.active=void 0,n(),this.clear()};this.active=()=>i(),e.renderContent(G2.default.createElement("div",null,c,G2.default.createElement(F9,null,r?r.map((s,l)=>G2.default.createElement(z8,{key:l,onClick:async u=>{let p=s.click(u),h;p instanceof Promise?h=await p:h=p,h||(this.active=void 0,this.clear(),n())}},s.content)):null)))})}static close(){this.clear()}static clear(){this.root&&(this.root.unmount(),this.root=void 0);let c=e.ref.style;c.pointerEvents="none",c.touchAction="none",c.backgroundColor="rgba(0, 0, 0, 0)",this.active&&this.active(),this.active=void 0}static renderContent(c){let r=e.createBase(c);this.root=(0,_m.createRoot)(e.ref),this.root.render(r);let n=e.ref.style;n.pointerEvents="all",n.touchAction="auto",n.backgroundColor="rgba(0, 0, 0, 0.5)"}static createBase(c){return G2.default.createElement(Sw,null,c)}static get ref(){if(e._ref)return e._ref;let c=document.createElement("div");document.body.appendChild(c),e._ref=c;let r=c.style;return r.position="fixed",r.zIndex=`${Number.MAX_SAFE_INTEGER}`,r.width="100%",r.height="100%",r.pointerEvents="none",r.touchAction="none",r.backgroundColor="rgba(0, 0, 0, 0)",r.transition="background-color 1s",r.overflowY="auto",r.overflowX="hidden",c}};var Rm=N2(f1());function bw(){return new Promise(e=>{let c=document.createElement("div"),r=document.createElement("div"),n=c.style;n.position="fixed",n.zIndex="100000",n.left=n.top="0",n.width=`${window.innerWidth}px`,n.height=`${window.innerHeight}px`,document.body.appendChild(c),n.backgroundColor="rgba(0, 0, 0, 0.50)";let i=r.style;i.position="fixed",i.zIndex="100001",i.width="5px",i.height="5px",i.border="2px solid white";let s,l=(W,g,H,C)=>{s={x:W,y:g,xOff:H,yOff:C}},u=W=>{l(W.clientX,W.clientY,W.offsetX,W.offsetY)},p=W=>{let g=W.touches[W.touches.length-1],H=W.target,{x:C,y:b,width:D,height:U}=H.getBoundingClientRect(),B=(g.clientX-C)/D*H.offsetWidth,Z=(g.clientY-b)/U*H.offsetHeight;l(g.clientX,g.clientY,B,Z)},h=(W,g)=>{if(!s)return{x:W,y:g,width:0,height:0};let H=Math.min(W,s.x),C=Math.max(W,s.x),b=Math.min(g,s.y),D=Math.max(g,s.y),U=C-H,B=D-b;return{x:Math.floor(H),y:Math.floor(b),width:Math.ceil(U),height:Math.ceil(B)}},z=(W,g)=>{if(!s)return;document.body.contains(r)||document.body.appendChild(r);let H=h(W,g),C=r.style;C.width=`${H.width}px`,C.height=`${H.height}px`,C.left=`${H.x}px`,C.top=`${H.y}px`},V=W=>{if(!s||!(W instanceof MouseEvent))return;let{clientX:g,clientY:H}=W;z(g,H)},L=W=>{if(!s||!(W instanceof TouchEvent)||!W.isTrusted)return;let g=W.touches[0];if(i.borderWidth="6px",g){let{clientX:H,clientY:C}=g;z(H,C)}},S=(W,g)=>{if(s){let H=h(W,g);s=void 0,window.removeEventListener("mousedown",T),window.removeEventListener("touchend",P),window.removeEventListener("mousedown",u),window.removeEventListener("touchstart",p),window.removeEventListener("mouseup",V),window.removeEventListener("touchmove",L),document.body.removeChild(c),document.body.contains(r)&&document.body.removeChild(r),e(H)}},P=W=>{let g=W.touches[0]||W.changedTouches[0];if(g){let{clientX:H,clientY:C}=g;S(H,C)}},T=W=>{S(W.clientX,W.clientY)};window.addEventListener("mouseup",T),window.addEventListener("touchend",P),window.addEventListener("mousedown",u),window.addEventListener("touchstart",p),window.addEventListener("mousemove",V),window.addEventListener("touchmove",L)})}async function B9(e,c,r,n,i=0){let s=H8();s.width=r/Math.pow(2,i),s.height=n/Math.pow(2,i);let l=s.getContext("2d"),u=Math.floor(e%O2),p=Math.floor
Line truncated
|
||||
`,x1=class e{static _ref;static active;static root;static alert(c,r){return new Promise(n=>{e.clear();let i=()=>{n(),this.active=void 0,this.clear()};this.active=i,e.renderContent(G2.default.createElement("div",null,G2.default.createElement("h5",null,r||`${location.host} says`),G2.default.createElement(O9,null,c),G2.default.createElement(z8,{onClick:()=>i()},"OK")))})}static async confirm(c,r){return new Promise(n=>{e.clear();let i=s=>{n(s),this.active=void 0,this.clear()};this.active=()=>i(!1),e.renderContent(G2.default.createElement("div",null,G2.default.createElement("h5",null,r||`${location.host} says`),G2.default.createElement(O9,null,c),G2.default.createElement(F9,null,G2.default.createElement(z8,{onClick:()=>i(!0)},"OK"),G2.default.createElement(z8,{onClick:()=>i(!1)},"Cancel"))))})}static async prompt(c,r,n){return new Promise(i=>{e.clear();let s=u=>{i(u),this.active=void 0,this.clear()};this.active=()=>s("");let l=(0,G2.createRef)();e.renderContent(G2.default.createElement("div",null,G2.default.createElement("h5",null,n||`${location.host} says`),G2.default.createElement(O9,null,c),G2.default.createElement(Nw,{ref:l,type:"text"}),G2.default.createElement(F9,null,G2.default.createElement(z8,{onClick:()=>s(l.current&&l.current.value)},"OK"),G2.default.createElement(z8,{onClick:()=>s(null)},"Cancel")))),l.current&&(l.current.focus(),l.current.value=r||"",l.current.addEventListener("keyup",u=>{u.key.toLowerCase()==="enter"&&l.current&&s(l.current.value)}))})}static custom(c,r){return new Promise(n=>{e.clear();let i=()=>{this.active=void 0,n(),this.clear()};this.active=()=>i(),e.renderContent(G2.default.createElement("div",null,c,G2.default.createElement(F9,null,r?r.map((s,l)=>G2.default.createElement(z8,{key:l,onClick:async u=>{let p=s.click(u),h;p instanceof Promise?h=await p:h=p,h||(this.active=void 0,this.clear(),n())}},s.content)):null)))})}static close(){this.clear()}static clear(){this.root&&(this.root.unmount(),this.root=void 0);let c=e.ref.style;c.pointerEvents="none",c.touchAction="none",c.backgroundColor="rgba(0, 0, 0, 0)",this.active&&this.active(),this.active=void 0}static renderContent(c){let r=e.createBase(c);this.root=(0,_m.createRoot)(e.ref),this.root.render(r);let n=e.ref.style;n.pointerEvents="all",n.touchAction="auto",n.backgroundColor="rgba(0, 0, 0, 0.5)"}static createBase(c){return G2.default.createElement(Sw,null,c)}static get ref(){if(e._ref)return e._ref;let c=document.createElement("div");document.body.appendChild(c),e._ref=c;let r=c.style;return r.position="fixed",r.zIndex=`${Number.MAX_SAFE_INTEGER}`,r.width="100%",r.height="100%",r.pointerEvents="none",r.touchAction="none",r.backgroundColor="rgba(0, 0, 0, 0)",r.transition="background-color 1s",r.overflowY="auto",r.overflowX="hidden",c}};var Rm=N2(f1());function bw(){return new Promise(e=>{let c=document.createElement("div"),r=document.createElement("div"),n=c.style;n.position="fixed",n.zIndex="100000",n.left=n.top="0",n.width=`${window.innerWidth}px`,n.height=`${window.innerHeight}px`,document.body.appendChild(c),n.backgroundColor="rgba(0, 0, 0, 0.50)";let i=r.style;i.position="fixed",i.zIndex="100001",i.width="5px",i.height="5px",i.border="2px solid white";let s,l=(W,g,H,C)=>{s={x:W,y:g,xOff:H,yOff:C}},u=W=>{l(W.clientX,W.clientY,W.offsetX,W.offsetY)},p=W=>{let g=W.touches[W.touches.length-1],H=W.target,{x:C,y:b,width:D,height:U}=H.getBoundingClientRect(),B=(g.clientX-C)/D*H.offsetWidth,Z=(g.clientY-b)/U*H.offsetHeight;l(g.clientX,g.clientY,B,Z)},h=(W,g)=>{if(!s)return{x:W,y:g,width:0,height:0};let H=Math.min(W,s.x),C=Math.max(W,s.x),b=Math.min(g,s.y),D=Math.max(g,s.y),U=C-H,B=D-b;return{x:Math.floor(H),y:Math.floor(b),width:Math.ceil(U),height:Math.ceil(B)}},z=(W,g)=>{if(!s)return;document.body.contains(r)||document.body.appendChild(r);let H=h(W,g),C=r.style;C.width=`${H.width}px`,C.height=`${H.height}px`,C.left=`${H.x}px`,C.top=`${H.y}px`},V=W=>{if(!s||!(W instanceof MouseEvent))return;let{clientX:g,clientY:H}=W;z(g,H)},L=W=>{if(!s||!(W instanceof TouchEvent)||!W.isTrusted)return;let g=W.touches[0];if(i.borderWidth="6px",g){let{clientX:H,clientY:C}=g;z(H,C)}},S=(W,g)=>{if(s){let H=h(W,g);s=void 0,window.removeEventListener("mousedown",T),window.removeEventListener("touchend",P),window.removeEventListener("mousedown",u),window.removeEventListener("touchstart",p),window.removeEventListener("mouseup",V),window.removeEventListener("touchmove",L),document.body.removeChild(c),document.body.contains(r)&&document.body.removeChild(r),e(H)}},P=W=>{let g=W.touches[0]||W.changedTouches[0];if(g){let{clientX:H,clientY:C}=g;S(H,C)}},T=W=>{S(W.clientX,W.clientY)};window.addEventListener("mouseup",T),window.addEventListener("touchend",P),window.addEventListener("mousedown",u),window.addEventListener("touchstart",p),window.addEventListener("mousemove",V),window.addEventListener("touchmove",L)})}async function B9(e,c,r,n,i=0){let s=H8();s.width=r/Math.pow(2,i),s.height=n/Math.pow(2,i);let l=s.getContext("2d"),u=Math.floor(e%O2),p=Math.floor
Line truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uw(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var lh=function(){},li={},_h={},Th=null,Rh={mark:lh,measure:lh};try{typeof window<"u"&&(li=window),typeof document<"u"&&(_h=document),typeof MutationObserver<"u"&&(Th=MutationObserver),typeof performance<"u"&&(Rh=performance)}catch{}var Ww=li.navigator||{},fh=Ww.userAgent,uh=fh===void 0?"":fh,x6=li,B2=_h,ph=Th,Yc=Rh,Mk=!!x6.document,B4=!!B2.documentElement&&!!B2.head&&typeof B2.addEventListener=="function"&&typeof B2.createElement=="function",Dh=~uh.indexOf("MSIE")||~uh.indexOf("Trident/"),Kc,Qc,$c,Jc,Zc,D4="___FONT_AWESOME___",J9=16,Oh="fa",Fh="svg-inline--fa",m0="data-fa-i2svg",Z9="data-fa-pseudo-element",Gw="data-fa-pseudo-element-pending",fi="data-prefix",ui="data-icon",mh="fontawesome-i2svg",qw="async",jw=["HTML","HEAD","STYLE","SCRIPT"],Bh=function(){try{return!0}catch{return!1}}(),F2="classic",c1="sharp",pi=[F2,c1];function ue(e){return new Proxy(e,{get:function(r,n){return n in r?r[n]:r[F2]}})}var te=ue((Kc={},m1(Kc,F2,{fa:"solid",fas:"solid","fa-solid":"solid",far:"regular","fa-regular":"regular",fal:"light","fa-light":"light",fat:"thin","fa-thin":"thin",fad:"duotone","fa-duotone":"duotone",fab:"brands","fa-brands":"brands",fak:"kit",fakd:"kit","fa-kit":"kit","fa-kit-duotone":"kit"}),m1(Kc,c1,{fa:"solid",fass:"solid","fa-solid":"solid",fasr:"regular","fa-regular":"regular",fasl:"light","fa-light":"light",fast:"thin","fa-thin":"thin"}),Kc)),ie=ue((Qc={},m1(Qc,F2,{solid:"fas",regular:"far",light:"fal",thin:"fat",duotone:"fad",brands:"fab",kit:"fak"}),m1(Qc,c1,{solid:"fass",regular:"fasr",light:"fasl",thin:"fast"}),Qc)),se=ue(($c={},m1($c,F2,{fab:"fa-brands",fad:"fa-duotone",fak:"fa-kit",fal:"fa-light",far:"fa-regular",fas:"fa-solid",fat:"fa-thin"}),m1($c,c1,{fass:"fa-solid",fasr:"fa-regular",fasl:"fa-light",fast:"fa-thin"}),$c)),Xw=ue((Jc={},m1(Jc,F2,{"fa-brands":"fab","fa-duotone":"fad","fa-kit":"fak","fa-light":"fal","fa-regular":"far","fa-solid":"fas","fa-thin":"fat"}),m1(Jc,c1,{"fa-solid":"fass","fa-regular":"fasr","fa-light":"fasl","fa-thin":"fast"}),Jc)),Yw=/fa(s|r|l|t|d|b|k|ss|sr|sl|st)?[\-\ ]/,Ih="fa-layers-text",Kw=/Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp|Kit)?.*/i,Qw=ue((Zc={},m1(Zc,F2,{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"}),m1(Zc,c1,{900:"fass",400:"fasr",300:"fasl",100:"fast"}),Zc)),Uh=[1,2,3,4,5,6,7,8,9,10],$w=Uh.concat([11,12,13,14,15,16,17,18,19,20]),Jw=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],u0={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},oe=new Set;Object.keys(ie[F2]).map(oe.add.bind(oe));Object.keys(ie[c1]).map(oe.add.bind(oe));var Zw=[].concat(pi,fe(oe),["2xs","xs","sm","lg","xl","2xl","beat","border","fade","beat-fade","bounce","flip-both","flip-horizontal","flip-vertical","flip","fw","inverse","layers-counter","layers-text","layers","li","pull-left","pull-right","pulse","rotate-180","rotate-270","rotate-90","rotate-by","shake","spin-pulse","spin-reverse","spin","stack-1x","stack-2x","stack","ul",u0.GROUP,u0.SWAP_OPACITY,u0.PRIMARY,u0.SECONDARY]).concat(Uh.map(function(e){return"".concat(e,"x")})).concat($w.map(function(e){return"w-".concat(e)})),ae=x6.FontAwesomeConfig||{};function eS(e){var c=B2.querySelector("script["+e+"]");if(c)return c.getAttribute(e)}function cS(e){return e===""?!0:e==="false"?!1:e==="true"?!0:e}B2&&typeof B2.querySelector=="function"&&(hh=[["data-family-prefix","familyPrefix"],["data-css-prefix","cssPrefix"],["data-family-default","familyDefault"],["data-style-default","styleDefault"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-auto-a11y","autoA11y"],["data-search-pseudo-elements","searchPseudoElements"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]],hh.forEach(function(e){var c=oi(e,2),r=c[0],n=c[1],i=cS(eS(r));i!=null&&(ae[n]=i)}));var hh,Wh={styleDefault:"solid",familyDefault:"classic",cssPrefix:Oh,replacementClass:Fh,autoReplaceSvg:!0,autoAddCss:!0,autoA11y:!0,searchPseudoElements:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};ae.familyPrefix&&(ae.cssPrefix=ae.familyPrefix);var w8=$($({},Wh),ae);w8.autoReplaceSvg||(w8.observeMutations=!1);var c2={};Object.keys(Wh).forEach(function(e){Object.defineProperty(c2,e,{enumerable:!0,set:function(r){w8[e]=r,ne.forEach(function(n){return n(c2)})},get:function(){return w8[e]}})});Object.defineProperty(c2,"familyPrefix",{enumerable:!0,set:function(c){w8.cssPrefix=c,ne.forEach(function(r){return r(c2)})},get:function(){return w8.cssPrefix}});x6.FontAwesomeConfig=c2;var ne=[];function rS(e){return ne.push(e),function(){ne.splice(ne.indexOf(e),1)}}var L6=J9,m4={size:1
Line truncated
|
||||
--fa-font-solid: normal 900 1em/1 "Font Awesome 6 Solid";
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "pixelcanvas-overlay",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pixelcanvas-overlay",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^6.5.1",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pixelcanvas-overlay",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"description": "Pixel canvas overlay",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -175,7 +175,9 @@ export async function takeCanvasShot(coordinates: Coordinates) {
|
||||
}
|
||||
|
||||
try {
|
||||
const canvas = await fetchCombineTiledImage(cords.x, cords.y, rect.height, rect.width, coordinates.uScale);
|
||||
const canvas = await fetchCombineTiledImage(
|
||||
cords.x, cords.y, rect.width, rect.height, coordinates.uScale
|
||||
);
|
||||
|
||||
const url = canvas.toDataURL();
|
||||
Popup.custom(<img style={{border: "1px solid black"}} src={url} />, [{
|
||||
|
||||
Reference in new issue
Block a user