chunk-2d0a449b.cc554d99.js 13 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-2d0a449b"],{"0698":function(t,e,i){"use strict";var r=i("2cf4"),n=i("6d8b"),s=i("9ab4"),a=i("6fd3"),o=i("3437"),h=i("5210"),_=i("9850"),l=i("4bc4"),d=i("726e");function p(t,e,i){var r=d.d.createCanvas(),n=e.getWidth(),s=e.getHeight(),a=r.style;return a&&(a.position="absolute",a.left="0",a.top="0",a.width=n+"px",a.height=s+"px",r.setAttribute("data-zr-dom-id",t)),r.width=n*i,r.height=s*i,r}var c=function(t){function e(e,i,s){var a,o=t.call(this)||this;o.motionBlur=!1,o.lastFrameAlpha=.7,o.dpr=1,o.virtual=!1,o.config={},o.incremental=!1,o.zlevel=0,o.maxRepaintRectCount=5,o.__dirty=!0,o.__firstTimePaint=!0,o.__used=!1,o.__drawIndex=0,o.__startIndex=0,o.__endIndex=0,o.__prevStartIndex=null,o.__prevEndIndex=null,s=s||r.e,"string"==typeof e?a=p(e,i,s):n.A(e)&&(e=(a=e).id),o.id=e,o.dom=a;var h=a.style;return h&&(n.j(a),a.onselectstart=function(){return!1},h.padding="0",h.margin="0",h.borderWidth="0"),o.painter=i,o.dpr=s,o}return Object(s.b)(e,t),e.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},e.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},e.prototype.initContext=function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},e.prototype.setUnpainted=function(){this.__firstTimePaint=!0},e.prototype.createBackBuffer=function(){var t=this.dpr;this.domBack=p("back-"+this.id,this.painter,t),this.ctxBack=this.domBack.getContext("2d"),1!==t&&this.ctxBack.scale(t,t)},e.prototype.createRepaintRects=function(t,e,i,r){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var n,s=[],a=this.maxRepaintRectCount,o=!1,h=new _.a(0,0,0,0);function d(t){if(t.isFinite()&&!t.isZero())if(0===s.length){(e=new _.a(0,0,0,0)).copy(t),s.push(e)}else{for(var e,i=!1,r=1/0,n=0,l=0;l<s.length;++l){var d=s[l];if(d.intersect(t)){var p=new _.a(0,0,0,0);p.copy(d),p.union(t),s[l]=p,i=!0;break}if(o){h.copy(t),h.union(d);var c=t.width*t.height,u=d.width*d.height,f=h.width*h.height-c-u;f<r&&(r=f,n=l)}}if(o&&(s[n].union(t),i=!0),!i)(e=new _.a(0,0,0,0)).copy(t),s.push(e);o||(o=s.length>=a)}}for(var p=this.__startIndex;p<this.__endIndex;++p){if(f=t[p]){var c=f.shouldBePainted(i,r,!0,!0);(v=f.__isRendered&&(f.__dirty&l.a||!c)?f.getPrevPaintRect():null)&&d(v);var u=c&&(f.__dirty&l.a||!f.__isRendered)?f.getPaintRect():null;u&&d(u)}}for(p=this.__prevStartIndex;p<this.__prevEndIndex;++p){var f,v;c=(f=e[p])&&f.shouldBePainted(i,r,!0,!0);if(f&&(!c||!f.__zr)&&f.__isRendered)(v=f.getPrevPaintRect())&&d(v)}do{n=!1;for(p=0;p<s.length;)if(s[p].isZero())s.splice(p,1);else{for(var y=p+1;y<s.length;)s[p].intersect(s[y])?(n=!0,s[p].union(s[y]),s.splice(y,1)):y++;p++}}while(n);return this._paintRects=s,s},e.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},e.prototype.resize=function(t,e){var i=this.dpr,r=this.dom,n=r.style,s=this.domBack;n&&(n.width=t+"px",n.height=e+"px"),r.width=t*i,r.height=e*i,s&&(s.width=t*i,s.height=e*i,1!==i&&this.ctxBack.scale(i,i))},e.prototype.clear=function(t,e,i){var r=this.dom,s=this.ctx,a=r.width,_=r.height;e=e||this.clearColor;var l=this.motionBlur&&!t,d=this.lastFrameAlpha,p=this.dpr,c=this;l&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation="copy",this.ctxBack.drawImage(r,0,0,a/p,_/p));var u=this.domBack;function f(t,i,r,a){if(s.clearRect(t,i,r,a),e&&"transparent"!==e){var _=void 0;if(n.x(e))_=(e.global||e.__width===r&&e.__height===a)&&e.__canvasGradient||Object(o.a)(s,e,{x:0,y:0,width:r,height:a}),e.__canvasGradient=_,e.__width=r,e.__height=a;else n.y(e)&&(e.scaleX=e.scaleX||p,e.scaleY=e.scaleY||p,_=Object(h.c)(s,e,{dirty:function(){c.setUnpainted(),c.painter.refresh()}}));s.save(),s.fillStyle=_||e,s.fillRect(t,i,r,a),s.restore()}l&&(s.save(),s.globalAlpha=d,s.drawImage(u,t,i,r,a),s.restore())}!i||l?f(0,0,a,_):i.length&&n.k(i,(function(t){f(t.x*p,t.y*p,t.width*p,t.height*p)}))},e}(a.a),u=i("98b7"),f=i("22d1");var v=function(){function t(t,e,i,s){this.type="canvas",this._zlevelList=[],this._prevDisplayList=[],this._layers={},this._layerConfig={},this._needsManuallyCompositing=!1,this.type="canvas";var a=!t.nodeName||"CANVAS"===t.nodeName.toUpperCase();this._opts=i=n.m({},i||{}),this.dpr=i.devicePixelRatio||r.e,this._singleCanvas=a,this.root=t,t.style&&(n.j(t),t.innerHTML=""),this.storage=e;var h=this._zlevelList;this._prevDisplayList=[];var _=this._layers;if(a){var l=t,d=l.width,p=l.height;null!=i.width&&(d=i.width),null!=i.height&&(p=i.height),this.dpr=i.devicePixelRatio||1,l.width=d*this.dpr,l.height=p*this.dpr,this._width=d,this._height=p;var u=new c(l,this,this.dpr);u.__builtin__=!0,u.initContext(),_[314159]=u,u.zlevel=314159,h.push(314159),this._domRoot=t}else{this._width=Object(o.b)(t,0,i),this._height=Object(o.b)(t,1,i);var f=this._domRoot=function(t,e){var i=document.createElement("div");return i.style.cssText=["position:relative","width:"+t+"px","height:"+e+"px","padding:0","margin:0","border-width:0"].join(";")+";",i}(this._width,this._height);t.appendChild(f)}}return t.prototype.getType=function(){return"canvas"},t.prototype.isSingleCanvas=function(){return this._singleCanvas},t.prototype.getViewportRoot=function(){return this._domRoot},t.prototype.getViewportRootOffset=function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},t.prototype.refresh=function(t){var e=this.storage.getDisplayList(!0),i=this._prevDisplayList,r=this._zlevelList;this._redrawId=Math.random(),this._paintList(e,i,t,this._redrawId);for(var n=0;n<r.length;n++){var s=r[n],a=this._layers[s];if(!a.__builtin__&&a.refresh){var o=0===n?this._backgroundColor:null;a.refresh(o)}}return this._opts.useDirtyRect&&(this._prevDisplayList=e.slice()),this},t.prototype.refreshHover=function(){this._paintHoverList(this.storage.getDisplayList(!1))},t.prototype._paintHoverList=function(t){var e=t.length,i=this._hoverlayer;if(i&&i.clear(),e){for(var r,n={inHover:!0,viewWidth:this._width,viewHeight:this._height},s=0;s<e;s++){var a=t[s];a.__inHover&&(i||(i=this._hoverlayer=this.getLayer(1e5)),r||(r=i.ctx).save(),Object(h.a)(r,a,n,s===e-1))}r&&r.restore()}},t.prototype.getHoverLayer=function(){return this.getLayer(1e5)},t.prototype.paintOne=function(t,e){Object(h.b)(t,e)},t.prototype._paintList=function(t,e,i,r){if(this._redrawId===r){i=i||!1,this._updateLayerStatus(t);var n=this._doPaintList(t,e,i),s=n.finished,a=n.needsRefreshHover;if(this._needsManuallyCompositing&&this._compositeManually(),a&&this._paintHoverList(t),s)this.eachLayer((function(t){t.afterBrush&&t.afterBrush()}));else{var o=this;Object(u.a)((function(){o._paintList(t,e,i,r)}))}}},t.prototype._compositeManually=function(){var t=this.getLayer(314159).ctx,e=this._domRoot.width,i=this._domRoot.height;t.clearRect(0,0,e,i),this.eachBuiltinLayer((function(r){r.virtual&&t.drawImage(r.dom,0,0,e,i)}))},t.prototype._doPaintList=function(t,e,i){for(var r=this,s=[],a=this._opts.useDirtyRect,o=0;o<this._zlevelList.length;o++){var h=this._zlevelList[o],_=this._layers[h];_.__builtin__&&_!==this._hoverlayer&&(_.__dirty||i)&&s.push(_)}for(var l=!0,d=!1,p=function(n){var o,h=s[n],_=h.ctx,p=a&&h.createRepaintRects(t,e,c._width,c._height),u=i?h.__startIndex:h.__drawIndex,f=!i&&h.incremental&&Date.now,v=f&&Date.now(),y=h.zlevel===c._zlevelList[0]?c._backgroundColor:null;if(h.__startIndex===h.__endIndex)h.clear(!1,y,p);else if(u===h.__startIndex){var g=t[u];g.incremental&&g.notClear&&!i||h.clear(!1,y,p)}-1===u&&(u=h.__startIndex);var x=function(e){var i={inHover:!1,allClipped:!1,prevEl:null,viewWidth:r._width,viewHeight:r._height};for(o=u;o<h.__endIndex;o++){var n=t[o];if(n.__inHover&&(d=!0),r._doPaintEl(n,h,a,e,i,o===h.__endIndex-1),f)if(Date.now()-v>15)break}i.prevElClipPaths&&_.restore()};if(p)if(0===p.length)o=h.__endIndex;else for(var w=c.dpr,m=0;m<p.length;++m){var L=p[m];_.save(),_.beginPath(),_.rect(L.x*w,L.y*w,L.width*w,L.height*w),_.clip(),x(L),_.restore()}else _.save(),x(),_.restore();h.__drawIndex=o,h.__drawIndex<h.__endIndex&&(l=!1)},c=this,u=0;u<s.length;u++)p(u);return f.a.wxa&&n.k(this._layers,(function(t){t&&t.ctx&&t.ctx.draw&&t.ctx.draw()})),{finished:l,needsRefreshHover:d}},t.prototype._doPaintEl=function(t,e,i,r,n,s){var a=e.ctx;if(i){var o=t.getPaintRect();(!r||o&&o.intersect(r))&&(Object(h.a)(a,t,n,s),t.setPrevPaintRect(o))}else Object(h.a)(a,t,n,s)},t.prototype.getLayer=function(t,e){this._singleCanvas&&!this._needsManuallyCompositing&&(t=314159);var i=this._layers[t];return i||((i=new c("zr_"+t,this,this.dpr)).zlevel=t,i.__builtin__=!0,this._layerConfig[t]?n.I(i,this._layerConfig[t],!0):this._layerConfig[t-.01]&&n.I(i,this._layerConfig[t-.01],!0),e&&(i.virtual=e),this.insertLayer(t,i),i.initContext()),i},t.prototype.insertLayer=function(t,e){var i=this._layers,r=this._zlevelList,n=r.length,s=this._domRoot,a=null,o=-1;if(!i[t]&&function(t){return!!t&&(!!t.__builtin__||"function"==typeof t.resize&&"function"==typeof t.refresh)}(e)){if(n>0&&t>r[0]){for(o=0;o<n-1&&!(r[o]<t&&r[o+1]>t);o++);a=i[r[o]]}if(r.splice(o+1,0,t),i[t]=e,!e.virtual)if(a){var h=a.dom;h.nextSibling?s.insertBefore(e.dom,h.nextSibling):s.appendChild(e.dom)}else s.firstChild?s.insertBefore(e.dom,s.firstChild):s.appendChild(e.dom);e.painter||(e.painter=this)}},t.prototype.eachLayer=function(t,e){for(var i=this._zlevelList,r=0;r<i.length;r++){var n=i[r];t.call(e,this._layers[n],n)}},t.prototype.eachBuiltinLayer=function(t,e){for(var i=this._zlevelList,r=0;r<i.length;r++){var n=i[r],s=this._layers[n];s.__builtin__&&t.call(e,s,n)}},t.prototype.eachOtherLayer=function(t,e){for(var i=this._zlevelList,r=0;r<i.length;r++){var n=i[r],s=this._layers[n];s.__builtin__||t.call(e,s,n)}},t.prototype.getLayers=function(){return this._layers},t.prototype._updateLayerStatus=function(t){function e(t){a&&(a.__endIndex!==t&&(a.__dirty=!0),a.__endIndex=t)}if(this.eachBuiltinLayer((function(t,e){t.__dirty=t.__used=!1})),this._singleCanvas)for(var i=1;i<t.length;i++){if((h=t[i]).zlevel!==t[i-1].zlevel||h.incremental){this._needsManuallyCompositing=!0;break}}var r,s,a=null,o=0;for(s=0;s<t.length;s++){var h,_=(h=t[s]).zlevel,d=void 0;r!==_&&(r=_,o=0),h.incremental?((d=this.getLayer(_+.001,this._needsManuallyCompositing)).incremental=!0,o=1):d=this.getLayer(_+(o>0?.01:0),this._needsManuallyCompositing),d.__builtin__||n.G("ZLevel "+_+" has been used by unkown layer "+d.id),d!==a&&(d.__used=!0,d.__startIndex!==s&&(d.__dirty=!0),d.__startIndex=s,d.incremental?d.__drawIndex=-1:d.__drawIndex=s,e(s),a=d),h.__dirty&l.a&&!h.__inHover&&(d.__dirty=!0,d.incremental&&d.__drawIndex<0&&(d.__drawIndex=s))}e(s),this.eachBuiltinLayer((function(t,e){!t.__used&&t.getElementCount()>0&&(t.__dirty=!0,t.__startIndex=t.__endIndex=t.__drawIndex=0),t.__dirty&&t.__drawIndex<0&&(t.__drawIndex=t.__startIndex)}))},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(t){t.clear()},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t,n.k(this._layers,(function(t){t.setUnpainted()}))},t.prototype.configLayer=function(t,e){if(e){var i=this._layerConfig;i[t]?n.I(i[t],e,!0):i[t]=e;for(var r=0;r<this._zlevelList.length;r++){var s=this._zlevelList[r];if(s===t||s===t+.01){var a=this._layers[s];n.I(a,i[t],!0)}}}},t.prototype.delLayer=function(t){var e=this._layers,i=this._zlevelList,r=e[t];r&&(r.dom.parentNode.removeChild(r.dom),delete e[t],i.splice(n.r(i,t),1))},t.prototype.resize=function(t,e){if(this._domRoot.style){var i=this._domRoot;i.style.display="none";var r=this._opts,n=this.root;if(null!=t&&(r.width=t),null!=e&&(r.height=e),t=Object(o.b)(n,0,r),e=Object(o.b)(n,1,r),i.style.display="",this._width!==t||e!==this._height){for(var s in i.style.width=t+"px",i.style.height=e+"px",this._layers)this._layers.hasOwnProperty(s)&&this._layers[s].resize(t,e);this.refresh(!0)}this._width=t,this._height=e}else{if(null==t||null==e)return;this._width=t,this._height=e,this.getLayer(314159).resize(t,e)}return this},t.prototype.clearLayer=function(t){var e=this._layers[t];e&&e.clear()},t.prototype.dispose=function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},t.prototype.getRenderedCanvas=function(t){if(t=t||{},this._singleCanvas&&!this._compositeManually)return this._layers[314159].dom;var e=new c("image",this,t.pixelRatio||this.dpr);e.initContext(),e.clear(!1,t.backgroundColor||this._backgroundColor);var i=e.ctx;if(t.pixelRatio<=this.dpr){this.refresh();var r=e.dom.width,n=e.dom.height;this.eachLayer((function(t){t.__builtin__?i.drawImage(t.dom,0,0,r,n):t.renderToCanvas&&(i.save(),t.renderToCanvas(i),i.restore())}))}else for(var s={inHover:!1,viewWidth:this._width,viewHeight:this._height},a=this.storage.getDisplayList(!0),o=0,_=a.length;o<_;o++){var l=a[o];Object(h.a)(i,l,s,o===_-1)}return e.dom},t.prototype.getWidth=function(){return this._width},t.prototype.getHeight=function(){return this._height},t}();e.a=v}}]);