svgedit/dist/editor/extensions/ext-overview_window/ext-overview_window.js

12 lines
14 KiB
JavaScript
Raw Normal View History

var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e){var t={exports:{}};return e(t,t.exports),t.exports}var check=function(e){return e&&e.Math==Math&&e},t=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof e&&e)||function(){return this}()||Function("return this")(),fails=function(e){try{return!!e()}catch(e){return!0}},r=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i={f:o&&!n.call({1:2},1)?function propertyIsEnumerable(e){var t=o(this,e);return!!t&&t.enumerable}:n},createPropertyDescriptor=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},a={}.toString,classofRaw=function(e){return a.call(e).slice(8,-1)},c="".split,u=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==classofRaw(e)?c.call(e,""):Object(e)}:Object,requireObjectCoercible=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},toIndexedObject=function(e){return u(requireObjectCoercible(e))},isObject=function(e){return"object"==typeof e?null!==e:"function"==typeof e},toPrimitive=function(e,t){if(!isObject(e))return e;var r,n;if(t&&"function"==typeof(r=e.toString)&&!isObject(n=r.call(e)))return n;if("function"==typeof(r=e.valueOf)&&!isObject(n=r.call(e)))return n;if(!t&&"function"==typeof(r=e.toString)&&!isObject(n=r.call(e)))return n;throw TypeError("Can't convert object to primitive value")},f={}.hasOwnProperty,has=function(e,t){return f.call(e,t)},s=t.document,l=isObject(s)&&isObject(s.createElement),documentCreateElement=function(e){return l?s.createElement(e):{}},p=!r&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),v=Object.getOwnPropertyDescriptor,w={f:r?v:function getOwnPropertyDescriptor(e,t){if(e=toIndexedObject(e),t=toPrimitive(t,!0),p)try{return v(e,t)}catch(e){}if(has(e,t))return createPropertyDescriptor(!i.f.call(e,t),e[t])}},anObject=function(e){if(!isObject(e))throw TypeError(String(e)+" is not an object");return e},d=Object.defineProperty,g={f:r?d:function defineProperty(e,t,r){if(anObject(e),t=toPrimitive(t,!0),anObject(r),p)try{return d(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},h=r?function(e,t,r){return g.f(e,t,createPropertyDescriptor(1,r))}:function(e,t,r){return e[t]=r,e},setGlobal=function(e,r){try{h(t,e,r)}catch(n){t[e]=r}return r},y=t["__core-js_shared__"]||setGlobal("__core-js_shared__",{}),b=Function.toString;"function"!=typeof y.inspectSource&&(y.inspectSource=function(e){return b.call(e)});var m,_,x,O=y.inspectSource,N=t.WeakMap,S="function"==typeof N&&/native code/.test(O(N)),j=createCommonjsModule((function(e){(e.exports=function(e,t){return y[e]||(y[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.7.0",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),E=0,I=Math.random(),F=j("keys"),sharedKey=function(e){return F[e]||(F[e]=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++E+I).toString(36)}(e))},M={},k=t.WeakMap;if(S){var P=y.state||(y.state=new k),A=P.get,T=P.has,C=P.set;m=function(e,t){return t.facade=e,C.call(P,e,t),t},_=function(e){return A.call(P,e)||{}},x=function(e){return T.call(P,e)}}else{var V=sharedKey("state");M[V]=!0,m=function(e,t){return t.facade=e,h(e,V,t),t},_=function(e){return has(e,V)?e[V]:{}},x=function(e){return has(e,V)}}var D,L,R={set:m,get:_,has:x,enforce:function(e){return x(e)?_(e):m(e,{})},getterFor:function(e){return function(t){var r;if(!isObject(t)||(r=_(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return r}}},B=createCommonjsModule((function(e){var r=R.get,n=R.enforce,o=String(String).split("String");(e.exports=function(e,r,i,a){var c,u=!!a&&!!a.unsafe,f=!!a&&!!a.enumerable,s
2020-08-28 22:07:07 +00:00
/**
* @file ext-overview_window.js
*
* @license MIT
*
* @copyright 2013 James Sacksteder
*
*/
var Ye={name:"overview_window",init:function init(e){var t=e.$,r=e.isChrome,n={};if(r()){var o=navigator.userAgent.indexOf("Chrome/")+7;if(Number.parseInt(navigator.userAgent.substring(o))<49)return}t("#sidepanels").append('<div id="overview_window_content_pane" style="width:100%; word-wrap:break-word; display:inline-block; margin-top:20px;"><div id="overview_window_content" style="position:relative; left:12px; top:0px;"><div style="background-color:#A0A0A0; display:inline-block; overflow:visible;"><svg id="overviewMiniView" width="150" height="100" x="0" y="0" viewBox="0 0 4800 3600" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><use x="0" y="0" xlink:href="#svgroot"> </use></svg><div id="overview_window_view_box" style="min-width:50px; min-height:50px; position:absolute; top:30px; left:30px; z-index:5; background-color:rgba(255,0,102,0.3);"></div></div></div></div>');var i=function updateViewBox(){var e=Number.parseFloat(t("#workarea").css("height")),r=Number.parseFloat(t("#workarea").css("width")),n=t("#workarea").scrollLeft(),o=t("#workarea").scrollTop(),i=Number.parseFloat(t("#svgcanvas").css("width")),a=Number.parseFloat(t("#svgcanvas").css("height")),c=t("#overviewMiniView").attr("width"),u=t("#overviewMiniView").attr("height"),f=n/i*c,s=o/a*u,l=r/i*c,p=e/a*u;t("#overview_window_view_box").css("min-width",l+"px"),t("#overview_window_view_box").css("min-height",p+"px"),t("#overview_window_view_box").css("top",s+"px"),t("#overview_window_view_box").css("left",f+"px")};t("#workarea").scroll((function(){n.viewBoxDragging||i()})),t("#workarea").resize(i),i();var a=function updateViewDimensions(){var e=t("#svgroot").attr("width"),r=t("#svgroot").attr("height"),n=r/e*t("#overviewMiniView").attr("width");t("#overviewMiniView").attr("viewBox","640 480 "+e+" "+r),t("#overviewMiniView").attr("height",n),i()};a(),n.viewBoxDragging=!1;var c=function updateViewPortFromViewBox(){var e=Number.parseFloat(t("#svgcanvas").css("width")),r=Number.parseFloat(t("#svgcanvas").css("height")),n=t("#overviewMiniView").attr("width"),o=t("#overviewMiniView").attr("height"),i=Number.parseFloat(t("#overview_window_view_box").css("left"))/n*e,a=Number.parseFloat(t("#overview_window_view_box").css("top"))/o*r;t("#workarea").scrollLeft(i),t("#workarea").scrollTop(a)};return t("#overview_window_view_box").draggable({containment:"parent",drag:c,start:function start(){n.viewBoxDragging=!0},stop:function stop(){n.viewBoxDragging=!1}}),t("#overviewMiniView").click((function(e){var r=e.offsetX||e.originalEvent.layerX,n=e.offsetY||e.originalEvent.layerY,o=t("#overviewMiniView").attr("width"),i=t("#overviewMiniView").attr("height"),a=Number.parseFloat(t("#overview_window_view_box").css("min-width")),u=Number.parseFloat(t("#overview_window_view_box").css("min-height")),f=r-.5*a,s=n-.5*u;f<0&&(f=0),s<0&&(s=0),f+a>o&&(f=o-a),s+u>i&&(s=i-u),t("#overview_window_view_box").css("top",s+"px"),t("#overview_window_view_box").css("left",f+"px"),c()})),{name:"overview window",canvasUpdated:a,workareaResized:i}}};export default Ye;
2020-08-28 22:07:07 +00:00
//# sourceMappingURL=ext-overview_window.js.map