Files
server-configs/siyuan/data/plugins/kmind-plugin/app/js/chunk-034978b9.js

1 line
426 KiB
JavaScript
Raw Normal View History

2026-02-13 22:24:27 +08:00
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-034978b9"],{"053c":function(t,e,i){"use strict";var n=i("1e42");const o=["backgroundColor","backgroundImage","backgroundRepeat","backgroundPosition","backgroundSize"];class r{static setBackgroundStyle(t,e){if(!t)return;if(!r.cacheStyle){r.cacheStyle={};let e=window.getComputedStyle(t);o.forEach(t=>{r.cacheStyle[t]=e[t]})}let{backgroundColor:i,backgroundImage:n,backgroundRepeat:s,backgroundPosition:a,backgroundSize:h}=e;t.style.backgroundColor=i,n&&"none"!==n?(t.style.backgroundImage=`url(${n})`,t.style.backgroundRepeat=s,t.style.backgroundPosition=a,t.style.backgroundSize=h):t.style.backgroundImage="none"}static removeBackgroundStyle(t){r.cacheStyle&&(o.forEach(e=>{t.style[e]=r.cacheStyle[e]}),r.cacheStyle=null)}constructor(t){this.ctx=t,this._markerPath=null,this._marker=null,this._gradient=null}merge(t,e){let i=this.ctx.mindMap.getNodeThemeConfig?this.ctx.mindMap.getNodeThemeConfig(this.ctx):this.ctx.mindMap.themeConfig,n=null,o=!1;e?(o=!0,n=i):n=this.ctx.isGeneralization?i.generalization:0===this.ctx.layerIndex?i.root:1===this.ctx.layerIndex?i.second:i.node;let r="";return r=void 0!==this.getSelfStyle(t)?this.getSelfStyle(t):void 0!==n[t]?n[t]:i[t],o||this.addToEffectiveStyles({[t]:r}),r}getStyle(t,e){return this.merge(t,e)}getSelfStyle(t){return this.ctx.getData(t)}addToEffectiveStyles(t){this.ctx.effectiveStyles={...this.ctx.effectiveStyles,...t}}rect(t){this.shape(t),t.radius(this.merge("borderRadius"))}shape(t){const e={gradientStyle:this.merge("gradientStyle"),startColor:this.merge("startColor"),endColor:this.merge("endColor"),startDir:this.merge("startDir"),endDir:this.merge("endDir"),fillColor:this.merge("fillColor"),borderColor:this.merge("borderColor"),borderWidth:this.merge("borderWidth"),borderDasharray:this.merge("borderDasharray")};e.gradientStyle?(this._gradient||(this._gradient=this.ctx.nodeDraw.gradient("linear")),this._gradient.update(t=>{t.stop(0,e.startColor),t.stop(1,e.endColor)}),this._gradient.from(...e.startDir).to(...e.endDir),t.fill(this._gradient)):t.fill({color:e.fillColor}),t.stroke({color:e.borderColor,width:e.borderWidth,dasharray:e.borderDasharray})}text(t){const e={color:this.merge("color"),fontFamily:this.merge("fontFamily"),fontSize:this.merge("fontSize"),fontWeight:this.merge("fontWeight"),fontStyle:this.merge("fontStyle"),textDecoration:this.merge("textDecoration")};t.fill({color:e.color}).css({"font-family":e.fontFamily,"font-size":e.fontSize+"px","font-weight":e.fontWeight,"font-style":e.fontStyle,"text-decoration":e.textDecoration})}domText(t,e=1){const i={color:this.merge("color"),fontFamily:this.merge("fontFamily"),fontSize:this.merge("fontSize"),fontWeight:this.merge("fontWeight"),fontStyle:this.merge("fontStyle"),textDecoration:this.merge("textDecoration"),textAlign:this.merge("textAlign")};t.style.color=i.color,t.style.textDecoration=i.textDecoration,t.style.fontFamily=i.fontFamily,t.style.fontSize=i.fontSize*e+"px",t.style.fontWeight=i.fontWeight||"normal",t.style.fontStyle=i.fontStyle,t.style.textAlign=i.textAlign}tagText(t,e){t.fill({color:"#fff"}).css({"font-size":e.fontSize+"px"})}tagRect(t,e){t.fill({color:e.fill}),e.radius&&t.radius(e.radius)}iconNode(t,e){const i=e||this.merge("color");t.attr({fill:i,style:"fill: "+i})}line(t,{width:e,color:i,dasharray:n}={},o,r){const{customHandleLine:s}=this.ctx.mindMap.opt;"function"===typeof s&&s(this.ctx,t,{width:e,color:i,dasharray:n}),t.stroke({color:i,dasharray:n,width:e}).fill({color:"none"});const a=r&&r.style;if(o&&a){const e=this.merge("showLineMarker",!0);if(e){a._marker=a._marker||a.createMarker(),a._markerPath.stroke({color:i}).fill({color:i}),t.attr("marker-start",""),t.attr("marker-end","");const e=a.merge("lineMarkerDir");t.marker(e,a._marker)}else a._marker&&(t.attr("marker-start",""),t.attr("marker-end",""),a._marker.remove(),a._marker=null)}else t.attr("marker-start",""),t.attr("marker-end",""),a&&a._marker&&(a._marker.remove(),a._marker=null)}createMarker(){return this.ctx.lineDraw.marker(20,20,t=>{t.ref(8,5),t.size(20,20),t.attr("markerUnits","u