From 369c2243044dbcf2a572fb706bf5dc4aa4116718 Mon Sep 17 00:00:00 2001 From: Max Ziebell <1752114+worldoptimizer@users.noreply.github.com> Date: Sun, 2 Jan 2022 00:24:38 +0100 Subject: [PATCH] v1.2.3 --- HypeDynamicCamera.min.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/HypeDynamicCamera.min.js b/HypeDynamicCamera.min.js index 7842e85..c3e9326 100644 --- a/HypeDynamicCamera.min.js +++ b/HypeDynamicCamera.min.js @@ -1,9 +1,10 @@ /* -Hype Dynamic Camera 1.2.2 + Hype Dynamic Camera 1.2.3 copyright (c) 2015 by Lucky (Tumult Forum @Luckyde) maintaind since 2018 by Max Ziebell, (https://maxziebell.de). MIT-license */ -!1==="HypeDynamicCamera"in window&&(window.HypeDynamicCamera=function(){var e={};!1==="HYPE_eventListeners"in window&&(window.HYPE_eventListeners=[]);window.HYPE_eventListeners.push({type:"HypeDocumentLoad",callback:function(b,q,r){b.setupDynamicCamera=function(a,c,h){if(e[a.id])console.log("restart"),e[a.id].observe(a,{attributes:!0,attributeFilter:["style"]}),a.setAttribute("style",a.getAttribute("style"));else{var d=document.getElementById(b.currentSceneId());a&&"string"==typeof a&&(a=d.querySelector(a)); -c&&"string"==typeof c&&(c=d.querySelector(c));if((c=c||d)&&a){h=h||{};var t=b.getElementProperty(d,"width"),u=b.getElementProperty(d,"height"),G=180/Math.PI,k,v,w,l,m,x,y,z,A,B,n,p,C,D,f,g,E,F;h.showCamera||(a.style.visibility="hidden",a.style.zIndex=d.style.zIndex);e[a.id]=new MutationObserver(function(H){k=new WebKitCSSMatrix(window.getComputedStyle(a).webkitTransform);A=b.getElementProperty(a,"left");B=b.getElementProperty(a,"top");n=b.getElementProperty(a,"height");p=b.getElementProperty(a,"width"); -C=b.getElementProperty(a,"scaleX");D=b.getElementProperty(a,"scaleY");z=-Math.atan2(k.b,k.a)*G;f=p*C;g=n*D;E=A-(f-p)/2;F=B-(g-n)/2;l=E+f/2;m=F+g/2;x=-1*(l-t/2);y=-1*(m-u/2);v=t/f;w=u/g;c.style.transformOrigin=c.style.WebkitTransformOrigin=l+"px "+m+"px";c.style.webkitTransform=c.style.transform="translateX("+x+"px) translateY("+y+"px) scaleX("+v+") scaleY("+w+") rotateZ("+z+"deg)";c.style.webkitFilter=a.style.webkitFilter;c.style.opacity=a.style.opacity});e[a.id].observe(a,{attributes:!0,attributeFilter:["style"]}); -a.setAttribute("style",a.getAttribute("style"))}}}}});window.HYPE_eventListeners.push({type:"HypeSceneLoad",callback:function(b,q,r){document.getElementById(b.currentSceneId()).querySelectorAll("[data-dynamic-camera]").forEach(function(a){var c=a.getAttribute("data-dynamic-camera");b.setupDynamicCamera(a,c)})}});window.HYPE_eventListeners.push({type:"HypeSceneUnload",callback:function(b,q,r){Object.values(e).forEach(function(a){a.disconnect()})}});return{version:"1.2.2"}}()); +!1==="HypeDynamicCamera"in window&&(window.HypeDynamicCamera=function(){var e={};!1==="HYPE_eventListeners"in window&&(window.HYPE_eventListeners=[]);window.HYPE_eventListeners.push({type:"HypeDocumentLoad",callback:function(c,t,u){c.setupDynamicCamera=function(a,b,h){if(e[a.id])e[a.id].observe(a,{attributes:!0,attributeFilter:["style"]}),a.setAttribute("style",a.getAttribute("style"));else{var d=document.getElementById(c.currentSceneId());a&&"string"==typeof a&&(a=d.querySelector(a));b&&"string"== +typeof b&&(b=d.querySelector(b));if((b=b||d)&&a){h=h||{};var G=180/Math.PI,k,v,w,l,m,x,y,z,A,B,n,p,C,D,f,g,E,F,q,r;h.showCamera||(a.style.visibility="hidden",a.style.zIndex=d.style.zIndex);e[a.id]=new MutationObserver(function(H){k=new WebKitCSSMatrix(window.getComputedStyle(a).webkitTransform);q=c.getElementProperty(d,"width");r=c.getElementProperty(d,"height");A=c.getElementProperty(a,"left");B=c.getElementProperty(a,"top");n=c.getElementProperty(a,"height");p=c.getElementProperty(a,"width");C= +c.getElementProperty(a,"scaleX");D=c.getElementProperty(a,"scaleY");z=-Math.atan2(k.b,k.a)*G;f=p*C;g=n*D;E=A-(f-p)/2;F=B-(g-n)/2;l=E+f/2;m=F+g/2;x=-1*(l-q/2);y=-1*(m-r/2);v=q/f;w=r/g;b.style.transformOrigin=b.style.WebkitTransformOrigin=l+"px "+m+"px";b.style.webkitTransform=b.style.transform="translateX("+x+"px) translateY("+y+"px) scaleX("+v+") scaleY("+w+") rotateZ("+z+"deg)";b.style.webkitFilter=a.style.webkitFilter;b.style.opacity=a.style.opacity;b.style.display=a.style.display});e[a.id].observe(a, +{attributes:!0,attributeFilter:["style"]});a.setAttribute("style",a.getAttribute("style"))}}}}});window.HYPE_eventListeners.push({type:"HypeScenePrepareForDisplay",callback:function(c,t,u){document.getElementById(c.currentSceneId()).querySelectorAll("[data-dynamic-camera]").forEach(function(a){var b=a.getAttribute("data-dynamic-camera");c.setupDynamicCamera(a,b)})}});window.HYPE_eventListeners.push({type:"HypeSceneUnload",callback:function(c,t,u){Object.values(e).forEach(function(a){a.disconnect()})}}); +return{version:"1.2.3"}}());