1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 09:40:06 +08:00
SpaceVim/bundle/plantuml-previewer.vim/viewer/dist/main.e8e44d5b.js

1 line
4.8 KiB
JavaScript

!function(t){function e(e){for(var n,a,s=e[0],l=e[1],h=e[2],d=0,u=[];d<s.length;d++)a=s[d],r[a]&&u.push(r[a][0]),r[a]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(t[n]=l[n]);for(c&&c(e);u.length;)u.shift()();return o.push.apply(o,h||[]),i()}function i(){for(var t,e=0;e<o.length;e++){for(var i=o[e],n=!0,s=1;s<i.length;s++){var l=i[s];0!==r[l]&&(n=!1)}n&&(o.splice(e--,1),t=a(a.s=i[0]))}return t}var n={},r={1:0},o=[];function a(e){if(n[e])return n[e].exports;var i=n[e]={i:e,l:!1,exports:{}};return t[e].call(i.exports,i,i.exports,a),i.l=!0,i.exports}a.m=t,a.c=n,a.d=function(t,e,i){a.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},a.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="./";var s=window.webpackJsonp=window.webpackJsonp||[],l=s.push.bind(s);s.push=e,s=s.slice();for(var h=0;h<s.length;h++)e(s[h]);var c=l;o.push([20,0]),i()}([,,,,,function(t,e,i){"use strict";i.r(e);var n=i(4),r=i(3),o=i(2),a=i.n(o),s=new Image,l={data:function(){return{img:{realWidth:null,realHeight:null,width:null,height:null,whRate:null},relativeCenter:{left:null,top:null},lastTimestamp:null,needReset:!0,diagramUrl:"../tmp.svg",url:null}},methods:{boxReset:function(){var t=this.$refs.wrapper;t.clientWidth/t.clientHeight>this.img.whRate?this.boxResize({height:t.clientHeight}):this.boxResize({width:t.clientWidth}),this.boxCenter()},boxResize:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.width,i=void 0===e?null:e,n=t.height,r=void 0===n?null:n;this.$refs.box;i?(this.img.width=i,this.img.height=i/this.img.whRate):r&&(this.img.height=r,this.img.width=r*this.img.whRate)},boxCenter:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.top,i=void 0===e?0:e,n=t.left,r=void 0===n?0:n,o=this.$refs.wrapper,a=this.$refs.box;this.relativeCenter.left=r,this.relativeCenter.top=i,r=o.clientWidth/2-r*this.img.width-this.img.width/2,i=o.clientHeight/2-i*this.img.height-this.img.height/2,a.style.left=r+"px",a.style.top=i+"px"},bindEvent:function(){var t=this,e=this.$refs.wrapper,i=this.$refs.box;new a.a(i).on("dragEnd",function(n){var r=i.style,o=r.top,a=r.left;o=parseFloat(o),a=parseFloat(a),t.relativeCenter.left=(e.clientWidth/2-(a+t.img.width/2))/t.img.width,t.relativeCenter.top=(e.clientHeight/2-(o+t.img.height/2))/t.img.height}),Object(r.addWheelListener)(e,function(e){e.preventDefault(),t.zoom(e.deltaY)}),s.addEventListener("error",function(e){console.error(e),t.needReset=!0}),s.addEventListener("load",function(){t.url=s.src,t.img.realWidth=s.width,t.img.realHeight=s.height;var e=s.width/s.height;t.img.whRate!==e&&(t.img.height=t.img.width/e,t.img.whRate=e),t.needReset&&(t.needReset=!1,t.boxReset())})},zoom:function(t){var e=this.img.width-t*this.img.width/1e3;if(e>100){var i=this.relativeCenter,n=i.top,r=i.left;this.boxResize({width:e}),this.boxCenter({top:n,left:r})}},reloadImage:function(){s.src=this.diagramUrl+"?t="+Date.now()},reloadUpdateJs:function(){var t=document.getElementsByTagName("head")[0],e=document.createElement("script"),i=function(){setTimeout(function(){t.removeChild(e)},200)};e.type="text/javascript",e.addEventListener("error",i),e.addEventListener("load",i),e.src="../tmp.js?t="+Date.now(),t.appendChild(e)}},mounted:function(){var t=this;this.bindEvent(),this.reloadImage(),window.updateDiagramURL=function(e){e!==t.lastTimestamp&&(t.lastTimestamp=e,t.reloadImage())},setInterval(function(){t.reloadUpdateJs()},1e3)}},h=i(1);var c=function(t){i(16)},d=Object(h.a)(l,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"body"},[n("div",{staticClass:"tools"},[n("a",{attrs:{title:"Double click"},on:{click:t.boxReset}},[n("img",{attrs:{src:i(10)}})]),t._v(" "),n("a",{attrs:{title:"Mouse wheel"},on:{click:function(e){t.zoom(-100)}}},[n("img",{attrs:{src:i(9)}})]),t._v(" "),n("a",{attrs:{title:"Mouse wheel"},on:{click:function(e){t.zoom(100)}}},[n("img",{attrs:{src:i(8)}})])]),t._v(" "),n("div",{ref:"wrapper",staticClass:"wrapper",on:{dblclick:t.boxReset}},[n("div",{ref:"box",staticClass:"box",style:{width:t.img.width+"px",height:t.img.height+"px"},attrs:{"data-center":"left: "+t.relativeCenter.left+", top: "+t.relativeCenter.top}},[n("img",{directives:[{name:"show",rawName:"v-show",value:t.url,expression:"url"}],attrs:{src:t.url},on:{load:function(){return t.$emit("loadedImage")}}})])])])},[],!1,c,"data-v-2d92bcce",null).exports;i(7);new n.a({el:"#app",render:function(t){return t(d)}})},,function(t,e,i){},function(t,e,i){t.exports=i.p+"c38c5e8361a61039ba107d5798346ce6.svg"},function(t,e,i){t.exports=i.p+"c027ca96553d780c4370107827292565.svg"},function(t,e,i){t.exports=i.p+"ce21159a71b4ecaf63de7f048eef373b.svg"},,,,,,function(t,e,i){},,,,function(t,e,i){t.exports=i(5)}]);