fix:修改 topology 源码 删除创建的节点以及给节点创建的对应的事件

This commit is contained in:
zhangyu
2022-07-14 09:55:10 +08:00
parent 739fa3e82f
commit 73b71d578f
186 changed files with 5955 additions and 6025 deletions

File diff suppressed because one or more lines are too long

View File

@@ -60,10 +60,10 @@ export default {
if (res2.length == 0) { if (res2.length == 0) {
this.topologyLoading = false this.topologyLoading = false
} }
// res2.forEach(item => { res2.forEach(item => {
// temp.push(item) temp.push(item)
// }) })
temp.push(res2[2]) // temp.push(res2[2])
this.allProject = JSON.parse(JSON.stringify(temp)) this.allProject = JSON.parse(JSON.stringify(temp))
temp = null temp = null
axiosAll = null axiosAll = null
@@ -101,6 +101,9 @@ export default {
}, },
mounted () { mounted () {
this.queryAllProjectData() this.queryAllProjectData()
},
beforeDestroy () {
this.allProject = []
} }
} }
</script> </script>

View File

@@ -28,7 +28,7 @@ import { formatScientificNotation, getMetricTypeValue } from '@/components/commo
import chartDataFormat from '@/components/chart/chartDataFormat' import chartDataFormat from '@/components/chart/chartDataFormat'
import { initColor } from '@/components/chart/chart/tools' import { initColor } from '@/components/chart/chart/tools'
import lodash from 'lodash' import lodash from 'lodash'
import bus from "@/libs/bus"; import bus from '@/libs/bus'
export default { export default {
name: 'chart-bar', name: 'chart-bar',

View File

@@ -293,7 +293,6 @@ export default {
} }
}, },
mounted () { mounted () {
this.chartId = `${this.chartInfo.id}${this.isFullscreen ? '-fullscreen' : ''}` this.chartId = `${this.chartInfo.id}${this.isFullscreen ? '-fullscreen' : ''}`
}, },
beforeDestroy () { beforeDestroy () {

View File

@@ -496,7 +496,7 @@ export default {
xhr.responseType = '' xhr.responseType = ''
// 创建一个 post 请求,采用异步 // 创建一个 post 请求,采用异步
xhr.open('get', 'http://192.168.44.100/' + nowUrl, true) xhr.open('get', 'http://192.168.44.100/' + nowUrl, true)
xhr.setRequestHeader('Authorization', localStorage.getItem('nz-token')); xhr.setRequestHeader('Authorization', localStorage.getItem('nz-token'))
// 注册相关事件回调处理函数 // 注册相关事件回调处理函数
xhr.onload = function (e) { xhr.onload = function (e) {
if (this.status == 200 || this.status == 304) { if (this.status == 200 || this.status == 304) {
@@ -504,7 +504,7 @@ export default {
resolve(JSON.parse(this.responseText)) resolve(JSON.parse(this.responseText))
} }
} }
xhr.onerror = function(e) { console.log(e) }; xhr.onerror = function (e) { console.log(e) }
// 发送数据 // 发送数据
xhr.send() xhr.send()
}) })

View File

@@ -1,6 +1,6 @@
export * from './src/final'; export * from './src/final'
export * from './src/fork'; export * from './src/fork'
export * from './src/swimlaneH'; export * from './src/swimlaneH'
export * from './src/swimlaneV'; export * from './src/swimlaneV'
export * from './src/register'; export * from './src/register'
//# sourceMappingURL=index.js.map // # sourceMappingURL=index.js.map

View File

@@ -1,10 +1,10 @@
export function activityFinal(ctx, node) { export function activityFinal (ctx, node) {
ctx.beginPath(); ctx.beginPath()
ctx.ellipse(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height / 2, node.rect.width / 2, node.rect.height / 2, 0, 0, Math.PI * 2); ctx.ellipse(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height / 2, node.rect.width / 2, node.rect.height / 2, 0, 0, Math.PI * 2)
ctx.stroke(); ctx.stroke()
ctx.beginPath(); ctx.beginPath()
ctx.fillStyle = ctx.strokeStyle; ctx.fillStyle = ctx.strokeStyle
ctx.ellipse(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height / 2, node.rect.width / 4, node.rect.height / 4, 0, 0, Math.PI * 2); ctx.ellipse(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height / 2, node.rect.width / 4, node.rect.height / 4, 0, 0, Math.PI * 2)
ctx.fill(); ctx.fill()
} }
//# sourceMappingURL=final.js.map // # sourceMappingURL=final.js.map

View File

@@ -1,11 +1,11 @@
import { Rect } from '@topology/core'; import { Rect } from '@topology/core'
export function activityFinalIconRect(node) { export function activityFinalIconRect (node) {
node.iconRect = new Rect(0, 0, 0, 0); node.iconRect = new Rect(0, 0, 0, 0)
} }
export function activityFinalTextRect(node) { export function activityFinalTextRect (node) {
var w = (node.rect.width * 5) / 7; const w = (node.rect.width * 5) / 7
var h = (node.rect.height * 5) / 7; const h = (node.rect.height * 5) / 7
node.textRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + (node.rect.height - h) / 2, w, h); node.textRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + (node.rect.height - h) / 2, w, h)
node.fullTextRect = node.textRect; node.fullTextRect = node.textRect
} }
//# sourceMappingURL=final.rect.js.map // # sourceMappingURL=final.rect.js.map

View File

@@ -1,3 +1,3 @@
export * from './final'; export * from './final'
export * from './final.rect'; export * from './final.rect'
//# sourceMappingURL=index.js.map // # sourceMappingURL=index.js.map

View File

@@ -1,28 +1,28 @@
import { Point, Direction } from '@topology/core'; import { Point, Direction } from '@topology/core'
export function forkHAnchors(node) { export function forkHAnchors (node) {
node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left)); node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left))
node.anchors.push(new Point(node.rect.ex, node.rect.y + node.rect.height / 2, Direction.Right)); node.anchors.push(new Point(node.rect.ex, node.rect.y + node.rect.height / 2, Direction.Right))
var dis = 5; const dis = 5
for (var i = dis; node.rect.x + i < node.rect.ex; i = i + dis) { for (let i = dis; node.rect.x + i < node.rect.ex; i = i + dis) {
var pt1 = new Point(node.rect.x + i, node.rect.y, Direction.Up); const pt1 = new Point(node.rect.x + i, node.rect.y, Direction.Up)
var pt2 = new Point(node.rect.x + i, node.rect.ey, Direction.Bottom); const pt2 = new Point(node.rect.x + i, node.rect.ey, Direction.Bottom)
pt1.hidden = true; pt1.hidden = true
pt2.hidden = true; pt2.hidden = true
node.anchors.push(pt1); node.anchors.push(pt1)
node.anchors.push(pt2); node.anchors.push(pt2)
} }
} }
export function forkVAnchors(node) { export function forkVAnchors (node) {
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up))
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.ey, Direction.Bottom)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.ey, Direction.Bottom))
var dis = 5; const dis = 5
for (var i = dis; node.rect.y + i < node.rect.ey; i = i + dis) { for (let i = dis; node.rect.y + i < node.rect.ey; i = i + dis) {
var pt1 = new Point(node.rect.x, node.rect.y + i, Direction.Left); const pt1 = new Point(node.rect.x, node.rect.y + i, Direction.Left)
var pt2 = new Point(node.rect.ex, node.rect.y + i, Direction.Right); const pt2 = new Point(node.rect.ex, node.rect.y + i, Direction.Right)
pt1.hidden = true; pt1.hidden = true
pt2.hidden = true; pt2.hidden = true
node.anchors.push(pt1); node.anchors.push(pt1)
node.anchors.push(pt2); node.anchors.push(pt2)
} }
} }
//# sourceMappingURL=fork.anchor.js.map // # sourceMappingURL=fork.anchor.js.map

View File

@@ -1,25 +1,25 @@
export function fork(ctx, node) { export function fork (ctx, node) {
var wr = node.borderRadius; let wr = node.borderRadius
var hr = node.borderRadius; let hr = node.borderRadius
if (node.borderRadius < 1) { if (node.borderRadius < 1) {
wr = node.rect.width * node.borderRadius; wr = node.rect.width * node.borderRadius
hr = node.rect.height * node.borderRadius; hr = node.rect.height * node.borderRadius
} }
var r = wr < hr ? wr : hr; let r = wr < hr ? wr : hr
if (node.rect.width < 2 * r) { if (node.rect.width < 2 * r) {
r = node.rect.width / 2; r = node.rect.width / 2
} }
if (node.rect.height < 2 * r) { if (node.rect.height < 2 * r) {
r = node.rect.height / 2; r = node.rect.height / 2
} }
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x + r, node.rect.y); ctx.moveTo(node.rect.x + r, node.rect.y)
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y, node.rect.x + node.rect.width, node.rect.y + node.rect.height, r); ctx.arcTo(node.rect.x + node.rect.width, node.rect.y, node.rect.x + node.rect.width, node.rect.y + node.rect.height, r)
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r); ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r)
ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r); ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r)
ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r); ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r)
ctx.closePath(); ctx.closePath();
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=fork.js.map // # sourceMappingURL=fork.js.map

View File

@@ -1,9 +1,9 @@
import { Rect } from '@topology/core'; import { Rect } from '@topology/core'
export function forkIconRect(node) { export function forkIconRect (node) {
node.iconRect = new Rect(0, 0, 0, 0); node.iconRect = new Rect(0, 0, 0, 0)
} }
export function forkTextRect(node) { export function forkTextRect (node) {
node.textRect = new Rect(node.rect.x, node.rect.y, node.rect.width, node.rect.height); node.textRect = new Rect(node.rect.x, node.rect.y, node.rect.width, node.rect.height)
node.fullTextRect = node.textRect; node.fullTextRect = node.textRect
} }
//# sourceMappingURL=fork.rect.js.map // # sourceMappingURL=fork.rect.js.map

View File

@@ -1,4 +1,4 @@
export * from './fork'; export * from './fork'
export * from './fork.rect'; export * from './fork.rect'
export * from './fork.anchor'; export * from './fork.anchor'
//# sourceMappingURL=index.js.map // # sourceMappingURL=index.js.map

View File

@@ -1,13 +1,13 @@
import { registerNode } from '@topology/core'; import { registerNode } from '@topology/core'
import { activityFinal, activityFinalIconRect, activityFinalTextRect } from './final'; import { activityFinal, activityFinalIconRect, activityFinalTextRect } from './final'
import { fork, forkHAnchors, forkVAnchors, forkIconRect, forkTextRect } from './fork'; import { fork, forkHAnchors, forkVAnchors, forkIconRect, forkTextRect } from './fork'
import { swimlaneH, swimlaneHIconRect, swimlaneHTextRect } from './swimlaneH'; import { swimlaneH, swimlaneHIconRect, swimlaneHTextRect } from './swimlaneH'
import { swimlaneV, swimlaneVIconRect, swimlaneVTextRect } from './swimlaneV'; import { swimlaneV, swimlaneVIconRect, swimlaneVTextRect } from './swimlaneV'
export function register() { export function register () {
registerNode('activityFinal', activityFinal, null, activityFinalIconRect, activityFinalTextRect); registerNode('activityFinal', activityFinal, null, activityFinalIconRect, activityFinalTextRect)
registerNode('swimlaneV', swimlaneV, null, swimlaneVIconRect, swimlaneVTextRect); registerNode('swimlaneV', swimlaneV, null, swimlaneVIconRect, swimlaneVTextRect)
registerNode('swimlaneH', swimlaneH, null, swimlaneHIconRect, swimlaneHTextRect); registerNode('swimlaneH', swimlaneH, null, swimlaneHIconRect, swimlaneHTextRect)
registerNode('forkH', fork, forkHAnchors, forkIconRect, forkTextRect); registerNode('forkH', fork, forkHAnchors, forkIconRect, forkTextRect)
registerNode('forkV', fork, forkVAnchors, forkIconRect, forkTextRect); registerNode('forkV', fork, forkVAnchors, forkIconRect, forkTextRect)
} }
//# sourceMappingURL=register.js.map // # sourceMappingURL=register.js.map

View File

@@ -1,3 +1,3 @@
export * from './swimlaneH'; export * from './swimlaneH'
export * from './swimlaneH.rect'; export * from './swimlaneH.rect'
//# sourceMappingURL=index.js.map // # sourceMappingURL=index.js.map

View File

@@ -1,27 +1,27 @@
export function swimlaneH(ctx, node) { export function swimlaneH (ctx, node) {
var wr = node.borderRadius; let wr = node.borderRadius
var hr = node.borderRadius; let hr = node.borderRadius
if (node.borderRadius < 1) { if (node.borderRadius < 1) {
wr = node.rect.width * node.borderRadius; wr = node.rect.width * node.borderRadius
hr = node.rect.height * node.borderRadius; hr = node.rect.height * node.borderRadius
} }
var r = wr < hr ? wr : hr; let r = wr < hr ? wr : hr
if (node.rect.width < 2 * r) { if (node.rect.width < 2 * r) {
r = node.rect.width / 2; r = node.rect.width / 2
} }
if (node.rect.height < 2 * r) { if (node.rect.height < 2 * r) {
r = node.rect.height / 2; r = node.rect.height / 2
} }
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x + r, node.rect.y); ctx.moveTo(node.rect.x + r, node.rect.y)
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y, node.rect.x + node.rect.width, node.rect.y + node.rect.height, r); ctx.arcTo(node.rect.x + node.rect.width, node.rect.y, node.rect.x + node.rect.width, node.rect.y + node.rect.height, r)
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r); ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r)
ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r); ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r)
ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r); ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r)
ctx.closePath(); ctx.closePath()
ctx.moveTo(node.rect.x + 40, node.rect.y); ctx.moveTo(node.rect.x + 40, node.rect.y)
ctx.lineTo(node.rect.x + 40, node.rect.ey); ctx.lineTo(node.rect.x + 40, node.rect.ey);
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=swimlaneH.js.map // # sourceMappingURL=swimlaneH.js.map

View File

@@ -1,9 +1,9 @@
import { Rect } from '@topology/core'; import { Rect } from '@topology/core'
export function swimlaneHIconRect(node) { export function swimlaneHIconRect (node) {
node.iconRect = new Rect(0, 0, 0, 0); node.iconRect = new Rect(0, 0, 0, 0)
} }
export function swimlaneHTextRect(node) { export function swimlaneHTextRect (node) {
node.textRect = new Rect(node.rect.x + 10, node.rect.y, 20, node.rect.height); node.textRect = new Rect(node.rect.x + 10, node.rect.y, 20, node.rect.height)
node.fullTextRect = node.textRect; node.fullTextRect = node.textRect
} }
//# sourceMappingURL=swimlaneH.rect.js.map // # sourceMappingURL=swimlaneH.rect.js.map

View File

@@ -1,3 +1,3 @@
export * from './swimlaneV'; export * from './swimlaneV'
export * from './swimlaneV.rect'; export * from './swimlaneV.rect'
//# sourceMappingURL=index.js.map // # sourceMappingURL=index.js.map

View File

@@ -1,27 +1,27 @@
export function swimlaneV(ctx, node) { export function swimlaneV (ctx, node) {
var wr = node.borderRadius; let wr = node.borderRadius
var hr = node.borderRadius; let hr = node.borderRadius
if (node.borderRadius < 1) { if (node.borderRadius < 1) {
wr = node.rect.width * node.borderRadius; wr = node.rect.width * node.borderRadius
hr = node.rect.height * node.borderRadius; hr = node.rect.height * node.borderRadius
} }
var r = wr < hr ? wr : hr; let r = wr < hr ? wr : hr
if (node.rect.width < 2 * r) { if (node.rect.width < 2 * r) {
r = node.rect.width / 2; r = node.rect.width / 2
} }
if (node.rect.height < 2 * r) { if (node.rect.height < 2 * r) {
r = node.rect.height / 2; r = node.rect.height / 2
} }
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x + r, node.rect.y); ctx.moveTo(node.rect.x + r, node.rect.y)
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y, node.rect.x + node.rect.width, node.rect.y + node.rect.height, r); ctx.arcTo(node.rect.x + node.rect.width, node.rect.y, node.rect.x + node.rect.width, node.rect.y + node.rect.height, r)
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r); ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r)
ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r); ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r)
ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r); ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r)
ctx.closePath(); ctx.closePath()
ctx.moveTo(node.rect.x, node.rect.y + 40); ctx.moveTo(node.rect.x, node.rect.y + 40)
ctx.lineTo(node.rect.ex, node.rect.y + 40); ctx.lineTo(node.rect.ex, node.rect.y + 40);
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=swimlaneV.js.map // # sourceMappingURL=swimlaneV.js.map

View File

@@ -1,9 +1,9 @@
import { Rect } from '@topology/core'; import { Rect } from '@topology/core'
export function swimlaneVIconRect(node) { export function swimlaneVIconRect (node) {
node.iconRect = new Rect(0, 0, 0, 0); node.iconRect = new Rect(0, 0, 0, 0)
} }
export function swimlaneVTextRect(node) { export function swimlaneVTextRect (node) {
node.textRect = new Rect(node.rect.x, node.rect.y, node.rect.width, 40); node.textRect = new Rect(node.rect.x, node.rect.y, node.rect.width, 40)
node.fullTextRect = node.textRect; node.fullTextRect = node.textRect
} }
//# sourceMappingURL=swimlaneV.rect.js.map // # sourceMappingURL=swimlaneV.rect.js.map

View File

@@ -1,3 +1,3 @@
export * from './src/echarts'; export * from './src/echarts'
export * from './src/register'; export * from './src/register'
//# sourceMappingURL=index.js.map // # sourceMappingURL=index.js.map

View File

@@ -1,44 +1,44 @@
import { s8, createDiv, rectangle } from '@topology/core'; import { s8, createDiv, rectangle } from '@topology/core'
export var echartsObjs = {}; export var echartsObjs = {}
export function echarts(ctx, node) { export function echarts (ctx, node) {
// 绘制一个底图,类似于占位符。 // 绘制一个底图,类似于占位符。
rectangle(ctx, node); rectangle(ctx, node)
// tslint:disable-next-line:no-shadowed-variable // tslint:disable-next-line:no-shadowed-variable
var echarts = echartsObjs.echarts || window.echarts; const echarts = echartsObjs.echarts || window.echarts
if (!node.data || !echarts) { if (!node.data || !echarts) {
return; return
} }
if (typeof node.data === 'string') { if (typeof node.data === 'string') {
node.data = JSON.parse(node.data); node.data = JSON.parse(node.data)
} }
if (!node.data.echarts) { if (!node.data.echarts) {
return; return
} }
if (!node.elementId) { if (!node.elementId) {
node.elementId = s8(); node.elementId = s8()
} }
if (!node.elementLoaded) { if (!node.elementLoaded) {
echartsObjs[node.id] = { echartsObjs[node.id] = {
div: createDiv(node), div: createDiv(node)
};
node.elementLoaded = true;
document.body.appendChild(echartsObjs[node.id].div);
// 添加当前节点到div层
node.addToDiv();
echartsObjs[node.id].chart = echarts.init(echartsObjs[node.id].div, node.data.echarts.theme);
node.elementRendered = false;
// 等待父div先渲染完成避免初始图表控件太大
setTimeout(function () {
echartsObjs[node.id].chart.resize();
});
}
if (!node.elementRendered) {
// 初始化时等待父div先渲染完成避免初始图表控件太大。
setTimeout(function () {
echartsObjs[node.id].chart.setOption(node.data.echarts.option);
echartsObjs[node.id].chart.resize();
node.elementRendered = true;
});
} }
node.elementLoaded = true
document.body.appendChild(echartsObjs[node.id].div)
// 添加当前节点到div层
node.addToDiv()
echartsObjs[node.id].chart = echarts.init(echartsObjs[node.id].div, node.data.echarts.theme)
node.elementRendered = false
// 等待父div先渲染完成避免初始图表控件太大
setTimeout(function () {
echartsObjs[node.id].chart.resize()
})
}
if (!node.elementRendered) {
// 初始化时等待父div先渲染完成避免初始图表控件太大。
setTimeout(function () {
echartsObjs[node.id].chart.setOption(node.data.echarts.option)
echartsObjs[node.id].chart.resize()
node.elementRendered = true
})
}
} }
//# sourceMappingURL=index.js.map // # sourceMappingURL=index.js.map

View File

@@ -1,10 +1,10 @@
import { registerNode, loadJS } from '@topology/core'; import { registerNode, loadJS } from '@topology/core'
import { echarts, echartsObjs } from './echarts'; import { echarts, echartsObjs } from './echarts'
export function register(_echarts) { export function register (_echarts) {
echartsObjs.echarts = _echarts; echartsObjs.echarts = _echarts
if (!echartsObjs.echarts && !window.echarts) { if (!echartsObjs.echarts && !window.echarts) {
loadJS('https://cdn.bootcdn.net/ajax/libs/echarts/4.8.0/echarts.min.js', null, true); loadJS('https://cdn.bootcdn.net/ajax/libs/echarts/4.8.0/echarts.min.js', null, true)
} }
registerNode('echarts', echarts, null, null, null); registerNode('echarts', echarts, null, null, null)
} }
//# sourceMappingURL=register.js.map // # sourceMappingURL=register.js.map

View File

@@ -1,3 +1,3 @@
export * from './src/class'; export * from './src/class'
export * from './src/register'; export * from './src/register'
//# sourceMappingURL=index.js.map // # sourceMappingURL=index.js.map

View File

@@ -1,56 +1,56 @@
export function simpleClass(ctx, node) { export function simpleClass (ctx, node) {
var wr = node.borderRadius; let wr = node.borderRadius
var hr = node.borderRadius; let hr = node.borderRadius
if (node.borderRadius < 1) { if (node.borderRadius < 1) {
wr = node.rect.width * node.borderRadius; wr = node.rect.width * node.borderRadius
hr = node.rect.height * node.borderRadius; hr = node.rect.height * node.borderRadius
} }
var r = wr < hr ? wr : hr; let r = wr < hr ? wr : hr
if (node.rect.width < 2 * r) { if (node.rect.width < 2 * r) {
r = node.rect.width / 2; r = node.rect.width / 2
} }
if (node.rect.height < 2 * r) { if (node.rect.height < 2 * r) {
r = node.rect.height / 2; r = node.rect.height / 2
} }
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x + r, node.rect.y); ctx.moveTo(node.rect.x + r, node.rect.y)
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y, node.rect.x + node.rect.width, node.rect.y + node.rect.height, r); ctx.arcTo(node.rect.x + node.rect.width, node.rect.y, node.rect.x + node.rect.width, node.rect.y + node.rect.height, r)
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r); ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r)
ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r); ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r)
ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r); ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r)
ctx.closePath(); ctx.closePath()
ctx.moveTo(node.rect.x, node.rect.y + 40); ctx.moveTo(node.rect.x, node.rect.y + 40)
ctx.lineTo(node.rect.ex, node.rect.y + 40); ctx.lineTo(node.rect.ex, node.rect.y + 40);
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
export function interfaceClass(ctx, node) { export function interfaceClass (ctx, node) {
var wr = node.borderRadius; let wr = node.borderRadius
var hr = node.borderRadius; let hr = node.borderRadius
if (node.borderRadius < 1) { if (node.borderRadius < 1) {
wr = node.rect.width * node.borderRadius; wr = node.rect.width * node.borderRadius
hr = node.rect.height * node.borderRadius; hr = node.rect.height * node.borderRadius
} }
var r = wr < hr ? wr : hr; let r = wr < hr ? wr : hr
if (node.rect.width < 2 * r) { if (node.rect.width < 2 * r) {
r = node.rect.width / 2; r = node.rect.width / 2
} }
if (node.rect.height < 2 * r) { if (node.rect.height < 2 * r) {
r = node.rect.height / 2; r = node.rect.height / 2
} }
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x + r, node.rect.y); ctx.moveTo(node.rect.x + r, node.rect.y)
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y, node.rect.x + node.rect.width, node.rect.y + node.rect.height, r); ctx.arcTo(node.rect.x + node.rect.width, node.rect.y, node.rect.x + node.rect.width, node.rect.y + node.rect.height, r)
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r); ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r)
ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r); ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r)
ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r); ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r)
ctx.closePath(); ctx.closePath()
ctx.moveTo(node.rect.x, node.rect.y + 40); ctx.moveTo(node.rect.x, node.rect.y + 40)
ctx.lineTo(node.rect.ex, node.rect.y + 40); ctx.lineTo(node.rect.ex, node.rect.y + 40)
var height = node.rect.y + 20 + node.rect.height / 2; const height = node.rect.y + 20 + node.rect.height / 2
ctx.moveTo(node.rect.x, height); ctx.moveTo(node.rect.x, height)
ctx.lineTo(node.rect.ex, height); ctx.lineTo(node.rect.ex, height);
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=class.js.map // # sourceMappingURL=class.js.map

View File

@@ -1,16 +1,16 @@
import { Rect } from '@topology/core'; import { Rect } from '@topology/core'
export function simpleClassIconRect(node) { export function simpleClassIconRect (node) {
node.iconRect = new Rect(0, 0, 0, 0); node.iconRect = new Rect(0, 0, 0, 0)
} }
export function simpleClassTextRect(node) { export function simpleClassTextRect (node) {
node.textRect = new Rect(node.rect.x, node.rect.y, node.rect.width, 40); node.textRect = new Rect(node.rect.x, node.rect.y, node.rect.width, 40)
node.fullTextRect = node.textRect; node.fullTextRect = node.textRect
} }
export function interfaceClassIconRect(node) { export function interfaceClassIconRect (node) {
node.iconRect = new Rect(0, 0, 0, 0); node.iconRect = new Rect(0, 0, 0, 0)
} }
export function interfaceClassTextRect(node) { export function interfaceClassTextRect (node) {
node.textRect = new Rect(node.rect.x, node.rect.y, node.rect.width, 40); node.textRect = new Rect(node.rect.x, node.rect.y, node.rect.width, 40)
node.fullTextRect = node.textRect; node.fullTextRect = node.textRect
} }
//# sourceMappingURL=class.rect.js.map // # sourceMappingURL=class.rect.js.map

View File

@@ -1,3 +1,3 @@
export * from './class'; export * from './class'
export * from './class.rect'; export * from './class.rect'
//# sourceMappingURL=index.js.map // # sourceMappingURL=index.js.map

View File

@@ -1,7 +1,7 @@
import { registerNode } from '@topology/core'; import { registerNode } from '@topology/core'
import { simpleClass, simpleClassIconRect, simpleClassTextRect, interfaceClass, interfaceClassIconRect, interfaceClassTextRect } from './class'; import { simpleClass, simpleClassIconRect, simpleClassTextRect, interfaceClass, interfaceClassIconRect, interfaceClassTextRect } from './class'
export function register() { export function register () {
registerNode('simpleClass', simpleClass, null, simpleClassIconRect, simpleClassTextRect); registerNode('simpleClass', simpleClass, null, simpleClassIconRect, simpleClassTextRect)
registerNode('interfaceClass', interfaceClass, null, interfaceClassIconRect, interfaceClassTextRect); registerNode('interfaceClass', interfaceClass, null, interfaceClassIconRect, interfaceClassTextRect)
} }
//# sourceMappingURL=register.js.map // # sourceMappingURL=register.js.map

View File

@@ -1,6 +1,6 @@
export * from './src/core'; export * from './src/core'
export * from './src/options'; export * from './src/options'
export * from './src/utils'; export * from './src/utils'
export * from './src/models'; export * from './src/models'
export * from './src/middles'; export * from './src/middles'
//# sourceMappingURL=index.js.map // # sourceMappingURL=index.js.map

View File

@@ -1,264 +1,256 @@
var __extends = (this && this.__extends) || (function () { import { Store } from 'le5le-store'
var extendStatics = function (d, b) { import { PenType } from './models/pen'
extendStatics = Object.setPrototypeOf || import { Node } from './models/node'
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || import { Line } from './models/line'
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; import { Layer } from './layer'
return extendStatics(d, b); import { s8 } from './utils/uuid'
}; import { find } from './utils/canvas'
return function (d, b) { const __extends = (this && this.__extends) || (function () {
extendStatics(d, b); var extendStatics = function (d, b) {
function __() { this.constructor = d; } extendStatics = Object.setPrototypeOf ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b }) ||
}; function (d, b) { for (const p in b) if (b.hasOwnProperty(p)) d[p] = b[p] }
})(); return extendStatics(d, b)
import { Store } from 'le5le-store'; }
import { PenType } from './models/pen'; return function (d, b) {
import { Node } from './models/node'; extendStatics(d, b)
import { Line } from './models/line'; function __ () { this.constructor = d }
import { Layer } from './layer'; d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __())
import { s8 } from './utils/uuid'; }
import { find } from './utils/canvas'; })()
var AnimateLayer = /** @class */ (function (_super) { const AnimateLayer = /** @class */ (function (_super) {
__extends(AnimateLayer, _super); __extends(AnimateLayer, _super)
function AnimateLayer(options, TID) { function AnimateLayer (options, TID) {
if (options === void 0) { options = {}; } if (options === void 0) { options = {} }
var _this = _super.call(this, TID) || this; const _this = _super.call(this, TID) || this
_this.options = options; _this.options = options
_this.pens = new Map(); _this.pens = new Map()
_this.lastNow = 0; _this.lastNow = 0
Store.set(_this.generateStoreKey('LT:AnimateLayer'), _this); Store.set(_this.generateStoreKey('LT:AnimateLayer'), _this)
if (!_this.options.animateColor) { if (!_this.options.animateColor) {
_this.options.animateColor = '#ff6600'; _this.options.animateColor = '#ff6600'
}
_this.subscribeUpdate = Store.subscribe(_this.generateStoreKey('LT:updateLines'), function (lines) {
_this.updateLines(lines);
});
_this.subscribePlay = Store.subscribe(_this.generateStoreKey('LT:AnimatePlay'), function (params) {
if (params.stop) {
if (params.tag) {
var pens = find(params.tag, _this.data.pens);
pens.forEach(function (item) {
if (_this.pens.has(item.id)) {
_this.pens.get(item.id).animateStart = 0;
}
});
}
if (params.pen && _this.pens.has(params.pen.id)) {
_this.pens.get(params.pen.id).animateStart = 0;
}
}
else {
if (params.pen) {
if (_this.pens.has(params.pen.id)) {
_this.pens.get(params.pen.id).animateStart = Date.now();
}
else {
if (params.pen.type) {
_this.pens.set(params.pen.id, _this.getAnimateLine(params.pen));
}
else {
_this.pens.set(params.pen.id, params.pen);
}
}
}
if (params.tag) {
_this.readyPlay(params.tag, false);
}
}
_this.animate();
});
return _this;
} }
AnimateLayer.prototype.getAnimateLine = function (item) { _this.subscribeUpdate = Store.subscribe(_this.generateStoreKey('LT:updateLines'), function (lines) {
var l = new Line(item); _this.updateLines(lines)
l.data = l.id; })
l.id = s8(); _this.subscribePlay = Store.subscribe(_this.generateStoreKey('LT:AnimatePlay'), function (params) {
l.setTID(this.TID); if (params.stop) {
l.isAnimate = true; if (params.tag) {
l.toArrow = ''; const pens = find(params.tag, _this.data.pens)
if (l.fromArrow && l.fromArrow.indexOf('line') < 0) { pens.forEach(function (item) {
l.animateFromSize = l.fromArrowSize + l.lineWidth * 5; if (_this.pens.has(item.id)) {
_this.pens.get(item.id).animateStart = 0
}
})
} }
if (l.toArrow && l.toArrow.indexOf('line') < 0) { if (params.pen && _this.pens.has(params.pen.id)) {
l.animateToSize = l.toArrowSize + l.lineWidth * 5; _this.pens.get(params.pen.id).animateStart = 0
} }
l.animateStart = item.animateStart; } else {
l.lineCap = 'round'; if (params.pen) {
l.fillStyle = '#fff'; if (_this.pens.has(params.pen.id)) {
l.strokeStyle = l.animateColor || this.options.animateColor; _this.pens.get(params.pen.id).animateStart = Date.now()
l.length = l.getLen(); } else {
if (!l.fromArrowColor) { if (params.pen.type) {
l.fromArrowColor = l.strokeStyle || Store.get(this.generateStoreKey('LT:color')); _this.pens.set(params.pen.id, _this.getAnimateLine(params.pen))
} else {
_this.pens.set(params.pen.id, params.pen)
}
}
} }
if (!l.toArrowColor) { if (params.tag) {
l.toArrowColor = l.strokeStyle || Store.get(this.generateStoreKey('LT:color')); _this.readyPlay(params.tag, false)
} }
return l; }
}; _this.animate()
AnimateLayer.prototype.findLine = function (pen) { })
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) { return _this
var item = _a[_i]; }
if (item.id === pen.data) { AnimateLayer.prototype.getAnimateLine = function (item) {
return item; const l = new Line(item)
} l.data = l.id
l.id = s8()
l.setTID(this.TID)
l.isAnimate = true
l.toArrow = ''
if (l.fromArrow && l.fromArrow.indexOf('line') < 0) {
l.animateFromSize = l.fromArrowSize + l.lineWidth * 5
}
if (l.toArrow && l.toArrow.indexOf('line') < 0) {
l.animateToSize = l.toArrowSize + l.lineWidth * 5
}
l.animateStart = item.animateStart
l.lineCap = 'round'
l.fillStyle = '#fff'
l.strokeStyle = l.animateColor || this.options.animateColor
l.length = l.getLen()
if (!l.fromArrowColor) {
l.fromArrowColor = l.strokeStyle || Store.get(this.generateStoreKey('LT:color'))
}
if (!l.toArrowColor) {
l.toArrowColor = l.strokeStyle || Store.get(this.generateStoreKey('LT:color'))
}
return l
}
AnimateLayer.prototype.findLine = function (pen) {
for (let _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
const item = _a[_i]
if (item.id === pen.data) {
return item
}
}
}
AnimateLayer.prototype.readyPlay = function (tag, auto, pens) {
const _this = this
const readyPens = new Map()
if (!pens) {
pens = this.data.pens
}
pens.forEach(function (pen) {
pen.setTID(_this.TID)
if (!pen.visible || readyPens.get(pen.id)) {
return
}
if ((auto && pen.animatePlay) || (tag && pen.tags.indexOf(tag) > -1)) {
if (!pen.animateStart || pen.animateStart < 1) {
pen.animateStart = Date.now()
} }
}; }
AnimateLayer.prototype.readyPlay = function (tag, auto, pens) { if (pen instanceof Node) {
var _this = this; if (pen.animateStart > 0) {
var readyPens = new Map(); if (!pen.animateReady) {
if (!pens) { pen.initAnimate()
pens = this.data.pens; }
readyPens.set(pen.id, pen)
} }
pens.forEach(function (pen) { if (pen.children && pen.children.length) {
pen.setTID(_this.TID); _this.readyPlay(tag, auto, pen.children)
if (!pen.visible || readyPens.get(pen.id)) {
return;
}
if ((auto && pen.animatePlay) || (tag && pen.tags.indexOf(tag) > -1)) {
if (!pen.animateStart || pen.animateStart < 1) {
pen.animateStart = Date.now();
}
}
if (pen instanceof Node) {
if (pen.animateStart > 0) {
if (!pen.animateReady) {
pen.initAnimate();
}
readyPens.set(pen.id, pen);
}
if (pen.children && pen.children.length) {
_this.readyPlay(tag, auto, pen.children);
}
}
else {
if (pen.animateStart > 0) {
readyPens.set(pen.id, _this.getAnimateLine(pen));
}
else if (_this.pens.has(pen.id)) {
_this.pens.get(pen.id).animateStart = 0;
}
}
});
readyPens.forEach(function (pen) {
if (pen.type) {
_this.pens.set(pen.data, pen);
}
else {
_this.pens.set(pen.id, pen);
}
});
};
AnimateLayer.prototype.animate = function () {
var _this = this;
if (this.timer) {
cancelAnimationFrame(this.timer);
} }
this.timer = requestAnimationFrame(function () { } else {
var now = Date.now(); if (pen.animateStart > 0) {
if (now - _this.lastNow < _this.options.refresh) { readyPens.set(pen.id, _this.getAnimateLine(pen))
_this.animate(); } else if (_this.pens.has(pen.id)) {
return; _this.pens.get(pen.id).animateStart = 0
}
_this.lastNow = now;
var animated = false;
_this.pens.forEach(function (pen) {
if (!pen.animateStart || pen.animateStart < 1) {
if (pen.type) {
_this.pens.delete(pen.data);
var line = _this.findLine(pen);
if (line) {
line.animateStart = 0;
line.animatePos = pen.animatePos;
}
}
else {
_this.pens.delete(pen.id);
}
return;
}
if (pen.animateStart > now) {
return;
}
if (pen.animateFn) {
if (typeof pen.animateFn === 'function') {
pen.animateFn();
}
else if (window && window[pen.animateFn]) {
window[pen.animateFn]();
}
else {
// pen.render();
}
}
else {
pen.animate(now);
}
if (pen.animateStart < 1) {
if (pen.type) {
_this.pens.delete(pen.data);
}
else {
_this.pens.delete(pen.id);
}
if (pen.type === PenType.Line) {
var line = _this.findLine(pen);
if (line) {
line.animateStart = 0;
line.animatePos = pen.animatePos;
}
}
if (pen.nextAnimate) {
_this.readyPlay(pen.nextAnimate, false);
}
}
animated = true;
});
if (animated) {
Store.set(_this.generateStoreKey('LT:render'), true);
_this.animate();
}
});
};
AnimateLayer.prototype.updateLines = function (lines) {
this.pens.forEach(function (line, key) {
if (!(line instanceof Line)) {
return;
}
for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
var item = lines_1[_i];
if (line.data === item.id) {
line.from = item.from;
line.to = item.to;
line.controlPoints = item.controlPoints;
line.length = line.getLen();
}
}
});
};
AnimateLayer.prototype.render = function (ctx) {
var _this = this;
this.pens.forEach(function (line, key) {
if (line.visible && line instanceof Line) {
if (!line.getTID()) {
line.setTID(_this.TID);
}
line.render(ctx);
}
});
};
AnimateLayer.prototype.stop = function () {
this.pens.clear();
if (this.timer) {
cancelAnimationFrame(this.timer);
this.timer = null;
} }
}; }
AnimateLayer.prototype.destroy = function () { })
this.stop(); readyPens.forEach(function (pen) {
this.subscribeUpdate.unsubscribe(); if (pen.type) {
this.subscribePlay.unsubscribe(); _this.pens.set(pen.data, pen)
}; } else {
return AnimateLayer; _this.pens.set(pen.id, pen)
}(Layer)); }
export { AnimateLayer }; })
//# sourceMappingURL=animateLayer.js.map }
AnimateLayer.prototype.animate = function () {
const _this = this
if (this.timer) {
cancelAnimationFrame(this.timer)
}
this.timer = requestAnimationFrame(function () {
const now = Date.now()
if (now - _this.lastNow < _this.options.refresh) {
_this.animate()
return
}
_this.lastNow = now
let animated = false
_this.pens.forEach(function (pen) {
if (!pen.animateStart || pen.animateStart < 1) {
if (pen.type) {
_this.pens.delete(pen.data)
var line = _this.findLine(pen)
if (line) {
line.animateStart = 0
line.animatePos = pen.animatePos
}
} else {
_this.pens.delete(pen.id)
}
return
}
if (pen.animateStart > now) {
return
}
if (pen.animateFn) {
if (typeof pen.animateFn === 'function') {
pen.animateFn()
} else if (window && window[pen.animateFn]) {
window[pen.animateFn]()
} else {
// pen.render();
}
} else {
pen.animate(now)
}
if (pen.animateStart < 1) {
if (pen.type) {
_this.pens.delete(pen.data)
} else {
_this.pens.delete(pen.id)
}
if (pen.type === PenType.Line) {
var line = _this.findLine(pen)
if (line) {
line.animateStart = 0
line.animatePos = pen.animatePos
}
}
if (pen.nextAnimate) {
_this.readyPlay(pen.nextAnimate, false)
}
}
animated = true
})
if (animated) {
Store.set(_this.generateStoreKey('LT:render'), true)
_this.animate()
}
})
}
AnimateLayer.prototype.updateLines = function (lines) {
this.pens.forEach(function (line, key) {
if (!(line instanceof Line)) {
return
}
for (let _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
const item = lines_1[_i]
if (line.data === item.id) {
line.from = item.from
line.to = item.to
line.controlPoints = item.controlPoints
line.length = line.getLen()
}
}
})
}
AnimateLayer.prototype.render = function (ctx) {
const _this = this
this.pens.forEach(function (line, key) {
if (line.visible && line instanceof Line) {
if (!line.getTID()) {
line.setTID(_this.TID)
}
line.render(ctx)
}
})
}
AnimateLayer.prototype.stop = function () {
this.pens.clear()
if (this.timer) {
cancelAnimationFrame(this.timer)
this.timer = null
}
}
AnimateLayer.prototype.destroy = function () {
this.stop()
this.subscribeUpdate.unsubscribe()
this.subscribePlay.unsubscribe()
this.subscribeUpdate = null
this.subscribePlay = null
this.pens = null
}
return AnimateLayer
}(Layer))
export { AnimateLayer }
// # sourceMappingURL=animateLayer.js.map

View File

@@ -1,89 +1,96 @@
var __extends = (this && this.__extends) || (function () { import { Store } from 'le5le-store'
var extendStatics = function (d, b) { import { Layer } from './layer'
extendStatics = Object.setPrototypeOf || const __extends = (this && this.__extends) || (function () {
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || var extendStatics = function (d, b) {
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; extendStatics = Object.setPrototypeOf ||
return extendStatics(d, b); ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b }) ||
}; function (d, b) { for (const p in b) if (b.hasOwnProperty(p)) d[p] = b[p] }
return function (d, b) { return extendStatics(d, b)
extendStatics(d, b); }
function __() { this.constructor = d; } return function (d, b) {
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); extendStatics(d, b)
}; function __ () { this.constructor = d }
})(); d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __())
import { Store } from 'le5le-store'; }
import { Layer } from './layer'; })()
var Canvas = /** @class */ (function (_super) { const Canvas = /** @class */ (function (_super) {
__extends(Canvas, _super); __extends(Canvas, _super)
function Canvas(parentElem, options, TID) { function Canvas (parentElem, options, TID) {
if (options === void 0) { options = {}; } if (options === void 0) { options = {} }
var _this = _super.call(this, TID) || this; const _this = _super.call(this, TID) || this
_this.parentElem = parentElem; _this.parentElem = parentElem
_this.options = options; _this.options = options
_this.canvas = document.createElement('canvas'); _this.canvas = document.createElement('canvas')
_this.width = 0; _this.width = 0
_this.height = 0; _this.height = 0
_this.subcribe = Store.subscribe(_this.generateStoreKey('topology-data'), function (val) { _this.subcribe = Store.subscribe(_this.generateStoreKey('topology-data'), function (val) {
_this.data = val; _this.data = val
}); })
_this.canvas.style.position = 'absolute'; _this.canvas.style.position = 'absolute'
_this.canvas.style.left = '0'; _this.canvas.style.left = '0'
_this.canvas.style.top = '0'; _this.canvas.style.top = '0'
_this.canvas.style.outline = 'none'; _this.canvas.style.outline = 'none'
if (!Canvas.dpiRatio) { if (!Canvas.dpiRatio) {
if (!options.extDpiRatio && options.extDpiRatio !== 0) { if (!options.extDpiRatio && options.extDpiRatio !== 0) {
if (window && window.devicePixelRatio > 1) { if (window && window.devicePixelRatio > 1) {
options.extDpiRatio = 0.25; options.extDpiRatio = 0.25
} } else {
else { options.extDpiRatio = 0
options.extDpiRatio = 0;
}
}
Canvas.dpiRatio = (window ? window.devicePixelRatio : 0) + options.extDpiRatio;
if (Canvas.dpiRatio < 1) {
Canvas.dpiRatio = 1;
}
} }
return _this; }
Canvas.dpiRatio = (window ? window.devicePixelRatio : 0) + options.extDpiRatio
if (Canvas.dpiRatio < 1) {
Canvas.dpiRatio = 1
}
} }
Canvas.prototype.resize = function (size) { return _this
if (size) { }
this.width = size.width | 0; Canvas.prototype.resize = function (size) {
this.height = size.height | 0; if (size) {
} this.width = size.width | 0
else { this.height = size.height | 0
if (this.options.width && this.options.width !== 'auto') { } else {
this.width = +this.options.width; if (this.options.width && this.options.width !== 'auto') {
} this.width = +this.options.width
else { } else {
this.width = this.parentElem.clientWidth; this.width = this.parentElem.clientWidth
} }
if (this.options.height && this.options.height !== 'auto') { if (this.options.height && this.options.height !== 'auto') {
this.height = +this.options.height; this.height = +this.options.height
} } else {
else { this.height = this.parentElem.clientHeight
this.height = this.parentElem.clientHeight; }
} }
} this.canvas.style.width = this.width + 'px'
this.canvas.style.width = this.width + 'px'; this.canvas.style.height = this.height + 'px'
this.canvas.style.height = this.height + 'px'; this.canvas.width = (this.width * Canvas.dpiRatio) | 0
this.canvas.width = (this.width * Canvas.dpiRatio) | 0; this.canvas.height = (this.height * Canvas.dpiRatio) | 0
this.canvas.height = (this.height * Canvas.dpiRatio) | 0; this.canvas.getContext('2d').scale(Canvas.dpiRatio, Canvas.dpiRatio)
this.canvas.getContext('2d').scale(Canvas.dpiRatio, Canvas.dpiRatio); Store.set(this.generateStoreKey('LT:size'), { width: this.canvas.width, height: this.canvas.height })
Store.set(this.generateStoreKey('LT:size'), { width: this.canvas.width, height: this.canvas.height }); }
}; Canvas.prototype.render = function () {
Canvas.prototype.render = function () { const ctx = this.canvas.getContext('2d')
var ctx = this.canvas.getContext('2d'); ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); }
}; Canvas.prototype.getDpiRatio = function () {
Canvas.prototype.getDpiRatio = function () { return Canvas.dpiRatio
return Canvas.dpiRatio; }
}; Canvas.prototype.destroy = function () {
Canvas.prototype.destroy = function () { this.subcribe.unsubscribe()
this.subcribe.unsubscribe(); this.activeLayer = null
}; this.hoverLayer = null
Canvas.dpiRatio = 0; this.animateLayer = null
return Canvas; this.subcribe = null
}(Layer)); this.options = null
export { Canvas }; this.parentElem = null
//# sourceMappingURL=canvas.js.map this.data = null
this.offscreen = null
this.canvas = null
this.bkImg = null
this.render = null
}
Canvas.dpiRatio = 0
return Canvas
}(Layer))
export { Canvas }
// # sourceMappingURL=canvas.js.map

View File

@@ -86,6 +86,7 @@ const Topology = /** @class */ (function () {
} }
timer = setTimeout(function () { timer = setTimeout(function () {
_this.resize() _this.resize()
timer = null
}, 100) }, 100)
} }
this.calibrateMouse = function (pt) { this.calibrateMouse = function (pt) {
@@ -819,17 +820,17 @@ const Topology = /** @class */ (function () {
Store.set(this.generateStoreKey('LT:fontColor'), this.options.fontColor || '#222222') Store.set(this.generateStoreKey('LT:fontColor'), this.options.fontColor || '#222222')
this.setupDom(parent) this.setupDom(parent)
this.setupSubscribe() this.setupSubscribe()
this.setupMouseEvent() // this.setupMouseEvent()
// Wait for parent dom load // Wait for parent dom load
setTimeout(function () { // setTimeout(function () {
_this.canvasPos = _this.divLayer.canvas.getBoundingClientRect() // _this.canvasPos = _this.divLayer.canvas.getBoundingClientRect()
}, 500) // }, 500)
setTimeout(function () { // setTimeout(function () {
_this.canvasPos = _this.divLayer.canvas.getBoundingClientRect() // _this.canvasPos = _this.divLayer.canvas.getBoundingClientRect()
}, 1000) // }, 1000)
this.cache() // this.cache()
window.topology = this window.topology = this
this.dispatch('loaded') // this.dispatch('loaded')
} }
Object.defineProperty(Topology.prototype, 'ramCaches', { Object.defineProperty(Topology.prototype, 'ramCaches', {
// 内存中的 caches 数量 // 内存中的 caches 数量
@@ -1917,7 +1918,7 @@ const Topology = /** @class */ (function () {
return offset return offset
} }
Topology.prototype.cache = function () { Topology.prototype.cache = function () {
if (this.options.cacheLen == 0 || this.data.locked) { return } if (this.options.cacheLen == 0 || this.data && this.data.locked) { return }
if (this.caches.index < this.caches.list.length - 1) { if (this.caches.index < this.caches.list.length - 1) {
this.caches.list.splice(this.caches.index + 1, this.caches.list.length - this.caches.index - 1) this.caches.list.splice(this.caches.index + 1, this.caches.list.length - this.caches.index - 1)
// 删除 indexDB 的值 // 删除 indexDB 的值
@@ -2964,7 +2965,7 @@ const Topology = /** @class */ (function () {
this.activeLayer.destroy() this.activeLayer.destroy()
this.hoverLayer.destroy() this.hoverLayer.destroy()
this.offscreen.destroy() this.offscreen.destroy()
document.body.removeChild(this.tipMarkdown) // document.body.removeChild(this.tipMarkdown)
window.removeEventListener('resize', this.winResize) window.removeEventListener('resize', this.winResize)
this.parentElem.removeEventListener('scroll', this.onScroll) this.parentElem.removeEventListener('scroll', this.onScroll)
window.removeEventListener('scroll', this.onScroll) window.removeEventListener('scroll', this.onScroll)
@@ -2987,9 +2988,6 @@ const Topology = /** @class */ (function () {
this.data = null this.data = null
console.log(this.options) console.log(this.options)
window.topology = null window.topology = null
createCacheTable()
this.divLayer.clear()
this.activeLayer = null
this.activeLayer = null this.activeLayer = null
this.hoverLayer = null this.hoverLayer = null
this.animateLayer = null this.animateLayer = null
@@ -3001,11 +2999,18 @@ const Topology = /** @class */ (function () {
this.subcribeAnimateMoved = null this.subcribeAnimateMoved = null
this.subcribeEmit = null this.subcribeEmit = null
this.offscreen = null this.offscreen = null
this.parentElem.onresize = null
this.parentElem = null this.parentElem = null
this.input = null
this.data = null this.data = null
this.caches = null this.caches = null
this.clipboard = null this.clipboard = null
this.gifs = {} this.gifs = null
this.tipMarkdown = null
this.tipMarkdownContent = null
this.tipMarkdownArrowUp = null
this.tipMarkdownArrowDown = null
delete this
} }
return Topology return Topology
}()) }())

View File

@@ -1,211 +1,211 @@
var __extends = (this && this.__extends) || (function () { import { PenType } from './models/pen'
var extendStatics = function (d, b) { import { Store } from 'le5le-store'
extendStatics = Object.setPrototypeOf || import { Lock } from './models/status'
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || import { Layer } from './layer'
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; import { rgba } from './utils/math'
return extendStatics(d, b); const __extends = (this && this.__extends) || (function () {
}; var extendStatics = function (d, b) {
return function (d, b) { extendStatics = Object.setPrototypeOf ||
extendStatics(d, b); ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b }) ||
function __() { this.constructor = d; } function (d, b) { for (const p in b) if (b.hasOwnProperty(p)) d[p] = b[p] }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); return extendStatics(d, b)
}; }
})(); return function (d, b) {
import { PenType } from './models/pen'; extendStatics(d, b)
import { Store } from 'le5le-store'; function __ () { this.constructor = d }
import { Lock } from './models/status'; d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __())
import { Layer } from './layer'; }
import { rgba } from './utils/math'; })()
var HoverLayer = /** @class */ (function (_super) { const HoverLayer = /** @class */ (function (_super) {
__extends(HoverLayer, _super); __extends(HoverLayer, _super)
function HoverLayer(options, TID) { function HoverLayer (options, TID) {
if (options === void 0) { options = {}; } if (options === void 0) { options = {} }
var _this = _super.call(this, TID) || this; const _this = _super.call(this, TID) || this
_this.options = options; _this.options = options
_this.hoverAnchorIndex = -1; _this.hoverAnchorIndex = -1
_this.dockLineX = 0; _this.dockLineX = 0
_this.dockLineY = 0; _this.dockLineY = 0
Store.set(_this.generateStoreKey('LT:HoverLayer'), _this); Store.set(_this.generateStoreKey('LT:HoverLayer'), _this)
return _this; return _this
}
HoverLayer.prototype.lineTo = function (to, toArrow) {
if (toArrow === void 0) { toArrow = 'triangleSolid' }
if (!this.line || this.line.locked) {
return
} }
HoverLayer.prototype.lineTo = function (to, toArrow) { this.line.setTo(to, toArrow)
if (toArrow === void 0) { toArrow = 'triangleSolid'; } if (this.line.from.id || this.line.to.id) {
if (!this.line || this.line.locked) { this.line.calcControlPoints()
return; }
Store.set(this.generateStoreKey('pts-') + this.line.id, undefined)
Store.set(this.generateStoreKey('LT:updateLines'), [this.line])
}
HoverLayer.prototype.lineFrom = function (from) {
if (this.line.locked) {
return
}
this.line.setFrom(from, this.line.fromArrow)
if (this.line.from.id || this.line.to.id) {
this.line.calcControlPoints()
}
Store.set(this.generateStoreKey('pts-') + this.line.id, undefined)
Store.set(this.generateStoreKey('LT:updateLines'), [this.line])
}
HoverLayer.prototype.render = function (ctx) {
const _this = this
if (this.data.locked === Lock.NoEvent || this.options.hoverColor === 'transparent') {
return
}
ctx.fillStyle = this.options.hoverColor
ctx.save()
// anchors
if (this.options.alwaysAnchor) {
this.data.pens.forEach(function (pen) {
if (pen.type === PenType.Line) {
return
} }
this.line.setTo(to, toArrow); if (pen.hideAnchor) {
if (this.line.from.id || this.line.to.id) { return
this.line.calcControlPoints();
} }
Store.set(this.generateStoreKey('pts-') + this.line.id, undefined); for (let _i = 0, _a = pen.rotatedAnchors; _i < _a.length; _i++) {
Store.set(this.generateStoreKey('LT:updateLines'), [this.line]); const anchor = _a[_i]
}; if (anchor.hidden) {
HoverLayer.prototype.lineFrom = function (from) { continue
if (this.line.locked) { }
return; ctx.beginPath()
ctx.arc(anchor.x, anchor.y, anchor.radius || _this.options.anchorRadius, 0, Math.PI * 2)
ctx.strokeStyle = anchor.strokeStyle || _this.options.hoverColor
ctx.fillStyle = anchor.fillStyle || _this.options.anchorFillStyle
ctx.fill()
ctx.stroke()
} }
this.line.setFrom(from, this.line.fromArrow); if (_this.options.autoAnchor) {
if (this.line.from.id || this.line.to.id) { ctx.beginPath()
this.line.calcControlPoints(); ctx.arc(pen.rect.center.x, pen.rect.center.y, pen.rect.center.radius || _this.options.anchorRadius, 0, Math.PI * 2)
ctx.strokeStyle = _this.options.hoverColor
ctx.fillStyle = _this.options.anchorFillStyle
ctx.fill()
ctx.stroke()
} }
Store.set(this.generateStoreKey('pts-') + this.line.id, undefined); })
Store.set(this.generateStoreKey('LT:updateLines'), [this.line]); }
}; ctx.restore()
HoverLayer.prototype.render = function (ctx) { if (this.node && !this.data.locked) {
var _this = this; if (!this.node.getTID()) {
if (this.data.locked === Lock.NoEvent || this.options.hoverColor === 'transparent') { this.node.setTID(this.TID)
return; }
this.root = this.getRoot(this.node) || this.node
if (this.root) {
ctx.save()
ctx.strokeStyle = this.options.dragColor
ctx.globalAlpha = 0.2
if (this.root.rotate) {
ctx.translate(this.root.rect.center.x, this.root.rect.center.y)
ctx.rotate(((this.root.rotate + this.root.offsetRotate) * Math.PI) / 180)
ctx.translate(-this.root.rect.center.x, -this.root.rect.center.y)
} }
ctx.fillStyle = this.options.hoverColor; ctx.beginPath()
ctx.save(); ctx.strokeRect(this.root.rect.x, this.root.rect.y, this.root.rect.width, this.root.rect.height)
// anchors ctx.restore()
if (this.options.alwaysAnchor) { }
this.data.pens.forEach(function (pen) { if (!this.options.hideAnchor) {
if (pen.type === PenType.Line) { for (let i = 0; i < this.node.rotatedAnchors.length; ++i) {
return; if (this.node.locked ||
}
if (pen.hideAnchor) {
return;
}
for (var _i = 0, _a = pen.rotatedAnchors; _i < _a.length; _i++) {
var anchor = _a[_i];
if (anchor.hidden) {
continue;
}
ctx.beginPath();
ctx.arc(anchor.x, anchor.y, anchor.radius || _this.options.anchorRadius, 0, Math.PI * 2);
ctx.strokeStyle = anchor.strokeStyle || _this.options.hoverColor;
ctx.fillStyle = anchor.fillStyle || _this.options.anchorFillStyle;
ctx.fill();
ctx.stroke();
}
if (_this.options.autoAnchor) {
ctx.beginPath();
ctx.arc(pen.rect.center.x, pen.rect.center.y, pen.rect.center.radius || _this.options.anchorRadius, 0, Math.PI * 2);
ctx.strokeStyle = _this.options.hoverColor;
ctx.fillStyle = _this.options.anchorFillStyle;
ctx.fill();
ctx.stroke();
}
});
}
ctx.restore();
if (this.node && !this.data.locked) {
if (!this.node.getTID()) {
this.node.setTID(this.TID);
}
this.root = this.getRoot(this.node) || this.node;
if (this.root) {
ctx.save();
ctx.strokeStyle = this.options.dragColor;
ctx.globalAlpha = 0.2;
if (this.root.rotate) {
ctx.translate(this.root.rect.center.x, this.root.rect.center.y);
ctx.rotate(((this.root.rotate + this.root.offsetRotate) * Math.PI) / 180);
ctx.translate(-this.root.rect.center.x, -this.root.rect.center.y);
}
ctx.beginPath();
ctx.strokeRect(this.root.rect.x, this.root.rect.y, this.root.rect.width, this.root.rect.height);
ctx.restore();
}
if (!this.options.hideAnchor) {
for (var i = 0; i < this.node.rotatedAnchors.length; ++i) {
if (this.node.locked ||
this.node.hideAnchor || this.node.hideAnchor ||
(this.node.rotatedAnchors[i].hidden && this.hoverAnchorIndex !== i)) { (this.node.rotatedAnchors[i].hidden && this.hoverAnchorIndex !== i)) {
continue; continue
} }
ctx.beginPath(); ctx.beginPath()
ctx.arc(this.node.rotatedAnchors[i].x, this.node.rotatedAnchors[i].y, this.node.rotatedAnchors[i].radius || this.options.anchorRadius, 0, Math.PI * 2); ctx.arc(this.node.rotatedAnchors[i].x, this.node.rotatedAnchors[i].y, this.node.rotatedAnchors[i].radius || this.options.anchorRadius, 0, Math.PI * 2)
ctx.strokeStyle = this.node.rotatedAnchors[i].strokeStyle || this.options.hoverColor; ctx.strokeStyle = this.node.rotatedAnchors[i].strokeStyle || this.options.hoverColor
ctx.fillStyle = this.node.rotatedAnchors[i].fillStyle || this.options.anchorFillStyle; ctx.fillStyle = this.node.rotatedAnchors[i].fillStyle || this.options.anchorFillStyle
ctx.fill(); ctx.fill()
ctx.stroke(); ctx.stroke()
}
}
if (this.options.autoAnchor) {
ctx.beginPath();
ctx.arc(this.node.rect.center.x, this.node.rect.center.y, this.node.rect.center.radius || this.options.anchorRadius, 0, Math.PI * 2);
ctx.strokeStyle = this.options.hoverColor;
ctx.fillStyle = this.options.anchorFillStyle;
ctx.fill();
ctx.stroke();
}
} }
if (this.line && !this.data.locked) { }
this.root = this.getRoot(this.line); if (this.options.autoAnchor) {
if (this.root) { ctx.beginPath()
ctx.save(); ctx.arc(this.node.rect.center.x, this.node.rect.center.y, this.node.rect.center.radius || this.options.anchorRadius, 0, Math.PI * 2)
ctx.strokeStyle = this.options.dragColor; ctx.strokeStyle = this.options.hoverColor
ctx.globalAlpha = 0.2; ctx.fillStyle = this.options.anchorFillStyle
if (this.root.rotate) { ctx.fill()
ctx.translate(this.root.rect.center.x, this.root.rect.center.y); ctx.stroke()
ctx.rotate(((this.root.rotate + this.root.offsetRotate) * Math.PI) / 180); }
ctx.translate(-this.root.rect.center.x, -this.root.rect.center.y); }
} if (this.line && !this.data.locked) {
ctx.beginPath(); this.root = this.getRoot(this.line)
ctx.strokeRect(this.root.rect.x, this.root.rect.y, this.root.rect.width, this.root.rect.height); if (this.root) {
ctx.restore(); ctx.save()
} ctx.strokeStyle = this.options.dragColor
ctx.globalAlpha = 0.2
if (this.root.rotate) {
ctx.translate(this.root.rect.center.x, this.root.rect.center.y)
ctx.rotate(((this.root.rotate + this.root.offsetRotate) * Math.PI) / 180)
ctx.translate(-this.root.rect.center.x, -this.root.rect.center.y)
} }
if (this.dockAnchor) { ctx.beginPath()
ctx.save(); ctx.strokeRect(this.root.rect.x, this.root.rect.y, this.root.rect.width, this.root.rect.height)
ctx.beginPath(); ctx.restore()
ctx.arc(this.dockAnchor.x, this.dockAnchor.y, this.dockAnchor.radius || this.options.anchorRadius, 0, Math.PI * 2); }
ctx.strokeStyle = this.options.dockStrokeStyle; }
ctx.fillStyle = this.options.dockFillStyle; if (this.dockAnchor) {
ctx.fill(); ctx.save()
ctx.stroke(); ctx.beginPath()
ctx.restore(); ctx.arc(this.dockAnchor.x, this.dockAnchor.y, this.dockAnchor.radius || this.options.anchorRadius, 0, Math.PI * 2)
} ctx.strokeStyle = this.options.dockStrokeStyle
if (this.hoverLineCP) { ctx.fillStyle = this.options.dockFillStyle
ctx.beginPath(); ctx.fill()
ctx.arc(this.hoverLineCP.x, this.hoverLineCP.y, 5, 0, Math.PI * 2); ctx.stroke()
ctx.fill(); ctx.restore()
} }
ctx.strokeStyle = rgba(0.5, this.options.hoverColor); if (this.hoverLineCP) {
ctx.lineWidth = 1; ctx.beginPath()
if (this.dockLineX > 0) { ctx.arc(this.hoverLineCP.x, this.hoverLineCP.y, 5, 0, Math.PI * 2)
var size = Store.get(this.generateStoreKey('LT:size')); ctx.fill()
ctx.beginPath(); }
ctx.moveTo(this.dockLineX, -this.data.y); ctx.strokeStyle = rgba(0.5, this.options.hoverColor)
ctx.lineTo(this.dockLineX, size.height); ctx.lineWidth = 1
ctx.stroke(); if (this.dockLineX > 0) {
} var size = Store.get(this.generateStoreKey('LT:size'))
if (this.dockLineY > 0) { ctx.beginPath()
var size = Store.get(this.generateStoreKey('LT:size')); ctx.moveTo(this.dockLineX, -this.data.y)
ctx.beginPath(); ctx.lineTo(this.dockLineX, size.height)
ctx.moveTo(-this.data.x, this.dockLineY); ctx.stroke()
ctx.lineTo(size.width, this.dockLineY); }
ctx.stroke(); if (this.dockLineY > 0) {
} var size = Store.get(this.generateStoreKey('LT:size'))
// Select nodes by drag. ctx.beginPath()
if (this.dragRect) { ctx.moveTo(-this.data.x, this.dockLineY)
ctx.fillStyle = rgba(0.2, this.options.dragColor); ctx.lineTo(size.width, this.dockLineY)
ctx.strokeStyle = this.options.dragColor; ctx.stroke()
ctx.beginPath(); }
ctx.strokeRect(this.dragRect.x, this.dragRect.y, this.dragRect.width, this.dragRect.height); // Select nodes by drag.
ctx.fillRect(this.dragRect.x, this.dragRect.y, this.dragRect.width, this.dragRect.height); if (this.dragRect) {
} ctx.fillStyle = rgba(0.2, this.options.dragColor)
}; ctx.strokeStyle = this.options.dragColor
HoverLayer.prototype.getRoot = function (pen) { ctx.beginPath()
if (!pen.parentId) { ctx.strokeRect(this.dragRect.x, this.dragRect.y, this.dragRect.width, this.dragRect.height)
return null; ctx.fillRect(this.dragRect.x, this.dragRect.y, this.dragRect.width, this.dragRect.height)
} }
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) { }
var item = _a[_i]; HoverLayer.prototype.getRoot = function (pen) {
if (item.id === pen.parentId) { if (!pen.parentId) {
var n = this.getRoot(item); return null
return n ? n : item; }
} for (let _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
} const item = _a[_i]
return null; if (item.id === pen.parentId) {
}; const n = this.getRoot(item)
HoverLayer.prototype.clear = function () { return n || item
this.node = undefined; }
this.line = undefined; }
}; return null
return HoverLayer; }
}(Layer)); HoverLayer.prototype.clear = function () {
export { HoverLayer }; this.node = undefined
//# sourceMappingURL=hoverLayer.js.map this.line = undefined
}
return HoverLayer
}(Layer))
export { HoverLayer }
// # sourceMappingURL=hoverLayer.js.map

View File

@@ -1,19 +1,20 @@
import { Store } from 'le5le-store'; import { Store } from 'le5le-store'
var Layer = /** @class */ (function () { const Layer = /** @class */ (function () {
function Layer(TID) { function Layer (TID) {
var _this = this; const _this = this
this.TID = TID; this.TID = TID
this.subcribe = Store.subscribe(this.generateStoreKey('topology-data'), function (val) { this.subcribe = Store.subscribe(this.generateStoreKey('topology-data'), function (val) {
_this.data = val; _this.data = val
}); })
} }
Layer.prototype.generateStoreKey = function (key) { Layer.prototype.generateStoreKey = function (key) {
return this.TID + "-" + key; return this.TID + '-' + key
}; }
Layer.prototype.destroy = function () { Layer.prototype.destroy = function () {
this.subcribe.unsubscribe(); this.subcribe.unsubscribe()
}; this.subcribe = null
return Layer; }
}()); return Layer
export { Layer }; }())
//# sourceMappingURL=layer.js.map export { Layer }
// # sourceMappingURL=layer.js.map

View File

@@ -1,24 +1,23 @@
import { Store } from 'le5le-store'; import { Store } from 'le5le-store'
export function circleSolid(ctx, from, to, size, fillStyle) { export function circleSolid (ctx, from, to, size, fillStyle) {
size += ctx.lineWidth * 3; size += ctx.lineWidth * 3
var r = size / 2; const r = size / 2
if (ctx.lineWidth < 2) { if (ctx.lineWidth < 2) {
ctx.lineWidth = 2; ctx.lineWidth = 2
} }
ctx.translate(to.x, to.y); ctx.translate(to.x, to.y)
ctx.rotate(Math.atan2(to.y - from.y, to.x - from.x)); ctx.rotate(Math.atan2(to.y - from.y, to.x - from.x))
ctx.translate(-to.x, -to.y - ctx.lineWidth / 10); ctx.translate(-to.x, -to.y - ctx.lineWidth / 10)
ctx.arc(to.x - r - ctx.lineWidth / 2, to.y, r, 0, 2 * Math.PI); ctx.arc(to.x - r - ctx.lineWidth / 2, to.y, r, 0, 2 * Math.PI)
ctx.stroke(); ctx.stroke()
if (fillStyle) { if (fillStyle) {
ctx.fillStyle = fillStyle; ctx.fillStyle = fillStyle
} } else {
else { ctx.fillStyle = ctx.strokeStyle
ctx.fillStyle = ctx.strokeStyle; }
} ctx.fill()
ctx.fill();
} }
export function circle(ctx, from, to, size) { export function circle (ctx, from, to, size) {
circleSolid(ctx, from, to, size, Store.get('LT:bkColor') || '#fff'); circleSolid(ctx, from, to, size, Store.get('LT:bkColor') || '#fff')
} }
//# sourceMappingURL=circle.js.map // # sourceMappingURL=circle.js.map

View File

@@ -1,32 +1,31 @@
import { Store } from 'le5le-store'; import { Store } from 'le5le-store'
export function diamondSolid(ctx, from, to, size, fillStyle) { export function diamondSolid (ctx, from, to, size, fillStyle) {
size += ctx.lineWidth * 3; size += ctx.lineWidth * 3
var r = size / 2; const r = size / 2
var arrowWidth = ctx.lineWidth / 10; let arrowWidth = ctx.lineWidth / 10
if (ctx.lineWidth < 2) { if (ctx.lineWidth < 2) {
ctx.lineWidth = 2; ctx.lineWidth = 2
arrowWidth = 0; arrowWidth = 0
} }
ctx.translate(to.x, to.y); ctx.translate(to.x, to.y)
ctx.rotate(Math.atan2(to.y - from.y, to.x - from.x)); ctx.rotate(Math.atan2(to.y - from.y, to.x - from.x))
ctx.translate(-to.x - ctx.lineWidth + arrowWidth * 5, -to.y); ctx.translate(-to.x - ctx.lineWidth + arrowWidth * 5, -to.y)
ctx.moveTo(to.x, to.y + arrowWidth); ctx.moveTo(to.x, to.y + arrowWidth)
ctx.lineTo(to.x, to.y - arrowWidth); ctx.lineTo(to.x, to.y - arrowWidth)
ctx.lineTo(to.x - r, to.y - r / 2); ctx.lineTo(to.x - r, to.y - r / 2)
ctx.lineTo(to.x - size, to.y - arrowWidth); ctx.lineTo(to.x - size, to.y - arrowWidth)
ctx.lineTo(to.x - size, to.y + arrowWidth); ctx.lineTo(to.x - size, to.y + arrowWidth)
ctx.lineTo(to.x - r, to.y + r / 2); ctx.lineTo(to.x - r, to.y + r / 2)
ctx.closePath(); ctx.closePath()
ctx.stroke(); ctx.stroke()
if (fillStyle) { if (fillStyle) {
ctx.fillStyle = fillStyle; ctx.fillStyle = fillStyle
} } else {
else { ctx.fillStyle = ctx.strokeStyle
ctx.fillStyle = ctx.strokeStyle; }
} ctx.fill()
ctx.fill();
} }
export function diamond(ctx, from, to, size) { export function diamond (ctx, from, to, size) {
diamondSolid(ctx, from, to, size, Store.get('LT:bkColor') || '#fff'); diamondSolid(ctx, from, to, size, Store.get('LT:bkColor') || '#fff')
} }
//# sourceMappingURL=diamond.js.map // # sourceMappingURL=diamond.js.map

View File

@@ -1,42 +1,40 @@
export function line(ctx, from, to, size) { export function line (ctx, from, to, size) {
size += ctx.lineWidth * 3; size += ctx.lineWidth * 3
ctx.translate(to.x, to.y); ctx.translate(to.x, to.y)
ctx.rotate(Math.atan2(to.y - from.y, to.x - from.x)); ctx.rotate(Math.atan2(to.y - from.y, to.x - from.x))
ctx.translate(-to.x - ctx.lineWidth / 5, -to.y - ctx.lineWidth / 5); ctx.translate(-to.x - ctx.lineWidth / 5, -to.y - ctx.lineWidth / 5)
ctx.moveTo(to.x, to.y); ctx.moveTo(to.x, to.y)
ctx.lineTo(to.x - size, to.y - size / 3); ctx.lineTo(to.x - size, to.y - size / 3)
ctx.moveTo(to.x, to.y); ctx.moveTo(to.x, to.y)
ctx.lineTo(to.x - size, to.y + size / 3); ctx.lineTo(to.x - size, to.y + size / 3)
ctx.stroke(); ctx.stroke()
} }
export function lineUp(ctx, from, to, size) { export function lineUp (ctx, from, to, size) {
size += ctx.lineWidth * 3; size += ctx.lineWidth * 3
ctx.translate(to.x, to.y); ctx.translate(to.x, to.y)
ctx.rotate(Math.atan2(to.y - from.y, to.x - from.x)); ctx.rotate(Math.atan2(to.y - from.y, to.x - from.x))
ctx.translate(-to.x - ctx.lineWidth / 5, -to.y - ctx.lineWidth / 5); ctx.translate(-to.x - ctx.lineWidth / 5, -to.y - ctx.lineWidth / 5)
if (to.x > from.x) { if (to.x > from.x) {
ctx.moveTo(to.x, to.y); ctx.moveTo(to.x, to.y)
ctx.lineTo(to.x - size, to.y - size / 3); ctx.lineTo(to.x - size, to.y - size / 3)
} } else {
else { ctx.moveTo(to.x, to.y)
ctx.moveTo(to.x, to.y); ctx.lineTo(to.x - size, to.y + size / 3)
ctx.lineTo(to.x - size, to.y + size / 3); }
} ctx.stroke()
ctx.stroke();
} }
export function lineDown(ctx, from, to, size) { export function lineDown (ctx, from, to, size) {
size += ctx.lineWidth * 3; size += ctx.lineWidth * 3
ctx.translate(to.x, to.y); ctx.translate(to.x, to.y)
ctx.rotate(Math.atan2(to.y - from.y, to.x - from.x)); ctx.rotate(Math.atan2(to.y - from.y, to.x - from.x))
ctx.translate(-to.x - ctx.lineWidth / 5, -to.y - ctx.lineWidth / 5); ctx.translate(-to.x - ctx.lineWidth / 5, -to.y - ctx.lineWidth / 5)
if (to.x < from.x) { if (to.x < from.x) {
ctx.moveTo(to.x, to.y); ctx.moveTo(to.x, to.y)
ctx.lineTo(to.x - size, to.y - size / 3); ctx.lineTo(to.x - size, to.y - size / 3)
} } else {
else { ctx.moveTo(to.x, to.y)
ctx.moveTo(to.x, to.y); ctx.lineTo(to.x - size, to.y + size / 3)
ctx.lineTo(to.x - size, to.y + size / 3); }
} ctx.stroke()
ctx.stroke();
} }
//# sourceMappingURL=line.js.map // # sourceMappingURL=line.js.map

View File

@@ -1,29 +1,28 @@
import { Store } from 'le5le-store'; import { Store } from 'le5le-store'
export function triangleSolid(ctx, from, to, size, fillStyle) { export function triangleSolid (ctx, from, to, size, fillStyle) {
size += ctx.lineWidth * 3; size += ctx.lineWidth * 3
var arrowWidth = ctx.lineWidth / 10; let arrowWidth = ctx.lineWidth / 10
if (ctx.lineWidth < 2) { if (ctx.lineWidth < 2) {
ctx.lineWidth = 2; ctx.lineWidth = 2
arrowWidth = 0; arrowWidth = 0
} }
ctx.translate(to.x, to.y); ctx.translate(to.x, to.y)
ctx.rotate(Math.atan2(to.y - from.y, to.x - from.x)); ctx.rotate(Math.atan2(to.y - from.y, to.x - from.x))
ctx.translate(-to.x - ctx.lineWidth + arrowWidth * 5, -to.y); ctx.translate(-to.x - ctx.lineWidth + arrowWidth * 5, -to.y)
ctx.moveTo(to.x, to.y + arrowWidth); ctx.moveTo(to.x, to.y + arrowWidth)
ctx.lineTo(to.x, to.y - arrowWidth); ctx.lineTo(to.x, to.y - arrowWidth)
ctx.lineTo(to.x - size, to.y - size / 3); ctx.lineTo(to.x - size, to.y - size / 3)
ctx.lineTo(to.x - size, to.y + size / 3); ctx.lineTo(to.x - size, to.y + size / 3)
ctx.closePath(); ctx.closePath()
ctx.stroke(); ctx.stroke()
if (fillStyle) { if (fillStyle) {
ctx.fillStyle = fillStyle; ctx.fillStyle = fillStyle
} } else {
else { ctx.fillStyle = ctx.strokeStyle
ctx.fillStyle = ctx.strokeStyle; }
} ctx.fill()
ctx.fill();
} }
export function triangle(ctx, from, to, size) { export function triangle (ctx, from, to, size) {
triangleSolid(ctx, from, to, size, Store.get('LT:bkColor') || '#fff'); triangleSolid(ctx, from, to, size, Store.get('LT:bkColor') || '#fff')
} }
//# sourceMappingURL=triangle.js.map // # sourceMappingURL=triangle.js.map

View File

@@ -1,9 +1,9 @@
import { Point } from '../models/point'; import { Point } from '../models/point'
import { Direction } from '../models/direction'; import { Direction } from '../models/direction'
export function defaultAnchors(node) { export function defaultAnchors (node) {
node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left)); node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left))
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up))
node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2, Direction.Right)); node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2, Direction.Right))
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height, Direction.Bottom)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height, Direction.Bottom))
} }
//# sourceMappingURL=default.anchor.js.map // # sourceMappingURL=default.anchor.js.map

View File

@@ -1,213 +1,213 @@
import { rectangle } from './nodes/rectangle'; import { rectangle } from './nodes/rectangle'
import { circle } from './nodes/circle'; import { circle } from './nodes/circle'
import { triangle } from './nodes/triangle'; import { triangle } from './nodes/triangle'
import { diamond } from './nodes/diamond'; import { diamond } from './nodes/diamond'
import { leftArrow, rightArrow, twowayArrow } from './nodes/arrow'; import { leftArrow, rightArrow, twowayArrow } from './nodes/arrow'
import { text } from './nodes/text'; import { text } from './nodes/text'
import { line as nodeLine } from './nodes/line'; import { line as nodeLine } from './nodes/line'
import { triangleAnchors } from './nodes/triangle.anchor'; import { triangleAnchors } from './nodes/triangle.anchor'
import { arrowAnchors } from './nodes/arrow.anchor'; import { arrowAnchors } from './nodes/arrow.anchor'
import { lineAnchors } from './nodes/line.anchor'; import { lineAnchors } from './nodes/line.anchor'
import { circleIconRect, circleTextRect } from './nodes/circle.rect'; import { circleIconRect, circleTextRect } from './nodes/circle.rect'
import { triangleIconRect, triangleTextRect } from './nodes/triangle.rect'; import { triangleIconRect, triangleTextRect } from './nodes/triangle.rect'
import { diamondIconRect, diamondTextRect } from './nodes/diamond.rect'; import { diamondIconRect, diamondTextRect } from './nodes/diamond.rect'
import { twowayArrowIconRect, twowayArrowTextRect, leftArrowIconRect, leftArrowTextRect, rightArrowIconRect, rightArrowTextRect, } from './nodes/arrow.rect'; import { twowayArrowIconRect, twowayArrowTextRect, leftArrowIconRect, leftArrowTextRect, rightArrowIconRect, rightArrowTextRect } from './nodes/arrow.rect'
import { lineIconRect, lineTextRect } from './nodes/line.rect'; import { lineIconRect, lineTextRect } from './nodes/line.rect'
import { line, lineControlPoints, calcLineControlPoints } from './lines/line'; import { line, lineControlPoints, calcLineControlPoints } from './lines/line'
import { polyline, polylineControlPoints, pointInPolyline, calcPolylineControlPoints, dockPolylineControlPoint, } from './lines/polyline'; import { polyline, polylineControlPoints, pointInPolyline, calcPolylineControlPoints, dockPolylineControlPoint } from './lines/polyline'
import { curve, curveControlPoints, pointInCurve, calcCurveControlPoints, } from './lines/curve'; import { curve, curveControlPoints, pointInCurve, calcCurveControlPoints } from './lines/curve'
import { calcMindControlPoints, } from './lines/mind'; import { calcMindControlPoints } from './lines/mind'
import { triangleSolid, triangle as arrowTriangle } from './arrows/triangle'; import { triangleSolid, triangle as arrowTriangle } from './arrows/triangle'
import { diamondSolid, diamond as arrowDiamond } from './arrows/diamond'; import { diamondSolid, diamond as arrowDiamond } from './arrows/diamond'
import { circleSolid, circle as arrowCircle } from './arrows/circle'; import { circleSolid, circle as arrowCircle } from './arrows/circle'
import { circleAnchors } from './nodes/circle.anchor'; import { circleAnchors } from './nodes/circle.anchor'
import { lineUp, lineDown, line as arrowLine } from './arrows/line'; import { lineUp, lineDown, line as arrowLine } from './arrows/line'
import { pentagon } from './nodes/pentagon'; import { pentagon } from './nodes/pentagon'
import { pentagonIconRect, pentagonTextRect } from './nodes/pentagon.rect'; import { pentagonIconRect, pentagonTextRect } from './nodes/pentagon.rect'
import { pentagonAnchors } from './nodes/pentagon.anchor'; import { pentagonAnchors } from './nodes/pentagon.anchor'
import { hexagon } from './nodes/hexagon'; import { hexagon } from './nodes/hexagon'
import { hexagonAnchors } from './nodes/hexagon.anchor'; import { hexagonAnchors } from './nodes/hexagon.anchor'
import { hexagonIconRect, hexagonTextRect } from './nodes/hexagon.rect'; import { hexagonIconRect, hexagonTextRect } from './nodes/hexagon.rect'
import { pentagram } from './nodes/pentagram'; import { pentagram } from './nodes/pentagram'
import { pentagramAnchors } from './nodes/pentagram.anchor'; import { pentagramAnchors } from './nodes/pentagram.anchor'
import { pentagramIconRect, pentagramTextRect } from './nodes/pentagram.rect'; import { pentagramIconRect, pentagramTextRect } from './nodes/pentagram.rect'
import { cloud } from './nodes/cloud'; import { cloud } from './nodes/cloud'
import { cloudAnchors } from './nodes/cloud.anchor'; import { cloudAnchors } from './nodes/cloud.anchor'
import { cloudIconRect, cloudTextRect } from './nodes/cloud.rect'; import { cloudIconRect, cloudTextRect } from './nodes/cloud.rect'
import { message } from './nodes/message'; import { message } from './nodes/message'
import { messageIconRect, messageTextRect } from './nodes/message.rect'; import { messageIconRect, messageTextRect } from './nodes/message.rect'
import { messageAnchors } from './nodes/message.anchor'; import { messageAnchors } from './nodes/message.anchor'
import { file } from './nodes/file'; import { file } from './nodes/file'
import { imageIconRect, imageTextRect } from './nodes/image.rect'; import { imageIconRect, imageTextRect } from './nodes/image.rect'
import { imageAnchors } from './nodes/image.anchor'; import { imageAnchors } from './nodes/image.anchor'
import { cube } from './nodes/cube'; import { cube } from './nodes/cube'
import { cubeAnchors } from './nodes/cube.anchor'; import { cubeAnchors } from './nodes/cube.anchor'
import { cubeIconRect, cubeTextRect } from './nodes/cube.rect'; import { cubeIconRect, cubeTextRect } from './nodes/cube.rect'
import { people } from './nodes/people'; import { people } from './nodes/people'
import { peopleIconRect, peopleTextRect } from './nodes/people.rect'; import { peopleIconRect, peopleTextRect } from './nodes/people.rect'
import { rectangleIconRect, rectangleTextRect } from './nodes/rectangle.rect'; import { rectangleIconRect, rectangleTextRect } from './nodes/rectangle.rect'
import { graffiti } from './nodes/graffiti'; import { graffiti } from './nodes/graffiti'
import { graffitiAnchors } from './nodes/graffiti.anchor'; import { graffitiAnchors } from './nodes/graffiti.anchor'
import { mindNodeAnchors } from './nodes/mindNode.anchor'; import { mindNodeAnchors } from './nodes/mindNode.anchor'
import { mindLine } from './nodes/mindLine'; import { mindLine } from './nodes/mindLine'
import { mindLineAnchors } from './nodes/mindLine.anchor'; import { mindLineAnchors } from './nodes/mindLine.anchor'
import { lines } from './nodes/lines'; import { lines } from './nodes/lines'
// Functions of drawing a node. // Functions of drawing a node.
export var drawNodeFns = {}; export var drawNodeFns = {}
// Calc the occupy rect of icon. // Calc the occupy rect of icon.
export var iconRectFns = {}; export var iconRectFns = {}
// Calc the occupy rect of text. // Calc the occupy rect of text.
export var textRectFns = {}; export var textRectFns = {}
// Calc the anchors of node. // Calc the anchors of node.
export var anchorsFns = {}; export var anchorsFns = {}
// Functions of drawing a line. // Functions of drawing a line.
export var drawLineFns = {}; export var drawLineFns = {}
// Functions of drawing a arrow. // Functions of drawing a arrow.
export var drawArrowFns = {}; export var drawArrowFns = {}
function init() { function init () {
// ********Default nodes.******* // ********Default nodes.*******
// Combine // Combine
drawNodeFns.combine = rectangle; drawNodeFns.combine = rectangle
// Div // Div
drawNodeFns.div = rectangle; drawNodeFns.div = rectangle
// graffiti // graffiti
drawNodeFns.graffiti = graffiti; drawNodeFns.graffiti = graffiti
anchorsFns.graffiti = graffitiAnchors; anchorsFns.graffiti = graffitiAnchors
// lines // lines
drawNodeFns.lines = lines; drawNodeFns.lines = lines
// Square // Square
drawNodeFns.square = rectangle; drawNodeFns.square = rectangle
// Rectangle // Rectangle
drawNodeFns.rectangle = rectangle; drawNodeFns.rectangle = rectangle
iconRectFns.rectangle = rectangleIconRect; iconRectFns.rectangle = rectangleIconRect
textRectFns.rectangle = rectangleTextRect; textRectFns.rectangle = rectangleTextRect
// Ciricle // Ciricle
drawNodeFns.circle = circle; drawNodeFns.circle = circle
iconRectFns.circle = circleIconRect; iconRectFns.circle = circleIconRect
textRectFns.circle = circleTextRect; textRectFns.circle = circleTextRect
anchorsFns.circle = circleAnchors; anchorsFns.circle = circleAnchors
// Triangle // Triangle
drawNodeFns.triangle = triangle; drawNodeFns.triangle = triangle
anchorsFns.triangle = triangleAnchors; anchorsFns.triangle = triangleAnchors
iconRectFns.triangle = triangleIconRect; iconRectFns.triangle = triangleIconRect
textRectFns.triangle = triangleTextRect; textRectFns.triangle = triangleTextRect
// Diamond // Diamond
drawNodeFns.diamond = diamond; drawNodeFns.diamond = diamond
iconRectFns.diamond = diamondIconRect; iconRectFns.diamond = diamondIconRect
textRectFns.diamond = diamondTextRect; textRectFns.diamond = diamondTextRect
// Hexagon // Hexagon
drawNodeFns.hexagon = hexagon; drawNodeFns.hexagon = hexagon
iconRectFns.hexagon = hexagonIconRect; iconRectFns.hexagon = hexagonIconRect
textRectFns.hexagon = hexagonTextRect; textRectFns.hexagon = hexagonTextRect
anchorsFns.hexagon = hexagonAnchors; anchorsFns.hexagon = hexagonAnchors
// Pentagon // Pentagon
drawNodeFns.pentagon = pentagon; drawNodeFns.pentagon = pentagon
iconRectFns.pentagon = pentagonIconRect; iconRectFns.pentagon = pentagonIconRect
textRectFns.pentagon = pentagonTextRect; textRectFns.pentagon = pentagonTextRect
anchorsFns.pentagon = pentagonAnchors; anchorsFns.pentagon = pentagonAnchors
// Pentagram // Pentagram
drawNodeFns.pentagram = pentagram; drawNodeFns.pentagram = pentagram
iconRectFns.pentagram = pentagramIconRect; iconRectFns.pentagram = pentagramIconRect
textRectFns.pentagram = pentagramTextRect; textRectFns.pentagram = pentagramTextRect
anchorsFns.pentagram = pentagramAnchors; anchorsFns.pentagram = pentagramAnchors
// Left arrow // Left arrow
drawNodeFns.leftArrow = leftArrow; drawNodeFns.leftArrow = leftArrow
anchorsFns.leftArrow = arrowAnchors; anchorsFns.leftArrow = arrowAnchors
iconRectFns.leftArrow = leftArrowIconRect; iconRectFns.leftArrow = leftArrowIconRect
textRectFns.leftArrow = leftArrowTextRect; textRectFns.leftArrow = leftArrowTextRect
// Right arrow // Right arrow
drawNodeFns.rightArrow = rightArrow; drawNodeFns.rightArrow = rightArrow
anchorsFns.rightArrow = arrowAnchors; anchorsFns.rightArrow = arrowAnchors
iconRectFns.rightArrow = rightArrowIconRect; iconRectFns.rightArrow = rightArrowIconRect
textRectFns.rightArrow = rightArrowTextRect; textRectFns.rightArrow = rightArrowTextRect
// Two-way arrow // Two-way arrow
drawNodeFns.twowayArrow = twowayArrow; drawNodeFns.twowayArrow = twowayArrow
anchorsFns.twowayArrow = arrowAnchors; anchorsFns.twowayArrow = arrowAnchors
iconRectFns.twowayArrow = twowayArrowIconRect; iconRectFns.twowayArrow = twowayArrowIconRect
textRectFns.twowayArrow = twowayArrowTextRect; textRectFns.twowayArrow = twowayArrowTextRect
// Cloud // Cloud
drawNodeFns.cloud = cloud; drawNodeFns.cloud = cloud
anchorsFns.cloud = cloudAnchors; anchorsFns.cloud = cloudAnchors
iconRectFns.cloud = cloudIconRect; iconRectFns.cloud = cloudIconRect
textRectFns.cloud = cloudTextRect; textRectFns.cloud = cloudTextRect
// Message // Message
drawNodeFns.message = message; drawNodeFns.message = message
anchorsFns.message = messageAnchors; anchorsFns.message = messageAnchors
iconRectFns.message = messageIconRect; iconRectFns.message = messageIconRect
textRectFns.message = messageTextRect; textRectFns.message = messageTextRect
// File // File
drawNodeFns.file = file; drawNodeFns.file = file
// Text // Text
drawNodeFns.text = text; drawNodeFns.text = text
iconRectFns.text = lineIconRect; iconRectFns.text = lineIconRect
// Line // Line
drawNodeFns.line = nodeLine; drawNodeFns.line = nodeLine
anchorsFns.line = lineAnchors; anchorsFns.line = lineAnchors
iconRectFns.line = lineIconRect; iconRectFns.line = lineIconRect
textRectFns.line = lineTextRect; textRectFns.line = lineTextRect
// Image // Image
drawNodeFns.image = function (ctx, node) { }; drawNodeFns.image = function (ctx, node) { }
iconRectFns.image = imageIconRect; iconRectFns.image = imageIconRect
textRectFns.image = imageTextRect; textRectFns.image = imageTextRect
anchorsFns.image = imageAnchors; anchorsFns.image = imageAnchors
// Cube // Cube
drawNodeFns.cube = cube; drawNodeFns.cube = cube
anchorsFns.cube = cubeAnchors; anchorsFns.cube = cubeAnchors
iconRectFns.cube = cubeIconRect; iconRectFns.cube = cubeIconRect
textRectFns.cube = cubeTextRect; textRectFns.cube = cubeTextRect
// People // People
drawNodeFns.people = people; drawNodeFns.people = people
iconRectFns.people = peopleIconRect; iconRectFns.people = peopleIconRect
textRectFns.people = peopleTextRect; textRectFns.people = peopleTextRect
// MindNode // MindNode
drawNodeFns.mindNode = rectangle; drawNodeFns.mindNode = rectangle
anchorsFns.mindNode = mindNodeAnchors; anchorsFns.mindNode = mindNodeAnchors
iconRectFns.mindNode = rectangleIconRect; iconRectFns.mindNode = rectangleIconRect
textRectFns.mindNode = rectangleTextRect; textRectFns.mindNode = rectangleTextRect
// MindLine // MindLine
drawNodeFns.mindLine = mindLine; drawNodeFns.mindLine = mindLine
anchorsFns.mindLine = mindLineAnchors; anchorsFns.mindLine = mindLineAnchors
// ********end******** // ********end********
// ********Default lines.******* // ********Default lines.*******
drawLineFns.line = { drawLineFns.line = {
drawFn: line, drawFn: line,
drawControlPointsFn: lineControlPoints, drawControlPointsFn: lineControlPoints,
controlPointsFn: calcLineControlPoints, controlPointsFn: calcLineControlPoints,
pointIn: pointInPolyline, pointIn: pointInPolyline
}; }
drawLineFns.polyline = { drawLineFns.polyline = {
drawFn: polyline, drawFn: polyline,
drawControlPointsFn: polylineControlPoints, drawControlPointsFn: polylineControlPoints,
controlPointsFn: calcPolylineControlPoints, controlPointsFn: calcPolylineControlPoints,
dockControlPointFn: dockPolylineControlPoint, dockControlPointFn: dockPolylineControlPoint,
pointIn: pointInPolyline, pointIn: pointInPolyline
}; }
drawLineFns.curve = { drawLineFns.curve = {
drawFn: curve, drawFn: curve,
drawControlPointsFn: curveControlPoints, drawControlPointsFn: curveControlPoints,
controlPointsFn: calcCurveControlPoints, controlPointsFn: calcCurveControlPoints,
pointIn: pointInCurve, pointIn: pointInCurve
}; }
drawLineFns.mind = { drawLineFns.mind = {
drawFn: curve, drawFn: curve,
drawControlPointsFn: curveControlPoints, drawControlPointsFn: curveControlPoints,
controlPointsFn: calcMindControlPoints, controlPointsFn: calcMindControlPoints,
pointIn: pointInCurve, pointIn: pointInCurve
}; }
// ********end******** // ********end********
// ********Default nodes.******* // ********Default nodes.*******
drawArrowFns.triangleSolid = triangleSolid; drawArrowFns.triangleSolid = triangleSolid
drawArrowFns.triangle = arrowTriangle; drawArrowFns.triangle = arrowTriangle
drawArrowFns.diamondSolid = diamondSolid; drawArrowFns.diamondSolid = diamondSolid
drawArrowFns.diamond = arrowDiamond; drawArrowFns.diamond = arrowDiamond
drawArrowFns.circleSolid = circleSolid; drawArrowFns.circleSolid = circleSolid
drawArrowFns.circle = arrowCircle; drawArrowFns.circle = arrowCircle
drawArrowFns.line = arrowLine; drawArrowFns.line = arrowLine
drawArrowFns.lineUp = lineUp; drawArrowFns.lineUp = lineUp
drawArrowFns.lineDown = lineDown; drawArrowFns.lineDown = lineDown
// ********end******** // ********end********
} }
init(); init()
// registerNode: Register a custom node. // registerNode: Register a custom node.
// name - The name of node. // name - The name of node.
// drawFn - How to draw. // drawFn - How to draw.
@@ -215,16 +215,16 @@ init();
// iconRectFn - How to get the icon rect. // iconRectFn - How to get the icon rect.
// textRectFn - How to get the text rect. // textRectFn - How to get the text rect.
// protect - No overwirte the node if exists. // protect - No overwirte the node if exists.
export function registerNode(name, drawFn, anchorsFn, iconRectFn, textRectFn, protect) { export function registerNode (name, drawFn, anchorsFn, iconRectFn, textRectFn, protect) {
// Exist // Exist
if (drawNodeFns[name] && protect) { if (drawNodeFns[name] && protect) {
return false; return false
} }
drawNodeFns[name] = drawFn; drawNodeFns[name] = drawFn
anchorsFns[name] = anchorsFn; anchorsFns[name] = anchorsFn
iconRectFns[name] = iconRectFn; iconRectFns[name] = iconRectFn
textRectFns[name] = textRectFn; textRectFns[name] = textRectFn
return true; return true
} }
// registerLine: Register a custom line. // registerLine: Register a custom line.
// name - The name of line. // name - The name of line.
@@ -233,36 +233,36 @@ export function registerNode(name, drawFn, anchorsFn, iconRectFn, textRectFn, pr
// controlPointsFn - How to get the controlPoints. // controlPointsFn - How to get the controlPoints.
// dockControlPointFn - Dock a point to horizontal/vertial or related position. // dockControlPointFn - Dock a point to horizontal/vertial or related position.
// force - Overwirte the node if exists. // force - Overwirte the node if exists.
export function registerLine(name, drawFn, drawControlPointsFn, controlPointsFn, dockControlPointFn, pointInFn, getLength, getCenter, getPointByPos, force) { export function registerLine (name, drawFn, drawControlPointsFn, controlPointsFn, dockControlPointFn, pointInFn, getLength, getCenter, getPointByPos, force) {
if (force === void 0) { force = true; } if (force === void 0) { force = true }
// Exist // Exist
if (drawLineFns[name] && !force) { if (drawLineFns[name] && !force) {
return false; return false
} }
drawLineFns[name] = { drawLineFns[name] = {
drawFn: drawFn, drawFn: drawFn,
drawControlPointsFn: drawControlPointsFn, drawControlPointsFn: drawControlPointsFn,
controlPointsFn: controlPointsFn, controlPointsFn: controlPointsFn,
dockControlPointFn: dockControlPointFn, dockControlPointFn: dockControlPointFn,
pointIn: pointInFn, pointIn: pointInFn,
getLength: getLength, getLength: getLength,
getCenter: getCenter, getCenter: getCenter,
getPointByPos: getPointByPos, getPointByPos: getPointByPos
}; }
return true; return true
} }
// registerArrow: Register a custom arrow. // registerArrow: Register a custom arrow.
// name - the name of arrow. // name - the name of arrow.
// drawFn - how to draw. // drawFn - how to draw.
// force - Overwirte the node if exists. // force - Overwirte the node if exists.
export function registerArrow(name, drawFn, protect) { export function registerArrow (name, drawFn, protect) {
// Exist // Exist
if (drawArrowFns[name] && protect) { if (drawArrowFns[name] && protect) {
return false; return false
} }
drawArrowFns[name] = drawFn; drawArrowFns[name] = drawFn
return true; return true
} }
window.registerTopologyNode = registerNode; window.registerTopologyNode = registerNode
window.registerTopologyLine = registerLine; window.registerTopologyLine = registerLine
//# sourceMappingURL=default.js.map // # sourceMappingURL=default.js.map

View File

@@ -1,19 +1,17 @@
import { Rect } from '../models/rect'; import { Rect } from '../models/rect'
export function defaultIconRect(node) { export function defaultIconRect (node) {
if (node.image && node.imageWidth) { if (node.image && node.imageWidth) {
node.iconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.imageWidth, node.imageHeight); node.iconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.imageWidth, node.imageHeight)
} } else if (node.icon && node.iconSize) {
else if (node.icon && node.iconSize) { node.iconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.iconSize, node.iconSize)
node.iconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.iconSize, node.iconSize); } else {
} node.iconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, (node.rect.height * 3) / 4 - node.paddingTopNum - node.paddingBottomNum)
else { }
node.iconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, (node.rect.height * 3) / 4 - node.paddingTopNum - node.paddingBottomNum); node.fullIconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, node.rect.height - node.paddingTopNum - node.paddingBottomNum)
}
node.fullIconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, node.rect.height - node.paddingTopNum - node.paddingBottomNum);
} }
export function defaultTextRect(node) { export function defaultTextRect (node) {
var height = node.rect.height - node.paddingTopNum - node.paddingBottomNum; const height = node.rect.height - node.paddingTopNum - node.paddingBottomNum
node.textRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum + (height * 3) / 4, node.rect.width - node.paddingLeftNum - node.paddingRightNum, height / 4); node.textRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum + (height * 3) / 4, node.rect.width - node.paddingLeftNum - node.paddingRightNum, height / 4)
node.fullTextRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, height); node.fullTextRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, height)
} }
//# sourceMappingURL=default.rect.js.map // # sourceMappingURL=default.rect.js.map

View File

@@ -1,4 +1,4 @@
export * from './default'; export * from './default'
export * from './nodes/rectangle'; export * from './nodes/rectangle'
export * from './nodes/text'; export * from './nodes/text'
//# sourceMappingURL=index.js.map // # sourceMappingURL=index.js.map

View File

@@ -1,130 +1,128 @@
import { Store } from 'le5le-store'; import { Store } from 'le5le-store'
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
import { pointInLine } from '../../utils/canvas'; import { pointInLine } from '../../utils/canvas'
import { rgba } from '../../utils/math'; import { rgba } from '../../utils/math'
var distance = 80; const distance = 80
export function curve(ctx, l) { export function curve (ctx, l) {
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(l.from.x, l.from.y); ctx.moveTo(l.from.x, l.from.y)
ctx.bezierCurveTo(l.controlPoints[0].x, l.controlPoints[0].y, l.controlPoints[1].x, l.controlPoints[1].y, l.to.x, l.to.y); ctx.bezierCurveTo(l.controlPoints[0].x, l.controlPoints[0].y, l.controlPoints[1].x, l.controlPoints[1].y, l.to.x, l.to.y)
ctx.stroke(); ctx.stroke()
} }
export function curveControlPoints(ctx, l) { export function curveControlPoints (ctx, l) {
ctx.save(); ctx.save()
ctx.fillStyle = rgba(0.5, ctx.strokeStyle + ''); ctx.fillStyle = rgba(0.5, ctx.strokeStyle + '')
ctx.lineWidth = 1; ctx.lineWidth = 1
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(l.from.x, l.from.y); ctx.moveTo(l.from.x, l.from.y)
ctx.lineTo(l.controlPoints[0].x, l.controlPoints[0].y); ctx.lineTo(l.controlPoints[0].x, l.controlPoints[0].y)
ctx.stroke(); ctx.stroke()
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(l.to.x, l.to.y); ctx.moveTo(l.to.x, l.to.y)
ctx.lineTo(l.controlPoints[1].x, l.controlPoints[1].y); ctx.lineTo(l.controlPoints[1].x, l.controlPoints[1].y)
ctx.stroke(); ctx.stroke()
ctx.fillStyle = '#fff'; ctx.fillStyle = '#fff'
ctx.lineWidth = 2; ctx.lineWidth = 2
for (var _i = 0, _a = l.controlPoints; _i < _a.length; _i++) { for (let _i = 0, _a = l.controlPoints; _i < _a.length; _i++) {
var item = _a[_i]; const item = _a[_i]
ctx.beginPath(); ctx.beginPath()
ctx.arc(item.x, item.y, 4, 0, Math.PI * 2); ctx.arc(item.x, item.y, 4, 0, Math.PI * 2)
ctx.stroke(); ctx.stroke()
ctx.fill(); ctx.fill()
} }
ctx.restore(); ctx.restore()
} }
export function calcCurveControlPoints(l) { export function calcCurveControlPoints (l) {
if (!l.from.direction) { if (!l.from.direction) {
l.from.direction = Direction.Bottom; l.from.direction = Direction.Bottom
} }
if (!l.to.direction) {
l.to.direction = (l.from.direction + 2) % 4
if (!l.to.direction) { if (!l.to.direction) {
l.to.direction = (l.from.direction + 2) % 4; l.to.direction = Direction.Left
if (!l.to.direction) {
l.to.direction = Direction.Left;
}
} }
l.controlPoints = [getControlPt(l.from, l.to), getControlPt(l.to, l.from)]; }
Store.set(generateStoreKey(l, 'pts-') + l.id, undefined); l.controlPoints = [getControlPt(l.from, l.to), getControlPt(l.to, l.from)]
Store.set(generateStoreKey(l, 'pts-') + l.id, undefined)
} }
export function pointInCurve(point, l) { export function pointInCurve (point, l) {
var points = Store.get(generateStoreKey(l, 'pts-') + l.id); let points = Store.get(generateStoreKey(l, 'pts-') + l.id)
if (!points) { if (!points) {
points = [l.from]; points = [l.from]
if (l.controlPoints) { if (l.controlPoints) {
for (var i = 0.01; i < 1; i += 0.01) { for (var i = 0.01; i < 1; i += 0.01) {
points.push(getBezierPoint(i, l.from, l.controlPoints[0], l.controlPoints[1], l.to)); points.push(getBezierPoint(i, l.from, l.controlPoints[0], l.controlPoints[1], l.to))
} }
}
points.push(l.to);
Store.set(generateStoreKey(l, 'pts-') + l.id, points);
} }
var cnt = points.length - 1; points.push(l.to)
for (var i = 0; i < cnt; ++i) { Store.set(generateStoreKey(l, 'pts-') + l.id, points)
if (pointInLine(point, points[i], points[i + 1])) { }
return true; const cnt = points.length - 1
} for (var i = 0; i < cnt; ++i) {
if (pointInLine(point, points[i], points[i + 1])) {
return true
} }
return false; }
return false
} }
// Get a point in bezier. // Get a point in bezier.
// pos - The position of point in bezier. It is expressed as a percentage(0 - 1). // pos - The position of point in bezier. It is expressed as a percentage(0 - 1).
export function getBezierPoint(pos, from, cp1, cp2, to) { export function getBezierPoint (pos, from, cp1, cp2, to) {
var x1 = from.x, y1 = from.y; const x1 = from.x; const y1 = from.y
var x2 = to.x, y2 = to.y; const x2 = to.x; const y2 = to.y
var cx1 = cp1.x, cy1 = cp1.y; const cx1 = cp1.x; const cy1 = cp1.y
var cx2 = cp2.x, cy2 = cp2.y; const cx2 = cp2.x; const cy2 = cp2.y
var x = x1 * (1 - pos) * (1 - pos) * (1 - pos) + const x = x1 * (1 - pos) * (1 - pos) * (1 - pos) +
3 * cx1 * pos * (1 - pos) * (1 - pos) + 3 * cx1 * pos * (1 - pos) * (1 - pos) +
3 * cx2 * pos * pos * (1 - pos) + 3 * cx2 * pos * pos * (1 - pos) +
x2 * pos * pos * pos; x2 * pos * pos * pos
var y = y1 * (1 - pos) * (1 - pos) * (1 - pos) + const y = y1 * (1 - pos) * (1 - pos) * (1 - pos) +
3 * cy1 * pos * (1 - pos) * (1 - pos) + 3 * cy1 * pos * (1 - pos) * (1 - pos) +
3 * cy2 * pos * pos * (1 - pos) + 3 * cy2 * pos * pos * (1 - pos) +
y2 * pos * pos * pos; y2 * pos * pos * pos
return new Point(x, y); return new Point(x, y)
} }
export function getControlPt(pt, to) { export function getControlPt (pt, to) {
var point = new Point(pt.x, pt.y, pt.direction, pt.anchorIndex, pt.id); const point = new Point(pt.x, pt.y, pt.direction, pt.anchorIndex, pt.id)
var dis = window.topologyControlPtDistance || distance; let dis = window.topologyControlPtDistance || distance
if ((pt.direction === Direction.Up || pt.direction === Direction.Bottom) && Math.abs(pt.x - to.x) < 3) { if ((pt.direction === Direction.Up || pt.direction === Direction.Bottom) && Math.abs(pt.x - to.x) < 3) {
if (to.y > pt.y) { if (to.y > pt.y) {
dis = Math.round((to.y - pt.y) / 3); dis = Math.round((to.y - pt.y) / 3)
point.y += dis; point.y += dis
} } else {
else { dis = Math.round((pt.y - to.y) / 3)
dis = Math.round((pt.y - to.y) / 3); point.y -= dis
point.y -= dis;
}
return point;
} }
if ((pt.direction === Direction.Left || pt.direction === Direction.Right) && Math.abs(pt.y - to.y) < 3) { return point
if (to.x > pt.x) { }
dis = Math.round((to.x - pt.x) / 3); if ((pt.direction === Direction.Left || pt.direction === Direction.Right) && Math.abs(pt.y - to.y) < 3) {
point.x += dis; if (to.x > pt.x) {
} dis = Math.round((to.x - pt.x) / 3)
else { point.x += dis
dis = Math.round((pt.x - to.x) / 3); } else {
point.x -= dis; dis = Math.round((pt.x - to.x) / 3)
} point.x -= dis
return point;
} }
switch (pt.direction) { return point
case Direction.Up: }
point.y -= dis; switch (pt.direction) {
break; case Direction.Up:
case Direction.Right: point.y -= dis
point.x += dis; break
break; case Direction.Right:
case Direction.Bottom: point.x += dis
point.y += dis; break
break; case Direction.Bottom:
case Direction.Left: point.y += dis
point.x -= dis; break
break; case Direction.Left:
} point.x -= dis
return point; break
}
return point
} }
export function generateStoreKey(pen, key) { export function generateStoreKey (pen, key) {
return pen.getTID() + "-" + key; return pen.getTID() + '-' + key
} }
//# sourceMappingURL=curve.js.map // # sourceMappingURL=curve.js.map

View File

@@ -1,11 +1,11 @@
export function line(ctx, l) { export function line (ctx, l) {
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(l.from.x, l.from.y); ctx.moveTo(l.from.x, l.from.y)
ctx.lineTo(l.to.x, l.to.y); ctx.lineTo(l.to.x, l.to.y)
ctx.stroke(); ctx.stroke()
} }
export function lineControlPoints(ctx, l) { } export function lineControlPoints (ctx, l) { }
export function calcLineControlPoints(l) { export function calcLineControlPoints (l) {
l.controlPoints = []; l.controlPoints = []
} }
//# sourceMappingURL=line.js.map // # sourceMappingURL=line.js.map

View File

@@ -1,32 +1,32 @@
import { Store } from 'le5le-store'; import { Store } from 'le5le-store'
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
import { generateStoreKey } from './curve'; import { generateStoreKey } from './curve'
var distance = 20; const distance = 20
export function calcMindControlPoints(l) { export function calcMindControlPoints (l) {
if (!l.from.direction) { if (!l.from.direction) {
l.from.direction = Direction.Bottom; l.from.direction = Direction.Bottom
} }
if (!l.to.direction) {
l.to.direction = (l.from.direction + 2) % 4
if (!l.to.direction) { if (!l.to.direction) {
l.to.direction = (l.from.direction + 2) % 4; l.to.direction = Direction.Left
if (!l.to.direction) {
l.to.direction = Direction.Left;
}
} }
switch (l.from.direction) { }
case Direction.Up: switch (l.from.direction) {
l.controlPoints = [new Point(l.from.x, l.from.y - distance), new Point(l.from.x, l.to.y)]; case Direction.Up:
break; l.controlPoints = [new Point(l.from.x, l.from.y - distance), new Point(l.from.x, l.to.y)]
case Direction.Right: break
l.controlPoints = [new Point(l.from.x + distance, l.from.y), new Point(l.from.x, l.to.y)]; case Direction.Right:
break; l.controlPoints = [new Point(l.from.x + distance, l.from.y), new Point(l.from.x, l.to.y)]
case Direction.Bottom: break
l.controlPoints = [new Point(l.from.x, l.from.y + distance), new Point(l.from.x, l.to.y)]; case Direction.Bottom:
break; l.controlPoints = [new Point(l.from.x, l.from.y + distance), new Point(l.from.x, l.to.y)]
case Direction.Left: break
l.controlPoints = [new Point(l.from.x - distance, l.from.y), new Point(l.from.x, l.to.y)]; case Direction.Left:
break; l.controlPoints = [new Point(l.from.x - distance, l.from.y), new Point(l.from.x, l.to.y)]
} break
Store.set(generateStoreKey(l, 'pts-') + l.id, undefined); }
Store.set(generateStoreKey(l, 'pts-') + l.id, undefined)
} }
//# sourceMappingURL=mind.js.map // # sourceMappingURL=mind.js.map

View File

@@ -1,309 +1,285 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
import { pointInLine } from '../../utils/canvas'; import { pointInLine } from '../../utils/canvas'
var minDistance = 50; const minDistance = 50
export function polyline(ctx, l) { export function polyline (ctx, l) {
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(l.from.x, l.from.y); ctx.moveTo(l.from.x, l.from.y)
for (var _i = 0, _a = l.controlPoints; _i < _a.length; _i++) { for (let _i = 0, _a = l.controlPoints; _i < _a.length; _i++) {
var item = _a[_i]; const item = _a[_i]
ctx.lineTo(item.x, item.y); ctx.lineTo(item.x, item.y)
} }
ctx.lineTo(l.to.x, l.to.y); ctx.lineTo(l.to.x, l.to.y)
ctx.stroke(); ctx.stroke()
} }
export function polylineControlPoints(ctx, l) { export function polylineControlPoints (ctx, l) {
ctx.save(); ctx.save()
ctx.fillStyle = '#fff'; ctx.fillStyle = '#fff'
ctx.lineWidth = 2; ctx.lineWidth = 2
for (var _i = 0, _a = l.controlPoints; _i < _a.length; _i++) { for (let _i = 0, _a = l.controlPoints; _i < _a.length; _i++) {
var item = _a[_i]; const item = _a[_i]
ctx.beginPath(); ctx.beginPath()
ctx.arc(item.x, item.y, 4, 0, Math.PI * 2); ctx.arc(item.x, item.y, 4, 0, Math.PI * 2)
ctx.stroke(); ctx.stroke()
ctx.fill(); ctx.fill()
} }
ctx.restore(); ctx.restore()
} }
export function calcPolylineControlPoints(l) { export function calcPolylineControlPoints (l) {
l.controlPoints = []; l.controlPoints = []
var from = getDirectionPoint(l.from, l.to); const from = getDirectionPoint(l.from, l.to)
if (l.from.direction) { if (l.from.direction) {
l.controlPoints.push(from); l.controlPoints.push(from)
} }
var to = getDirectionPoint(l.to, l.from); const to = getDirectionPoint(l.to, l.from)
var pts; let pts
switch (from.direction) { switch (from.direction) {
case Direction.Up: case Direction.Up:
pts = getNextPointByUp(from, to); pts = getNextPointByUp(from, to)
break; break
case Direction.Right: case Direction.Right:
pts = getNextPointByRight(from, to); pts = getNextPointByRight(from, to)
break; break
case Direction.Bottom: case Direction.Bottom:
pts = getNextPointByBottom(from, to); pts = getNextPointByBottom(from, to)
break; break
case Direction.Left: case Direction.Left:
pts = getNextPointByLeft(from, to); pts = getNextPointByLeft(from, to)
break; break
} }
l.controlPoints.push.apply(l.controlPoints, pts); l.controlPoints.push.apply(l.controlPoints, pts)
if (l.to.direction) { if (l.to.direction) {
l.controlPoints.push(to); l.controlPoints.push(to)
} }
} }
export function pointInPolyline(point, l) { export function pointInPolyline (point, l) {
if (!l.controlPoints || !l.controlPoints.length) { if (!l.controlPoints || !l.controlPoints.length) {
return pointInLine(point, l.from, l.to, l.lineWidth / 2); return pointInLine(point, l.from, l.to, l.lineWidth / 2)
}
if (pointInLine(point, l.from, l.controlPoints[0])) {
return true
}
if (pointInLine(point, l.to, l.controlPoints[l.controlPoints.length - 1])) {
return true
}
for (let i = 0; i < l.controlPoints.length - 1; ++i) {
if (pointInLine(point, l.controlPoints[i], l.controlPoints[i + 1])) {
return true
} }
if (pointInLine(point, l.from, l.controlPoints[0])) { }
return true; return false
}
if (pointInLine(point, l.to, l.controlPoints[l.controlPoints.length - 1])) {
return true;
}
for (var i = 0; i < l.controlPoints.length - 1; ++i) {
if (pointInLine(point, l.controlPoints[i], l.controlPoints[i + 1])) {
return true;
}
}
return false;
} }
export function dockPolylineControlPoint(point, l) { export function dockPolylineControlPoint (point, l) {
var pts = [l.from]; const pts = [l.from]
pts.push.apply(pts, l.controlPoints); pts.push.apply(pts, l.controlPoints)
pts.push(l.to); pts.push(l.to)
for (var _i = 0, pts_1 = pts; _i < pts_1.length; _i++) { for (let _i = 0, pts_1 = pts; _i < pts_1.length; _i++) {
var item = pts_1[_i]; const item = pts_1[_i]
if (Math.abs(point.x - item.x) < 7) { if (Math.abs(point.x - item.x) < 7) {
point.x = item.x; point.x = item.x
}
if (Math.abs(point.y - item.y) < 7) {
point.y = item.y;
}
} }
if (Math.abs(point.y - item.y) < 7) {
point.y = item.y
}
}
} }
function getDirectionPoint(pt, to) { function getDirectionPoint (pt, to) {
var point = pt.clone(); const point = pt.clone()
switch (pt.direction) { switch (pt.direction) {
case Direction.Up: case Direction.Up:
if (to.y < pt.y) { if (to.y < pt.y) {
point.y -= Math.round((pt.y - to.y) / 2); point.y -= Math.round((pt.y - to.y) / 2)
} } else {
else { point.y -= minDistance
point.y -= minDistance; }
} break
break; case Direction.Right:
case Direction.Right: if (to.x > pt.x) {
if (to.x > pt.x) { point.x += Math.round((to.x - pt.x) / 2)
point.x += Math.round((to.x - pt.x) / 2); } else {
} point.x += minDistance
else { }
point.x += minDistance; break
} case Direction.Bottom:
break; if (to.y > pt.y) {
case Direction.Bottom: point.y += Math.round((to.y - pt.y) / 2)
if (to.y > pt.y) { } else {
point.y += Math.round((to.y - pt.y) / 2); point.y += minDistance
} }
else { break
point.y += minDistance; case Direction.Left:
} if (to.x < pt.x) {
break; point.x -= Math.round((pt.x - to.x) / 2)
case Direction.Left: } else {
if (to.x < pt.x) { point.x -= minDistance
point.x -= Math.round((pt.x - to.x) / 2); }
} break
else { }
point.x -= minDistance; return point
}
break;
}
return point;
} }
function getNextPointByUp(from, to) { function getNextPointByUp (from, to) {
if (from.x === to.x || from.y === to.y) { if (from.x === to.x || from.y === to.y) {
return []; return []
} }
// The to point above the from point. // The to point above the from point.
if (from.y > to.y) { if (from.y > to.y) {
if (to.direction === Direction.Up && from.y - to.y > 3 * minDistance) { if (to.direction === Direction.Up && from.y - to.y > 3 * minDistance) {
if (from.x < to.x) { if (from.x < to.x) {
if (to.x - from.x < minDistance) { if (to.x - from.x < minDistance) {
return [new Point(from.x - 2 * minDistance, from.y), new Point(from.x - 2 * minDistance, to.y)]; return [new Point(from.x - 2 * minDistance, from.y), new Point(from.x - 2 * minDistance, to.y)]
}
return [new Point(from.x, to.y)];
}
else {
if (from.x - to.x < minDistance) {
return [new Point(from.x + 2 * minDistance, from.y), new Point(from.x + 2 * minDistance, to.y)];
}
return [new Point(from.x, to.y)];
}
} }
else { return [new Point(from.x, to.y)]
// Left top } else {
if ((to.direction === Direction.Left && from.x > to.x) || (to.direction === Direction.Right && from.x < to.x)) { if (from.x - to.x < minDistance) {
return [new Point(to.x, from.y)]; return [new Point(from.x + 2 * minDistance, from.y), new Point(from.x + 2 * minDistance, to.y)]
}
return [new Point(from.x, to.y)];
} }
// The to point below the from point. return [new Point(from.x, to.y)]
} }
else { } else {
if (to.direction === Direction.Bottom) { // Left top
if (from.x < to.x) { if ((to.direction === Direction.Left && from.x > to.x) || (to.direction === Direction.Right && from.x < to.x)) {
return getHorizontalPoints(from, to); return [new Point(to.x, from.y)]
} }
else { return [new Point(from.x, to.y)]
var pts = getHorizontalPoints(to, from);
return [pts[1], pts[0]];
}
}
else {
return [new Point(to.x, from.y)];
}
}
}
function getNextPointByBottom(from, to) {
if (from.x === to.x || from.y === to.y) {
return [];
} }
// The to point below the from point. // The to point below the from point.
if (from.y < to.y) { } else {
if (to.direction === Direction.Bottom && to.y - from.y > 3 * minDistance) { if (to.direction === Direction.Bottom) {
if (from.x < to.x) { if (from.x < to.x) {
if (to.x - from.x < minDistance) { return getHorizontalPoints(from, to)
return [new Point(from.x - 2 * minDistance, from.y), new Point(from.x - 2 * minDistance, to.y)]; } else {
} const pts = getHorizontalPoints(to, from)
return [new Point(from.x, to.y)]; return [pts[1], pts[0]]
} }
else { } else {
if (from.x - to.x < minDistance) { return [new Point(to.x, from.y)]
return [new Point(from.x + 2 * minDistance, from.y), new Point(from.x + 2 * minDistance, to.y)];
}
return [new Point(from.x, to.y)];
}
}
else {
if ((to.direction === Direction.Left && from.x > to.x) || (to.direction === Direction.Right && from.x < to.x)) {
return [new Point(to.x, from.y)];
}
return [new Point(from.x, to.y)];
}
// The to point below the from point.
}
else {
if (to.direction === Direction.Up) {
if (from.x < to.x) {
return getHorizontalPoints(from, to);
}
else {
var pts = getHorizontalPoints(to, from);
return [pts[1], pts[0]];
}
}
else {
return [new Point(to.x, from.y)];
}
} }
}
} }
function getNextPointByLeft(from, to) { function getNextPointByBottom (from, to) {
if (from.x === to.x || from.y === to.y) { if (from.x === to.x || from.y === to.y) {
return []; return []
} }
// The to point is on the left. // The to point below the from point.
if (from.x > to.x) { if (from.y < to.y) {
if (to.direction === Direction.Left && from.x - to.x > 3 * minDistance) { if (to.direction === Direction.Bottom && to.y - from.y > 3 * minDistance) {
if (from.y < to.y) { if (from.x < to.x) {
if (to.y - from.y < minDistance) { if (to.x - from.x < minDistance) {
return [new Point(from.x, from.y + 2 * minDistance), new Point(to.x, from.y + 2 * minDistance)]; return [new Point(from.x - 2 * minDistance, from.y), new Point(from.x - 2 * minDistance, to.y)]
}
return [new Point(to.x, from.y)];
}
else {
if (from.y - to.y < minDistance) {
return [new Point(from.x, from.y - 2 * minDistance), new Point(to.x, from.y - 2 * minDistance)];
}
return [new Point(to.x, from.y)];
}
} }
else { return [new Point(from.x, to.y)]
if (to.direction === Direction.Left || } else {
if (from.x - to.x < minDistance) {
return [new Point(from.x + 2 * minDistance, from.y), new Point(from.x + 2 * minDistance, to.y)]
}
return [new Point(from.x, to.y)]
}
} else {
if ((to.direction === Direction.Left && from.x > to.x) || (to.direction === Direction.Right && from.x < to.x)) {
return [new Point(to.x, from.y)]
}
return [new Point(from.x, to.y)]
}
// The to point below the from point.
} else {
if (to.direction === Direction.Up) {
if (from.x < to.x) {
return getHorizontalPoints(from, to)
} else {
const pts = getHorizontalPoints(to, from)
return [pts[1], pts[0]]
}
} else {
return [new Point(to.x, from.y)]
}
}
}
function getNextPointByLeft (from, to) {
if (from.x === to.x || from.y === to.y) {
return []
}
// The to point is on the left.
if (from.x > to.x) {
if (to.direction === Direction.Left && from.x - to.x > 3 * minDistance) {
if (from.y < to.y) {
if (to.y - from.y < minDistance) {
return [new Point(from.x, from.y + 2 * minDistance), new Point(to.x, from.y + 2 * minDistance)]
}
return [new Point(to.x, from.y)]
} else {
if (from.y - to.y < minDistance) {
return [new Point(from.x, from.y - 2 * minDistance), new Point(to.x, from.y - 2 * minDistance)]
}
return [new Point(to.x, from.y)]
}
} else {
if (to.direction === Direction.Left ||
(to.direction === Direction.Up && from.y < to.y) || (to.direction === Direction.Up && from.y < to.y) ||
(to.direction === Direction.Bottom && from.y > to.y)) { (to.direction === Direction.Bottom && from.y > to.y)) {
return [new Point(to.x, from.y)]; return [new Point(to.x, from.y)]
} }
return [new Point(from.x, to.y)]; return [new Point(from.x, to.y)]
}
// The to point is on the right.
}
else {
if (to.direction === Direction.Right) {
if (from.y < to.y) {
return getVerticalPoints(from, to);
}
else {
var pts = getVerticalPoints(to, from);
return [pts[1], pts[0]];
}
}
else {
return [new Point(from.x, to.y)];
}
}
}
function getNextPointByRight(from, to) {
if (from.x === to.x || from.y === to.y) {
return [];
} }
// The to point is on the right. // The to point is on the right.
if (from.x < to.x) { } else {
if (to.direction === Direction.Right && to.x - from.x > 3 * minDistance) { if (to.direction === Direction.Right) {
if (from.y < to.y) { if (from.y < to.y) {
if (to.y - from.y < minDistance) { return getVerticalPoints(from, to)
return [new Point(from.x, from.y - 2 * minDistance), new Point(to.x, from.y - 2 * minDistance)]; } else {
} const pts = getVerticalPoints(to, from)
return [new Point(to.x, from.y)]; return [pts[1], pts[0]]
} }
else { } else {
if (from.y - to.y < minDistance) { return [new Point(from.x, to.y)]
return [new Point(from.x, from.y + 2 * minDistance), new Point(to.x, from.y + 2 * minDistance)]; }
} }
return [new Point(to.x, from.y)]; }
} function getNextPointByRight (from, to) {
if (from.x === to.x || from.y === to.y) {
return []
}
// The to point is on the right.
if (from.x < to.x) {
if (to.direction === Direction.Right && to.x - from.x > 3 * minDistance) {
if (from.y < to.y) {
if (to.y - from.y < minDistance) {
return [new Point(from.x, from.y - 2 * minDistance), new Point(to.x, from.y - 2 * minDistance)]
} }
else { return [new Point(to.x, from.y)]
if (to.direction === Direction.Right || } else {
if (from.y - to.y < minDistance) {
return [new Point(from.x, from.y + 2 * minDistance), new Point(to.x, from.y + 2 * minDistance)]
}
return [new Point(to.x, from.y)]
}
} else {
if (to.direction === Direction.Right ||
(to.direction === Direction.Up && from.y < to.y) || (to.direction === Direction.Up && from.y < to.y) ||
(to.direction === Direction.Bottom && from.y > to.y)) { (to.direction === Direction.Bottom && from.y > to.y)) {
return [new Point(to.x, from.y)]; return [new Point(to.x, from.y)]
} }
return [new Point(from.x, to.y)]; return [new Point(from.x, to.y)]
}
// The to point is on the left.
} }
else { // The to point is on the left.
if (to.direction === Direction.Left) { } else {
if (from.y < to.y) { if (to.direction === Direction.Left) {
return getVerticalPoints(from, to); if (from.y < to.y) {
} return getVerticalPoints(from, to)
else { } else {
var pts = getVerticalPoints(to, from); const pts = getVerticalPoints(to, from)
return [pts[1], pts[0]]; return [pts[1], pts[0]]
} }
} } else {
else { return [new Point(from.x, to.y)]
return [new Point(from.x, to.y)];
}
} }
}
} }
function getHorizontalPoints(left, right) { function getHorizontalPoints (left, right) {
var x = left.x + (right.x - left.x) / 2; const x = left.x + (right.x - left.x) / 2
return [new Point(x, left.y), new Point(x, right.y)]; return [new Point(x, left.y), new Point(x, right.y)]
} }
function getVerticalPoints(up, bottom) { function getVerticalPoints (up, bottom) {
var y = up.y + (bottom.y - up.y) / 2; const y = up.y + (bottom.y - up.y) / 2
return [new Point(up.x, y), new Point(bottom.x, y)]; return [new Point(up.x, y), new Point(bottom.x, y)]
} }
//# sourceMappingURL=polyline.js.map // # sourceMappingURL=polyline.js.map

View File

@@ -1,7 +1,7 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
export function arrowAnchors(node) { export function arrowAnchors (node) {
node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left)); node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left))
node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2, Direction.Right)); node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2, Direction.Right))
} }
//# sourceMappingURL=arrow.anchor.js.map // # sourceMappingURL=arrow.anchor.js.map

View File

@@ -1,45 +1,45 @@
export function leftArrow(ctx, node) { export function leftArrow (ctx, node) {
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x, node.rect.y + node.rect.height / 2); ctx.moveTo(node.rect.x, node.rect.y + node.rect.height / 2)
ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y); ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y)
ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y + node.rect.height / 3); ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y + node.rect.height / 3)
ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 3); ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 3)
ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + (node.rect.height * 2) / 3); ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + (node.rect.height * 2) / 3)
// ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y + (node.rect.height * 2) / 3); // ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y + (node.rect.height * 2) / 3);
ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y + (node.rect.height * 2) / 3); ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y + (node.rect.height * 2) / 3)
ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y + (node.rect.height * 2) / 3); ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y + (node.rect.height * 2) / 3)
ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y + node.rect.height); ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y + node.rect.height)
ctx.closePath(); ctx.closePath();
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
export function rightArrow(ctx, node) { export function rightArrow (ctx, node) {
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x, node.rect.y + node.rect.height / 3); ctx.moveTo(node.rect.x, node.rect.y + node.rect.height / 3)
ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y + node.rect.height / 3); ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y + node.rect.height / 3)
ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y); ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y)
ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2); ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2)
ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y + node.rect.height); ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y + node.rect.height)
ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y + (node.rect.height * 2) / 3); ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y + (node.rect.height * 2) / 3)
ctx.lineTo(node.rect.x, node.rect.y + (node.rect.height * 2) / 3); ctx.lineTo(node.rect.x, node.rect.y + (node.rect.height * 2) / 3)
ctx.closePath(); ctx.closePath();
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
export function twowayArrow(ctx, node) { export function twowayArrow (ctx, node) {
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x, node.rect.y + node.rect.height / 2); ctx.moveTo(node.rect.x, node.rect.y + node.rect.height / 2)
ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y); ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y)
ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y + node.rect.height / 3); ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y + node.rect.height / 3)
ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y + node.rect.height / 3); ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y + node.rect.height / 3)
ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y); ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y)
ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2); ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2)
ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y + node.rect.height); ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y + node.rect.height)
ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y + (node.rect.height * 2) / 3); ctx.lineTo(node.rect.x + (node.rect.width - node.rect.height / 2), node.rect.y + (node.rect.height * 2) / 3)
ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y + (node.rect.height * 2) / 3); ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y + (node.rect.height * 2) / 3)
ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y + node.rect.height); ctx.lineTo(node.rect.x + node.rect.height / 2, node.rect.y + node.rect.height)
ctx.closePath(); ctx.closePath();
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=arrow.js.map // # sourceMappingURL=arrow.js.map

View File

@@ -1,23 +1,23 @@
import { Rect } from '../../models/rect'; import { Rect } from '../../models/rect'
export function leftArrowIconRect(node) { export function leftArrowIconRect (node) {
node.iconRect = new Rect(0, 0, 0, 0); node.iconRect = new Rect(0, 0, 0, 0)
} }
export function leftArrowTextRect(node) { export function leftArrowTextRect (node) {
node.textRect = new Rect(node.rect.x + node.rect.height / 2, node.rect.y + node.rect.height / 3, node.rect.width - node.rect.height / 2, node.rect.height / 3); node.textRect = new Rect(node.rect.x + node.rect.height / 2, node.rect.y + node.rect.height / 3, node.rect.width - node.rect.height / 2, node.rect.height / 3)
node.fullTextRect = node.textRect; node.fullTextRect = node.textRect
} }
export function rightArrowIconRect(node) { export function rightArrowIconRect (node) {
node.iconRect = new Rect(0, 0, 0, 0); node.iconRect = new Rect(0, 0, 0, 0)
} }
export function rightArrowTextRect(node) { export function rightArrowTextRect (node) {
node.textRect = new Rect(node.rect.x, node.rect.y + node.rect.height / 3, node.rect.width - node.rect.height / 2, node.rect.height / 3); node.textRect = new Rect(node.rect.x, node.rect.y + node.rect.height / 3, node.rect.width - node.rect.height / 2, node.rect.height / 3)
node.fullTextRect = node.textRect; node.fullTextRect = node.textRect
} }
export function twowayArrowIconRect(node) { export function twowayArrowIconRect (node) {
node.iconRect = new Rect(0, 0, 0, 0); node.iconRect = new Rect(0, 0, 0, 0)
} }
export function twowayArrowTextRect(node) { export function twowayArrowTextRect (node) {
node.textRect = new Rect(node.rect.x + node.rect.height / 2, node.rect.y + node.rect.height / 3, node.rect.width - node.rect.height, node.rect.height / 3); node.textRect = new Rect(node.rect.x + node.rect.height / 2, node.rect.y + node.rect.height / 3, node.rect.width - node.rect.height, node.rect.height / 3)
node.fullTextRect = node.textRect; node.fullTextRect = node.textRect
} }
//# sourceMappingURL=arrow.rect.js.map // # sourceMappingURL=arrow.rect.js.map

View File

@@ -1,18 +1,18 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
export function circleAnchors(node) { export function circleAnchors (node) {
node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left)); node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left))
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up))
node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2, Direction.Right)); node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2, Direction.Right))
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height, Direction.Bottom)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height, Direction.Bottom))
for (var i = 5; i < 360; i += 5) { for (let i = 5; i < 360; i += 5) {
if (i % 90 === 0) { if (i % 90 === 0) {
continue; continue
}
var direction = Math.round(i / 90);
var pt = new Point(node.rect.center.x + (Math.sin((i / 180) * Math.PI) * node.rect.width) / 2, node.rect.center.y + (Math.cos((i / 180) * Math.PI) * node.rect.height) / 2, direction);
pt.hidden = true;
node.anchors.push(pt);
} }
const direction = Math.round(i / 90)
const pt = new Point(node.rect.center.x + (Math.sin((i / 180) * Math.PI) * node.rect.width) / 2, node.rect.center.y + (Math.cos((i / 180) * Math.PI) * node.rect.height) / 2, direction)
pt.hidden = true
node.anchors.push(pt)
}
} }
//# sourceMappingURL=circle.anchor.js.map // # sourceMappingURL=circle.anchor.js.map

View File

@@ -1,7 +1,7 @@
export function circle(ctx, node) { export function circle (ctx, node) {
ctx.beginPath(); ctx.beginPath()
ctx.ellipse(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height / 2, node.rect.width / 2, node.rect.height / 2, 0, 0, Math.PI * 2); ctx.ellipse(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height / 2, node.rect.width / 2, node.rect.height / 2, 0, 0, Math.PI * 2);
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=circle.js.map // # sourceMappingURL=circle.js.map

View File

@@ -1,27 +1,26 @@
import { Rect } from '../../models/rect'; import { Rect } from '../../models/rect'
export function circleIconRect(node) { export function circleIconRect (node) {
var w = node.rect.width / 2; let w = node.rect.width / 2
var h = node.rect.height / 2; let h = node.rect.height / 2
if (w > h) { if (w > h) {
w = h; w = h
} } else {
else { h = w
h = w; }
} let top = node.rect.height / 10
var top = node.rect.height / 10; if (top < 10) {
if (top < 10) { top = 10
top = 10; }
} node.iconRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + top, w, h)
node.iconRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + top, w, h);
} }
export function circleTextRect(node) { export function circleTextRect (node) {
var bottom = node.rect.height / 20; let bottom = node.rect.height / 20
if (bottom < 5) { if (bottom < 5) {
bottom = 0; bottom = 0
} }
node.textRect = new Rect(node.rect.x + node.rect.width / 4, node.rect.y + (node.rect.height * 2) / 3 - bottom, node.rect.width / 2, node.rect.height / 3 - 5); node.textRect = new Rect(node.rect.x + node.rect.width / 4, node.rect.y + (node.rect.height * 2) / 3 - bottom, node.rect.width / 2, node.rect.height / 3 - 5)
var w = (node.rect.width * 5) / 7; const w = (node.rect.width * 5) / 7
var h = (node.rect.height * 5) / 7; const h = (node.rect.height * 5) / 7
node.fullTextRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + (node.rect.height - h) / 2, w, h); node.fullTextRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + (node.rect.height - h) / 2, w, h)
} }
//# sourceMappingURL=circle.rect.js.map // # sourceMappingURL=circle.rect.js.map

View File

@@ -1,9 +1,9 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
export function cloudAnchors(node) { export function cloudAnchors (node) {
node.anchors.push(new Point(node.rect.x, node.rect.y + (node.rect.height * 3) / 5, Direction.Left)); node.anchors.push(new Point(node.rect.x, node.rect.y + (node.rect.height * 3) / 5, Direction.Left))
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height / 9, Direction.Up)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height / 9, Direction.Up))
node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + (node.rect.height * 3) / 5, Direction.Right)); node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + (node.rect.height * 3) / 5, Direction.Right))
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + (node.rect.height * 4) / 5, Direction.Bottom)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + (node.rect.height * 4) / 5, Direction.Bottom))
} }
//# sourceMappingURL=cloud.anchor.js.map // # sourceMappingURL=cloud.anchor.js.map

View File

@@ -1,11 +1,11 @@
export function cloud(ctx, node) { export function cloud (ctx, node) {
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x + node.rect.width / 5, node.rect.y + (node.rect.height * 13) / 16); ctx.moveTo(node.rect.x + node.rect.width / 5, node.rect.y + (node.rect.height * 13) / 16)
ctx.bezierCurveTo(node.rect.x - node.rect.width / 15, node.rect.y + (node.rect.height * 13) / 16, node.rect.x - node.rect.width / 15, node.rect.y + (node.rect.height * 7) / 16, node.rect.x + node.rect.width / 5, node.rect.y + (node.rect.height * 7) / 16); ctx.bezierCurveTo(node.rect.x - node.rect.width / 15, node.rect.y + (node.rect.height * 13) / 16, node.rect.x - node.rect.width / 15, node.rect.y + (node.rect.height * 7) / 16, node.rect.x + node.rect.width / 5, node.rect.y + (node.rect.height * 7) / 16)
ctx.bezierCurveTo(node.rect.x + node.rect.width / 5, node.rect.y, node.rect.x + (node.rect.width * 4) / 5, node.rect.y, node.rect.x + (node.rect.width * 4) / 5, node.rect.y + (node.rect.height * 7) / 16); ctx.bezierCurveTo(node.rect.x + node.rect.width / 5, node.rect.y, node.rect.x + (node.rect.width * 4) / 5, node.rect.y, node.rect.x + (node.rect.width * 4) / 5, node.rect.y + (node.rect.height * 7) / 16)
ctx.bezierCurveTo(node.rect.x + (node.rect.width * 16) / 15, node.rect.y + (node.rect.height * 7) / 16, node.rect.x + (node.rect.width * 16) / 15, node.rect.y + (node.rect.height * 13) / 16, node.rect.x + (node.rect.width * 4) / 5, node.rect.y + (node.rect.height * 13) / 16); ctx.bezierCurveTo(node.rect.x + (node.rect.width * 16) / 15, node.rect.y + (node.rect.height * 7) / 16, node.rect.x + (node.rect.width * 16) / 15, node.rect.y + (node.rect.height * 13) / 16, node.rect.x + (node.rect.width * 4) / 5, node.rect.y + (node.rect.height * 13) / 16)
ctx.closePath(); ctx.closePath();
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=cloud.js.map // # sourceMappingURL=cloud.js.map

View File

@@ -1,9 +1,9 @@
import { Rect } from '../../models/rect'; import { Rect } from '../../models/rect'
export function cloudIconRect(node) { export function cloudIconRect (node) {
node.iconRect = new Rect(0, 0, 0, 0); node.iconRect = new Rect(0, 0, 0, 0)
} }
export function cloudTextRect(node) { export function cloudTextRect (node) {
node.textRect = new Rect(node.rect.x + node.rect.width / 4, node.rect.y + node.rect.height / 4, node.rect.width / 2, (node.rect.height * 6) / 11); node.textRect = new Rect(node.rect.x + node.rect.width / 4, node.rect.y + node.rect.height / 4, node.rect.width / 2, (node.rect.height * 6) / 11)
node.fullTextRect = node.textRect; node.fullTextRect = node.textRect
} }
//# sourceMappingURL=cloud.rect.js.map // # sourceMappingURL=cloud.rect.js.map

View File

@@ -1,10 +1,10 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
export function cubeAnchors(node) { export function cubeAnchors (node) {
var offset = node.z * Math.sin((45 * Math.PI) / 180); const offset = node.z * Math.sin((45 * Math.PI) / 180)
node.anchors.push(new Point(node.rect.x, node.rect.ey - (node.rect.height - offset) / 2, Direction.Left)); node.anchors.push(new Point(node.rect.x, node.rect.ey - (node.rect.height - offset) / 2, Direction.Left))
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + offset / 2, Direction.Up)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + offset / 2, Direction.Up))
node.anchors.push(new Point(node.rect.ex - offset / 2, node.rect.y + node.rect.height / 2, Direction.Right)); node.anchors.push(new Point(node.rect.ex - offset / 2, node.rect.y + node.rect.height / 2, Direction.Right))
node.anchors.push(new Point(node.rect.x + (node.rect.width - offset) / 2, node.rect.y + node.rect.height, Direction.Bottom)); node.anchors.push(new Point(node.rect.x + (node.rect.width - offset) / 2, node.rect.y + node.rect.height, Direction.Bottom))
} }
//# sourceMappingURL=cube.anchor.js.map // # sourceMappingURL=cube.anchor.js.map

View File

@@ -1,5 +1,5 @@
import { Cube } from './cube.model'; import { Cube } from './cube.model'
export function cube(ctx, node) { export function cube (ctx, node) {
new Cube(node.rect, node.z, node.zRotate, node.fillStyle, node.strokeStyle).render(ctx); new Cube(node.rect, node.z, node.zRotate, node.fillStyle, node.strokeStyle).render(ctx)
} }
//# sourceMappingURL=cube.js.map // # sourceMappingURL=cube.js.map

View File

@@ -1,64 +1,63 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { pSBC } from '../../utils/math'; import { pSBC } from '../../utils/math'
var Surface = /** @class */ (function () { const Surface = /** @class */ (function () {
function Surface(pt1, pt2, pt3, pt4, fillStyle, strokeStyle) { function Surface (pt1, pt2, pt3, pt4, fillStyle, strokeStyle) {
if (fillStyle === void 0) { fillStyle = ''; } if (fillStyle === void 0) { fillStyle = '' }
if (strokeStyle === void 0) { strokeStyle = ''; } if (strokeStyle === void 0) { strokeStyle = '' }
this.points = []; this.points = []
this.fillStyle = ''; this.fillStyle = ''
this.strokeStyle = ''; this.strokeStyle = ''
this.points.push(pt1); this.points.push(pt1)
this.points.push(pt2); this.points.push(pt2)
this.points.push(pt3); this.points.push(pt3)
this.points.push(pt4); this.points.push(pt4)
this.fillStyle = fillStyle; this.fillStyle = fillStyle
this.strokeStyle = strokeStyle || fillStyle; this.strokeStyle = strokeStyle || fillStyle
}
Surface.prototype.render = function (ctx) {
ctx.save()
ctx.fillStyle = this.fillStyle
ctx.strokeStyle = this.strokeStyle
ctx.beginPath()
for (let i = 0; i < this.points.length; ++i) {
if (i) {
ctx.lineTo(this.points[i].x, this.points[i].y)
} else {
ctx.moveTo(this.points[i].x, this.points[i].y)
}
} }
Surface.prototype.render = function (ctx) { ctx.closePath()
ctx.save(); this.fillStyle && ctx.fill()
ctx.fillStyle = this.fillStyle; ctx.stroke()
ctx.strokeStyle = this.strokeStyle; ctx.restore()
ctx.beginPath(); }
for (var i = 0; i < this.points.length; ++i) { return Surface
if (i) { }())
ctx.lineTo(this.points[i].x, this.points[i].y); export { Surface }
} const Cube = /** @class */ (function () {
else { function Cube (rect, z, zRotate, fillStyle, strokeStyle) {
ctx.moveTo(this.points[i].x, this.points[i].y); if (fillStyle === void 0) { fillStyle = '#ddd' }
} if (strokeStyle === void 0) { strokeStyle = '#ccc' }
} this.surfaces = []
ctx.closePath(); const offset = z * Math.sin((45 * Math.PI) / 180)
this.fillStyle && ctx.fill(); const p1 = new Point(rect.x, rect.y + offset)
ctx.stroke(); const p2 = new Point(rect.ex - offset, rect.y + offset)
ctx.restore(); const p3 = new Point(rect.ex - offset, rect.ey)
}; const p4 = new Point(rect.x, rect.ey)
return Surface; // front
}()); this.surfaces.push(new Surface(p1, p2, p3, p4, fillStyle, strokeStyle))
export { Surface }; // up
var Cube = /** @class */ (function () { this.surfaces.push(new Surface(p1, new Point(rect.x + offset, rect.y), new Point(rect.ex, rect.y), p2, pSBC(0.5, fillStyle), strokeStyle))
function Cube(rect, z, zRotate, fillStyle, strokeStyle) { // right
if (fillStyle === void 0) { fillStyle = '#ddd'; } this.surfaces.push(new Surface(p2, new Point(rect.ex, rect.y), new Point(rect.ex, rect.ey - offset), p3, pSBC(0.6, fillStyle), strokeStyle))
if (strokeStyle === void 0) { strokeStyle = '#ccc'; } }
this.surfaces = []; Cube.prototype.render = function (ctx) {
var offset = z * Math.sin((45 * Math.PI) / 180); for (let _i = 0, _a = this.surfaces; _i < _a.length; _i++) {
var p1 = new Point(rect.x, rect.y + offset); const item = _a[_i]
var p2 = new Point(rect.ex - offset, rect.y + offset); item.render(ctx)
var p3 = new Point(rect.ex - offset, rect.ey);
var p4 = new Point(rect.x, rect.ey);
// front
this.surfaces.push(new Surface(p1, p2, p3, p4, fillStyle, strokeStyle));
// up
this.surfaces.push(new Surface(p1, new Point(rect.x + offset, rect.y), new Point(rect.ex, rect.y), p2, pSBC(0.5, fillStyle), strokeStyle));
// right
this.surfaces.push(new Surface(p2, new Point(rect.ex, rect.y), new Point(rect.ex, rect.ey - offset), p3, pSBC(0.6, fillStyle), strokeStyle));
} }
Cube.prototype.render = function (ctx) { }
for (var _i = 0, _a = this.surfaces; _i < _a.length; _i++) { return Cube
var item = _a[_i]; }())
item.render(ctx); export { Cube }
} // # sourceMappingURL=cube.model.js.map
};
return Cube;
}());
export { Cube };
//# sourceMappingURL=cube.model.js.map

View File

@@ -1,11 +1,11 @@
import { Rect } from '../../models/rect'; import { Rect } from '../../models/rect'
export function cubeIconRect(node) { export function cubeIconRect (node) {
node.fullIconRect = node.fullTextRect; node.fullIconRect = node.fullTextRect
node.iconRect = new Rect(node.fullIconRect.x, node.fullIconRect.y, node.fullIconRect.width, (node.fullIconRect.height * 2) / 3); node.iconRect = new Rect(node.fullIconRect.x, node.fullIconRect.y, node.fullIconRect.width, (node.fullIconRect.height * 2) / 3)
} }
export function cubeTextRect(node) { export function cubeTextRect (node) {
var offset = node.z * Math.sin((45 * Math.PI) / 180); const offset = node.z * Math.sin((45 * Math.PI) / 180)
node.fullTextRect = new Rect(node.rect.x, node.rect.y + offset, node.rect.width - offset, node.rect.height - offset); node.fullTextRect = new Rect(node.rect.x, node.rect.y + offset, node.rect.width - offset, node.rect.height - offset)
node.textRect = new Rect(node.fullTextRect.x + 10, node.fullTextRect.y + (node.fullTextRect.height * 2) / 3, node.fullTextRect.width - 20, node.fullTextRect.height / 3 - 5); node.textRect = new Rect(node.fullTextRect.x + 10, node.fullTextRect.y + (node.fullTextRect.height * 2) / 3, node.fullTextRect.width - 20, node.fullTextRect.height / 3 - 5)
} }
//# sourceMappingURL=cube.rect.js.map // # sourceMappingURL=cube.rect.js.map

View File

@@ -1,11 +1,11 @@
export function diamond(ctx, node) { export function diamond (ctx, node) {
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x + node.rect.width / 2, node.rect.y); ctx.moveTo(node.rect.x + node.rect.width / 2, node.rect.y)
ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2); ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2)
ctx.lineTo(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height); ctx.lineTo(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height)
ctx.lineTo(node.rect.x, node.rect.y + node.rect.height / 2); ctx.lineTo(node.rect.x, node.rect.y + node.rect.height / 2)
ctx.closePath(); ctx.closePath();
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=diamond.js.map // # sourceMappingURL=diamond.js.map

View File

@@ -1,27 +1,26 @@
import { Rect } from '../../models/rect'; import { Rect } from '../../models/rect'
export function diamondIconRect(node) { export function diamondIconRect (node) {
var w = node.rect.width / 3; let w = node.rect.width / 3
var h = node.rect.height / 3; let h = node.rect.height / 3
if (w > h) { if (w > h) {
w = h; w = h
} } else {
else { h = w
h = w; }
} let top = node.rect.width / 5
var top = node.rect.width / 5; if (top < 10) {
if (top < 10) { top = 10
top = 10; }
} node.iconRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + top, w, h)
node.iconRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + top, w, h);
} }
export function diamondTextRect(node) { export function diamondTextRect (node) {
var bottom = node.rect.height / 10; let bottom = node.rect.height / 10
if (bottom < 5) { if (bottom < 5) {
bottom = 0; bottom = 0
} }
node.textRect = new Rect(node.rect.x + node.rect.width / 3, node.rect.y + (node.rect.height * 2) / 3 - bottom, node.rect.width / 3, node.rect.height / 3 - 5); node.textRect = new Rect(node.rect.x + node.rect.width / 3, node.rect.y + (node.rect.height * 2) / 3 - bottom, node.rect.width / 3, node.rect.height / 3 - 5)
var w = node.rect.width / 2; const w = node.rect.width / 2
var h = (node.rect.height * 1) / 2; const h = (node.rect.height * 1) / 2
node.fullTextRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + node.rect.height / 4, w, h); node.fullTextRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + node.rect.height / 4, w, h)
} }
//# sourceMappingURL=diamond.rect.js.map // # sourceMappingURL=diamond.rect.js.map

View File

@@ -1,16 +1,16 @@
export function file(ctx, node) { export function file (ctx, node) {
ctx.beginPath(); ctx.beginPath()
var offsetX = node.rect.width / 6; const offsetX = node.rect.width / 6
ctx.moveTo(node.rect.x, node.rect.y); ctx.moveTo(node.rect.x, node.rect.y)
ctx.lineTo(node.rect.ex - offsetX, node.rect.y); ctx.lineTo(node.rect.ex - offsetX, node.rect.y)
ctx.lineTo(node.rect.ex, node.rect.y + offsetX); ctx.lineTo(node.rect.ex, node.rect.y + offsetX)
ctx.lineTo(node.rect.ex, node.rect.ey); ctx.lineTo(node.rect.ex, node.rect.ey)
ctx.lineTo(node.rect.x, node.rect.ey); ctx.lineTo(node.rect.x, node.rect.ey)
ctx.closePath(); ctx.closePath()
ctx.moveTo(node.rect.ex - offsetX, node.rect.y); ctx.moveTo(node.rect.ex - offsetX, node.rect.y)
ctx.lineTo(node.rect.ex - offsetX, node.rect.y + offsetX); ctx.lineTo(node.rect.ex - offsetX, node.rect.y + offsetX)
ctx.lineTo(node.rect.ex, node.rect.y + offsetX); ctx.lineTo(node.rect.ex, node.rect.y + offsetX);
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=file.js.map // # sourceMappingURL=file.js.map

View File

@@ -1,18 +1,17 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
export function graffitiAnchors(node) { export function graffitiAnchors (node) {
if (!node.points || !node.points.length) { if (!node.points || !node.points.length) {
return; return
} }
var pt1 = node.points[0]; const pt1 = node.points[0]
var pt2 = node.points[node.points.length - 1]; const pt2 = node.points[node.points.length - 1]
if (pt1.x < pt2.x) { if (pt1.x < pt2.x) {
node.anchors.push(new Point(pt1.x, pt1.y, Direction.Left)); node.anchors.push(new Point(pt1.x, pt1.y, Direction.Left))
node.anchors.push(new Point(pt2.x, pt2.y, Direction.Right)); node.anchors.push(new Point(pt2.x, pt2.y, Direction.Right))
} } else {
else { node.anchors.push(new Point(pt1.x, pt1.y, Direction.Right))
node.anchors.push(new Point(pt1.x, pt1.y, Direction.Right)); node.anchors.push(new Point(pt2.x, pt2.y, Direction.Left))
node.anchors.push(new Point(pt2.x, pt2.y, Direction.Left)); }
}
} }
//# sourceMappingURL=graffiti.anchor.js.map // # sourceMappingURL=graffiti.anchor.js.map

View File

@@ -1,14 +1,14 @@
export function graffiti(ctx, node) { export function graffiti (ctx, node) {
if (!node.points || !node.points[0]) { if (!node.points || !node.points[0]) {
return; return
} }
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.points[0].x, node.points[0].y); ctx.moveTo(node.points[0].x, node.points[0].y)
node.points.forEach(function (pt) { node.points.forEach(function (pt) {
ctx.lineTo(pt.x, pt.y); ctx.lineTo(pt.x, pt.y)
}); })
node['closePath'] && !node['doing'] && ctx.closePath(); node.closePath && !node.doing && ctx.closePath();
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=graffiti.js.map // # sourceMappingURL=graffiti.js.map

View File

@@ -1,21 +1,21 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
export function hexagonAnchors(node) { export function hexagonAnchors (node) {
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up))
node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2, Direction.Right)); node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2, Direction.Right))
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height, Direction.Bottom)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height, Direction.Bottom))
node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left)); node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left))
var ptLT = new Point(node.rect.x + node.rect.width / 10, node.rect.y + node.rect.height / 4, Direction.Left); const ptLT = new Point(node.rect.x + node.rect.width / 10, node.rect.y + node.rect.height / 4, Direction.Left)
ptLT.hidden = true; ptLT.hidden = true
node.anchors.push(ptLT); node.anchors.push(ptLT)
var ptRT = new Point(node.rect.x + node.rect.width / 10, node.rect.y + (node.rect.height * 3) / 4, Direction.Left); const ptRT = new Point(node.rect.x + node.rect.width / 10, node.rect.y + (node.rect.height * 3) / 4, Direction.Left)
ptRT.hidden = true; ptRT.hidden = true
node.anchors.push(ptRT); node.anchors.push(ptRT)
var ptLB = new Point(node.rect.x + (node.rect.width * 9) / 10, node.rect.y + node.rect.height / 4, Direction.Right); const ptLB = new Point(node.rect.x + (node.rect.width * 9) / 10, node.rect.y + node.rect.height / 4, Direction.Right)
ptLB.hidden = true; ptLB.hidden = true
node.anchors.push(ptLB); node.anchors.push(ptLB)
var ptRB = new Point(node.rect.x + (node.rect.width * 9) / 10, node.rect.y + (node.rect.height * 3) / 4, Direction.Right); const ptRB = new Point(node.rect.x + (node.rect.width * 9) / 10, node.rect.y + (node.rect.height * 3) / 4, Direction.Right)
ptRB.hidden = true; ptRB.hidden = true
node.anchors.push(ptRB); node.anchors.push(ptRB)
} }
//# sourceMappingURL=hexagon.anchor.js.map // # sourceMappingURL=hexagon.anchor.js.map

View File

@@ -1,14 +1,14 @@
export function hexagon(ctx, node) { export function hexagon (ctx, node) {
ctx.beginPath(); ctx.beginPath()
var pos = node.rect.width / 5; const pos = node.rect.width / 5
ctx.moveTo(node.rect.x + pos, node.rect.y); ctx.moveTo(node.rect.x + pos, node.rect.y)
ctx.lineTo(node.rect.x + node.rect.width - pos, node.rect.y); ctx.lineTo(node.rect.x + node.rect.width - pos, node.rect.y)
ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2); ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2)
ctx.lineTo(node.rect.x + node.rect.width - pos, node.rect.y + node.rect.height); ctx.lineTo(node.rect.x + node.rect.width - pos, node.rect.y + node.rect.height)
ctx.lineTo(node.rect.x + pos, node.rect.y + node.rect.height); ctx.lineTo(node.rect.x + pos, node.rect.y + node.rect.height)
ctx.lineTo(node.rect.x, node.rect.y + node.rect.height / 2); ctx.lineTo(node.rect.x, node.rect.y + node.rect.height / 2)
ctx.closePath(); ctx.closePath();
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=hexagon.js.map // # sourceMappingURL=hexagon.js.map

View File

@@ -1,14 +1,14 @@
import { Rect } from '../../models/rect'; import { Rect } from '../../models/rect'
export function hexagonIconRect(node) { export function hexagonIconRect (node) {
var w = (node.rect.width * 3) / 5; const w = (node.rect.width * 3) / 5
var h = (node.rect.height * 3) / 4; const h = (node.rect.height * 3) / 4
node.iconRect = new Rect(node.rect.x + node.rect.width / 5 + node.paddingLeftNum, node.rect.y + node.paddingTopNum, w - node.paddingLeftNum - node.paddingRightNum, h - node.paddingTopNum - node.paddingBottomNum); node.iconRect = new Rect(node.rect.x + node.rect.width / 5 + node.paddingLeftNum, node.rect.y + node.paddingTopNum, w - node.paddingLeftNum - node.paddingRightNum, h - node.paddingTopNum - node.paddingBottomNum)
node.fullIconRect = new Rect(node.rect.x + node.rect.width / 5 + node.paddingLeftNum, node.rect.y + node.paddingTopNum, w - node.paddingLeftNum - node.paddingRightNum, node.rect.height - node.paddingTopNum - node.paddingBottomNum); node.fullIconRect = new Rect(node.rect.x + node.rect.width / 5 + node.paddingLeftNum, node.rect.y + node.paddingTopNum, w - node.paddingLeftNum - node.paddingRightNum, node.rect.height - node.paddingTopNum - node.paddingBottomNum)
} }
export function hexagonTextRect(node) { export function hexagonTextRect (node) {
var w = (node.rect.width * 3) / 5; const w = (node.rect.width * 3) / 5
var h = node.rect.height / 4; const h = node.rect.height / 4
node.textRect = new Rect(node.rect.x + node.rect.width / 5 + node.paddingLeftNum, node.rect.y + node.rect.height - h + node.paddingTopNum, w - node.paddingLeftNum - node.paddingRightNum, h); node.textRect = new Rect(node.rect.x + node.rect.width / 5 + node.paddingLeftNum, node.rect.y + node.rect.height - h + node.paddingTopNum, w - node.paddingLeftNum - node.paddingRightNum, h)
node.fullTextRect = new Rect(node.rect.x + node.rect.width / 5 + node.paddingLeftNum, node.rect.y + node.paddingTopNum, w - node.paddingLeftNum - node.paddingRightNum, node.rect.height - node.paddingTopNum - node.paddingBottomNum); node.fullTextRect = new Rect(node.rect.x + node.rect.width / 5 + node.paddingLeftNum, node.rect.y + node.paddingTopNum, w - node.paddingLeftNum - node.paddingRightNum, node.rect.height - node.paddingTopNum - node.paddingBottomNum)
} }
//# sourceMappingURL=hexagon.rect.js.map // # sourceMappingURL=hexagon.rect.js.map

View File

@@ -1,19 +1,18 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
export function imageAnchors(node) { export function imageAnchors (node) {
var textWidth = 0; let textWidth = 0
var textHeight = 0; let textHeight = 0
if (node.text) { if (node.text) {
if (node.paddingRightNum) { if (node.paddingRightNum) {
textWidth = node.paddingRightNum; textWidth = node.paddingRightNum
} } else {
else { textHeight = node.paddingBottomNum || node.lineHeight * node.fontSize * (node.textMaxLine || 1)
textHeight = node.paddingBottomNum || node.lineHeight * node.fontSize * (node.textMaxLine || 1);
}
} }
node.anchors.push(new Point(node.rect.x, node.rect.y + (node.rect.height - textHeight) / 2, Direction.Left)); }
node.anchors.push(new Point(node.rect.x + (node.rect.width - textWidth) / 2, node.rect.y, Direction.Up)); node.anchors.push(new Point(node.rect.x, node.rect.y + (node.rect.height - textHeight) / 2, Direction.Left))
node.anchors.push(new Point(node.rect.x + node.rect.width - textWidth, node.rect.y + (node.rect.height - textHeight) / 2, Direction.Right)); node.anchors.push(new Point(node.rect.x + (node.rect.width - textWidth) / 2, node.rect.y, Direction.Up))
node.anchors.push(new Point(node.rect.x + (node.rect.width - textWidth) / 2, node.rect.y + node.rect.height - textHeight, Direction.Bottom)); node.anchors.push(new Point(node.rect.x + node.rect.width - textWidth, node.rect.y + (node.rect.height - textHeight) / 2, Direction.Right))
node.anchors.push(new Point(node.rect.x + (node.rect.width - textWidth) / 2, node.rect.y + node.rect.height - textHeight, Direction.Bottom))
} }
//# sourceMappingURL=image.anchor.js.map // # sourceMappingURL=image.anchor.js.map

View File

@@ -1,27 +1,25 @@
import { Rect } from '../../models/rect'; import { Rect } from '../../models/rect'
export function imageIconRect(node) { export function imageIconRect (node) {
var textWidth = 0; let textWidth = 0
var textHeight = 0; let textHeight = 0
if (node.text) { if (node.text) {
if (node.paddingRightNum) {
textWidth = node.paddingRightNum;
}
else {
textHeight = node.paddingBottomNum || node.lineHeight * node.fontSize * (node.textMaxLine || 1);
}
}
node.iconRect = new Rect(node.rect.x, node.rect.y, node.rect.width - textWidth, node.rect.height - textHeight);
node.fullIconRect = node.rect;
}
export function imageTextRect(node) {
if (node.paddingRightNum) { if (node.paddingRightNum) {
var width = node.paddingRightNum - 5; textWidth = node.paddingRightNum
node.textRect = new Rect(node.rect.x + node.rect.width - width, node.rect.y, width, node.rect.height - node.textOffsetY * 2); } else {
textHeight = node.paddingBottomNum || node.lineHeight * node.fontSize * (node.textMaxLine || 1)
} }
else { }
var height = node.paddingBottomNum || node.lineHeight * node.fontSize * (node.textMaxLine || 1); node.iconRect = new Rect(node.rect.x, node.rect.y, node.rect.width - textWidth, node.rect.height - textHeight)
node.textRect = new Rect(node.rect.x, node.rect.y + node.rect.height - height, node.rect.width - node.textOffsetX * 2, height); node.fullIconRect = node.rect
}
node.fullTextRect = node.rect;
} }
//# sourceMappingURL=image.rect.js.map export function imageTextRect (node) {
if (node.paddingRightNum) {
const width = node.paddingRightNum - 5
node.textRect = new Rect(node.rect.x + node.rect.width - width, node.rect.y, width, node.rect.height - node.textOffsetY * 2)
} else {
const height = node.paddingBottomNum || node.lineHeight * node.fontSize * (node.textMaxLine || 1)
node.textRect = new Rect(node.rect.x, node.rect.y + node.rect.height - height, node.rect.width - node.textOffsetX * 2, height)
}
node.fullTextRect = node.rect
}
// # sourceMappingURL=image.rect.js.map

View File

@@ -1,14 +1,14 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
export function lineAnchors(node) { export function lineAnchors (node) {
var y = node.rect.y + node.rect.height / 2; const y = node.rect.y + node.rect.height / 2
node.anchors.push(new Point(node.rect.x, y, Direction.Left)); node.anchors.push(new Point(node.rect.x, y, Direction.Left))
node.anchors.push(new Point(node.rect.x + node.rect.width, y, Direction.Right)); node.anchors.push(new Point(node.rect.x + node.rect.width, y, Direction.Right))
var scale = topology.data.scale || 1; // 取全局的 scale 属性 const scale = topology.data.scale || 1 // 取全局的 scale 属性
for (var i = node.rect.x + 5 * scale; i < node.rect.ex; i += 5 * scale) { for (let i = node.rect.x + 5 * scale; i < node.rect.ex; i += 5 * scale) {
var pt = new Point(i, y, Direction.Bottom); const pt = new Point(i, y, Direction.Bottom)
pt.hidden = true; pt.hidden = true
node.anchors.push(pt); node.anchors.push(pt)
} }
} }
//# sourceMappingURL=line.anchor.js.map // # sourceMappingURL=line.anchor.js.map

View File

@@ -1,8 +1,8 @@
export function line(ctx, node) { export function line (ctx, node) {
ctx.beginPath(); ctx.beginPath()
var y = node.rect.y + node.rect.height / 2; const y = node.rect.y + node.rect.height / 2
ctx.moveTo(node.rect.x, y); ctx.moveTo(node.rect.x, y)
ctx.lineTo(node.rect.x + node.rect.width, y); ctx.lineTo(node.rect.x + node.rect.width, y)
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=line.js.map // # sourceMappingURL=line.js.map

View File

@@ -1,9 +1,9 @@
import { Rect } from '../../models/rect'; import { Rect } from '../../models/rect'
export function lineIconRect(node) { export function lineIconRect (node) {
node.iconRect = new Rect(0, 0, 0, 0); node.iconRect = new Rect(0, 0, 0, 0)
} }
export function lineTextRect(node) { export function lineTextRect (node) {
node.fullTextRect = new Rect(node.rect.x + 10, node.rect.y + node.rect.height / 2 - 20, node.rect.width - 20, 20); node.fullTextRect = new Rect(node.rect.x + 10, node.rect.y + node.rect.height / 2 - 20, node.rect.width - 20, 20)
node.textRect = node.fullTextRect; node.textRect = node.fullTextRect
} }
//# sourceMappingURL=line.rect.js.map // # sourceMappingURL=line.rect.js.map

View File

@@ -1,27 +1,25 @@
export function lines(ctx, node) { export function lines (ctx, node) {
if (!node.points || !node.points[1]) { if (!node.points || !node.points[1]) {
return; return
}
ctx.beginPath()
ctx.moveTo(node.points[0].x, node.points[0].y)
for (let i = 1; i < node.points.length;) {
// curve 控制点
if (node.points[i].data) {
if (node.points[i + 2]) {
ctx.bezierCurveTo(node.points[i].x, node.points[i].y, node.points[i + 1].x, node.points[i + 1].y, node.points[i + 2].x, node.points[i + 2].y)
i += 2
} else {
break
}
} else {
ctx.lineTo(node.points[i].x, node.points[i].y)
++i
} }
ctx.beginPath(); }
ctx.moveTo(node.points[0].x, node.points[0].y); node.closePath && !node.doing && ctx.closePath();
for (var i = 1; i < node.points.length;) { (node.fillStyle || node.bkType) && ctx.fill()
// curve 控制点 ctx.stroke()
if (node.points[i].data) {
if (node.points[i + 2]) {
ctx.bezierCurveTo(node.points[i].x, node.points[i].y, node.points[i + 1].x, node.points[i + 1].y, node.points[i + 2].x, node.points[i + 2].y);
i += 2;
}
else {
break;
}
}
else {
ctx.lineTo(node.points[i].x, node.points[i].y);
++i;
}
}
node['closePath'] && !node['doing'] && ctx.closePath();
(node.fillStyle || node.bkType) && ctx.fill();
ctx.stroke();
} }
//# sourceMappingURL=lines.js.map // # sourceMappingURL=lines.js.map

View File

@@ -1,9 +1,9 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
export function messageAnchors(node) { export function messageAnchors (node) {
node.anchors.push(new Point(node.rect.x, node.rect.y + (node.rect.height * 3) / 8, Direction.Left)); node.anchors.push(new Point(node.rect.x, node.rect.y + (node.rect.height * 3) / 8, Direction.Left))
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up))
node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + (node.rect.height * 3) / 8, Direction.Right)); node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + (node.rect.height * 3) / 8, Direction.Right))
node.anchors.push(new Point(node.rect.x + node.rect.width / 4, node.rect.ey, Direction.Bottom)); node.anchors.push(new Point(node.rect.x + node.rect.width / 4, node.rect.ey, Direction.Bottom))
} }
//# sourceMappingURL=message.anchor.js.map // # sourceMappingURL=message.anchor.js.map

View File

@@ -1,14 +1,14 @@
export function message(ctx, node) { export function message (ctx, node) {
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x, node.rect.y); ctx.moveTo(node.rect.x, node.rect.y)
ctx.lineTo(node.rect.x + node.rect.width, node.rect.y); ctx.lineTo(node.rect.x + node.rect.width, node.rect.y)
ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + (node.rect.height * 3) / 4); ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + (node.rect.height * 3) / 4)
ctx.lineTo(node.rect.x + (node.rect.width * 8) / 16, node.rect.y + (node.rect.height * 3) / 4); ctx.lineTo(node.rect.x + (node.rect.width * 8) / 16, node.rect.y + (node.rect.height * 3) / 4)
ctx.lineTo(node.rect.x + node.rect.width / 4, node.rect.ey); ctx.lineTo(node.rect.x + node.rect.width / 4, node.rect.ey)
ctx.lineTo(node.rect.x + (node.rect.width * 5) / 16, node.rect.y + (node.rect.height * 3) / 4); ctx.lineTo(node.rect.x + (node.rect.width * 5) / 16, node.rect.y + (node.rect.height * 3) / 4)
ctx.lineTo(node.rect.x, node.rect.y + (node.rect.height * 3) / 4); ctx.lineTo(node.rect.x, node.rect.y + (node.rect.height * 3) / 4)
ctx.closePath(); ctx.closePath();
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=message.js.map // # sourceMappingURL=message.js.map

View File

@@ -1,10 +1,10 @@
import { Rect } from '../../models/rect'; import { Rect } from '../../models/rect'
export function messageIconRect(node) { export function messageIconRect (node) {
node.iconRect = new Rect(0, 0, 0, 0); node.iconRect = new Rect(0, 0, 0, 0)
node.fullIconRect = node.iconRect; node.fullIconRect = node.iconRect
} }
export function messageTextRect(node) { export function messageTextRect (node) {
node.textRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, (node.rect.height * 3) / 4 - node.paddingTopNum - node.paddingBottomNum); node.textRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, (node.rect.height * 3) / 4 - node.paddingTopNum - node.paddingBottomNum)
node.fullTextRect = node.textRect; node.fullTextRect = node.textRect
} }
//# sourceMappingURL=message.rect.js.map // # sourceMappingURL=message.rect.js.map

View File

@@ -1,6 +1,6 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
export function mindLineAnchors(node) { export function mindLineAnchors (node) {
node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height, 4)); node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height, 4))
node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + node.rect.height, 2)); node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + node.rect.height, 2))
} }
//# sourceMappingURL=mindLine.anchor.js.map // # sourceMappingURL=mindLine.anchor.js.map

View File

@@ -1,8 +1,8 @@
export function mindLine(ctx, node) { export function mindLine (ctx, node) {
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x, node.rect.y + node.rect.height); ctx.moveTo(node.rect.x, node.rect.y + node.rect.height)
ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height); ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height)
ctx.closePath(); ctx.closePath()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=mindLine.js.map // # sourceMappingURL=mindLine.js.map

View File

@@ -1,94 +1,90 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
export function mindNodeAnchors(node) { export function mindNodeAnchors (node) {
var r = borderRadius(node); const r = borderRadius(node)
// 上四 // 上四
var topN = 5; // 上方节点个数,控制位置,实际节点数依然是 4 个 const topN = 5 // 上方节点个数,控制位置,实际节点数依然是 4 个
for (var i = 0; i < topN; i++) { for (var i = 0; i < topN; i++) {
if (i === 2) { if (i === 2) {
continue; continue
}
var x = node.rect.x + (node.rect.width * (i + 1)) / (topN + 1);
var y = node.rect.y;
if (x < node.rect.x + r) {
// 在左侧圆角
y = getYByCircle(node.rect.x + r, y + r, x, r, -1);
}
else if (x > node.rect.x + node.rect.width - r) {
// 在右侧圆角
y = getYByCircle(node.rect.x + node.rect.width - r, y + r, x, r, -1);
}
node.anchors.push(new Point(x, y, Direction.Up));
} }
// 右三 var x = node.rect.x + (node.rect.width * (i + 1)) / (topN + 1)
var rightN = 3; // 右侧节点数 var y = node.rect.y
for (var i = 0; i < rightN; i++) { if (x < node.rect.x + r) {
var y = node.rect.y + (node.rect.height * (i + 1)) / (rightN + 1); // 在左侧圆角
var x = node.rect.x + node.rect.width; y = getYByCircle(node.rect.x + r, y + r, x, r, -1)
if (y < node.rect.y + r) { } else if (x > node.rect.x + node.rect.width - r) {
// 在侧圆角以内 // 在侧圆角
x = getXByCircle(x - r, node.rect.y + r, y, r); y = getYByCircle(node.rect.x + node.rect.width - r, y + r, x, r, -1)
}
else if (y > node.rect.y + node.rect.height - r) {
// 下侧圆角
x = getXByCircle(x - r, node.rect.y + node.rect.height - r, y, r);
}
node.anchors.push(new Point(x, y, Direction.Right));
} }
// 下四 node.anchors.push(new Point(x, y, Direction.Up))
var bottomN = 5; // 下侧节点数 }
for (var i = 0; i < bottomN; i++) { // 右三
if (i === 2) { const rightN = 3 // 右侧节点数
continue; for (var i = 0; i < rightN; i++) {
} var y = node.rect.y + (node.rect.height * (i + 1)) / (rightN + 1)
var x = node.rect.x + (node.rect.width * (i + 1)) / (bottomN + 1); var x = node.rect.x + node.rect.width
var y = node.rect.y + node.rect.height; if (y < node.rect.y + r) {
if (x < node.rect.x + r) { // 在上侧圆角以内
// 在左侧圆角 x = getXByCircle(x - r, node.rect.y + r, y, r)
y = getYByCircle(node.rect.x + r, y - r, x, r); } else if (y > node.rect.y + node.rect.height - r) {
} // 下侧圆角
else if (x > node.rect.x + node.rect.width - r) { x = getXByCircle(x - r, node.rect.y + node.rect.height - r, y, r)
// 在右侧圆角
y = getYByCircle(node.rect.x + node.rect.width - r, y - r, x, r);
}
node.anchors.push(new Point(x, y, Direction.Bottom));
} }
// 左三 node.anchors.push(new Point(x, y, Direction.Right))
var leftN = 3; // 左侧节点数 }
for (var i = 0; i < leftN; i++) { // 下四
var y = node.rect.y + (node.rect.height * (i + 1)) / (leftN + 1); const bottomN = 5 // 下侧节点数
var x = node.rect.x; for (var i = 0; i < bottomN; i++) {
if (y < node.rect.y + r) { if (i === 2) {
// 在上侧圆角以内 continue
x = getXByCircle(x + r, node.rect.y + r, y, r, -1);
}
else if (y > node.rect.y + node.rect.height - r) {
// 下侧圆角
x = getXByCircle(x + r, node.rect.y + node.rect.height - r, y, r, -1);
}
node.anchors.push(new Point(x, y, Direction.Left));
} }
var x = node.rect.x + (node.rect.width * (i + 1)) / (bottomN + 1)
var y = node.rect.y + node.rect.height
if (x < node.rect.x + r) {
// 在左侧圆角
y = getYByCircle(node.rect.x + r, y - r, x, r)
} else if (x > node.rect.x + node.rect.width - r) {
// 在右侧圆角
y = getYByCircle(node.rect.x + node.rect.width - r, y - r, x, r)
}
node.anchors.push(new Point(x, y, Direction.Bottom))
}
// 左三
const leftN = 3 // 左侧节点数
for (var i = 0; i < leftN; i++) {
var y = node.rect.y + (node.rect.height * (i + 1)) / (leftN + 1)
var x = node.rect.x
if (y < node.rect.y + r) {
// 在上侧圆角以内
x = getXByCircle(x + r, node.rect.y + r, y, r, -1)
} else if (y > node.rect.y + node.rect.height - r) {
// 下侧圆角
x = getXByCircle(x + r, node.rect.y + node.rect.height - r, y, r, -1)
}
node.anchors.push(new Point(x, y, Direction.Left))
}
} }
/** /**
* 得到元素实际计算半径 * 得到元素实际计算半径
* @param node 元素 * @param node 元素
* @returns 元素实际半径 * @returns 元素实际半径
*/ */
function borderRadius(node) { function borderRadius (node) {
var wr = node.borderRadius; let wr = node.borderRadius
var hr = node.borderRadius; let hr = node.borderRadius
if (node.borderRadius < 1) { if (node.borderRadius < 1) {
wr = node.rect.width * node.borderRadius; wr = node.rect.width * node.borderRadius
hr = node.rect.height * node.borderRadius; hr = node.rect.height * node.borderRadius
} }
var r = wr < hr ? wr : hr; let r = wr < hr ? wr : hr
if (node.rect.width < 2 * r) { if (node.rect.width < 2 * r) {
r = node.rect.width / 2; r = node.rect.width / 2
} }
if (node.rect.height < 2 * r) { if (node.rect.height < 2 * r) {
r = node.rect.height / 2; r = node.rect.height / 2
} }
return r; return r
} }
/** /**
* 获取圆的 x 坐标 * 获取圆的 x 坐标
@@ -98,9 +94,9 @@ function borderRadius(node) {
* @param r 半径 * @param r 半径
* @param sqrt 点可能在左侧,左侧填-1右侧1默认值 * @param sqrt 点可能在左侧,左侧填-1右侧1默认值
*/ */
function getXByCircle(ox, oy, y, r, sqrt) { function getXByCircle (ox, oy, y, r, sqrt) {
if (sqrt === void 0) { sqrt = 1; } if (sqrt === void 0) { sqrt = 1 }
return sqrt * Math.sqrt(Math.pow(r, 2) - Math.pow((y - oy), 2)) + ox; return sqrt * Math.sqrt(Math.pow(r, 2) - Math.pow((y - oy), 2)) + ox
} }
/** /**
* 获取圆的 y 坐标 * 获取圆的 y 坐标
@@ -110,8 +106,8 @@ function getXByCircle(ox, oy, y, r, sqrt) {
* @param r 半径 * @param r 半径
* @param sqrt 点可以在上侧,也可能在下侧,上侧-1下侧1默认 * @param sqrt 点可以在上侧,也可能在下侧,上侧-1下侧1默认
*/ */
function getYByCircle(ox, oy, x, r, sqrt) { function getYByCircle (ox, oy, x, r, sqrt) {
if (sqrt === void 0) { sqrt = 1; } if (sqrt === void 0) { sqrt = 1 }
return sqrt * Math.sqrt(Math.pow(r, 2) - Math.pow((x - ox), 2)) + oy; return sqrt * Math.sqrt(Math.pow(r, 2) - Math.pow((x - ox), 2)) + oy
} }
//# sourceMappingURL=mindNode.anchor.js.map // # sourceMappingURL=mindNode.anchor.js.map

View File

@@ -1,10 +1,10 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
export function pentagonAnchors(node) { export function pentagonAnchors (node) {
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up))
node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + (node.rect.height * 2) / 5, Direction.Right)); node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + (node.rect.height * 2) / 5, Direction.Right))
node.anchors.push(new Point(node.rect.x + (node.rect.width * 4) / 5, node.rect.y + node.rect.height, Direction.Bottom)); node.anchors.push(new Point(node.rect.x + (node.rect.width * 4) / 5, node.rect.y + node.rect.height, Direction.Bottom))
node.anchors.push(new Point(node.rect.x + node.rect.width / 5, node.rect.y + node.rect.height, Direction.Bottom)); node.anchors.push(new Point(node.rect.x + node.rect.width / 5, node.rect.y + node.rect.height, Direction.Bottom))
node.anchors.push(new Point(node.rect.x, node.rect.y + (node.rect.height * 2) / 5, Direction.Left)); node.anchors.push(new Point(node.rect.x, node.rect.y + (node.rect.height * 2) / 5, Direction.Left))
} }
//# sourceMappingURL=pentagon.anchor.js.map // # sourceMappingURL=pentagon.anchor.js.map

View File

@@ -1,12 +1,12 @@
export function pentagon(ctx, node) { export function pentagon (ctx, node) {
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x + node.rect.width / 2, node.rect.y); ctx.moveTo(node.rect.x + node.rect.width / 2, node.rect.y)
ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + (node.rect.height * 2) / 5); ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + (node.rect.height * 2) / 5)
ctx.lineTo(node.rect.x + (node.rect.width * 4) / 5, node.rect.y + node.rect.height); ctx.lineTo(node.rect.x + (node.rect.width * 4) / 5, node.rect.y + node.rect.height)
ctx.lineTo(node.rect.x + node.rect.width / 5, node.rect.y + node.rect.height); ctx.lineTo(node.rect.x + node.rect.width / 5, node.rect.y + node.rect.height)
ctx.lineTo(node.rect.x, node.rect.y + (node.rect.height * 2) / 5); ctx.lineTo(node.rect.x, node.rect.y + (node.rect.height * 2) / 5)
ctx.closePath(); ctx.closePath();
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=pentagon.js.map // # sourceMappingURL=pentagon.js.map

View File

@@ -1,23 +1,22 @@
import { Rect } from '../../models/rect'; import { Rect } from '../../models/rect'
export function pentagonIconRect(node) { export function pentagonIconRect (node) {
var w = node.rect.width / 2; let w = node.rect.width / 2
var h = node.rect.height / 2; let h = node.rect.height / 2
if (w > h) { if (w > h) {
w = h; w = h
} } else {
else { h = w
h = w; }
} let top = node.rect.height / 7
var top = node.rect.height / 7; if (top < 10) {
if (top < 10) { top = 10
top = 10; }
} node.iconRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + top, w, h)
node.iconRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + top, w, h);
} }
export function pentagonTextRect(node) { export function pentagonTextRect (node) {
node.textRect = new Rect(node.rect.x + node.rect.width / 5, node.rect.y + (node.rect.height * 5) / 7, (node.rect.width * 3) / 5, node.rect.height / 4); node.textRect = new Rect(node.rect.x + node.rect.width / 5, node.rect.y + (node.rect.height * 5) / 7, (node.rect.width * 3) / 5, node.rect.height / 4)
var w = (node.rect.width * 3) / 5; const w = (node.rect.width * 3) / 5
var h = (node.rect.height * 3) / 5; const h = (node.rect.height * 3) / 5
node.fullTextRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + node.rect.height / 4, w, h); node.fullTextRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + node.rect.height / 4, w, h)
} }
//# sourceMappingURL=pentagon.rect.js.map // # sourceMappingURL=pentagon.rect.js.map

View File

@@ -1,10 +1,10 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
export function pentagramAnchors(node) { export function pentagramAnchors (node) {
node.anchors.push(new Point((Math.cos((18 / 180) * Math.PI) * node.rect.width) / 2 + node.rect.x + node.rect.width / 2, (-Math.sin((18 / 180) * Math.PI) * node.rect.width) / 2 + node.rect.y + node.rect.height / 2, Direction.Right)); node.anchors.push(new Point((Math.cos((18 / 180) * Math.PI) * node.rect.width) / 2 + node.rect.x + node.rect.width / 2, (-Math.sin((18 / 180) * Math.PI) * node.rect.width) / 2 + node.rect.y + node.rect.height / 2, Direction.Right))
node.anchors.push(new Point((Math.cos(((18 + 72) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.x + node.rect.width / 2, (-Math.sin(((18 + 72) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.y + node.rect.height / 2, Direction.Up)); node.anchors.push(new Point((Math.cos(((18 + 72) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.x + node.rect.width / 2, (-Math.sin(((18 + 72) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.y + node.rect.height / 2, Direction.Up))
node.anchors.push(new Point((Math.cos(((18 + 72 * 2) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.x + node.rect.width / 2, (-Math.sin(((18 + 72 * 2) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.y + node.rect.height / 2, Direction.Left)); node.anchors.push(new Point((Math.cos(((18 + 72 * 2) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.x + node.rect.width / 2, (-Math.sin(((18 + 72 * 2) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.y + node.rect.height / 2, Direction.Left))
node.anchors.push(new Point((Math.cos(((18 + 72 * 3) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.x + node.rect.width / 2, (-Math.sin(((18 + 72 * 3) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.y + node.rect.height / 2, Direction.Bottom)); node.anchors.push(new Point((Math.cos(((18 + 72 * 3) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.x + node.rect.width / 2, (-Math.sin(((18 + 72 * 3) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.y + node.rect.height / 2, Direction.Bottom))
node.anchors.push(new Point((Math.cos(((18 + 72 * 4) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.x + node.rect.width / 2, (-Math.sin(((18 + 72 * 4) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.y + node.rect.height / 2, Direction.Bottom)); node.anchors.push(new Point((Math.cos(((18 + 72 * 4) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.x + node.rect.width / 2, (-Math.sin(((18 + 72 * 4) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.y + node.rect.height / 2, Direction.Bottom))
} }
//# sourceMappingURL=pentagram.anchor.js.map // # sourceMappingURL=pentagram.anchor.js.map

View File

@@ -1,11 +1,11 @@
export function pentagram(ctx, node) { export function pentagram (ctx, node) {
ctx.beginPath(); ctx.beginPath()
for (var i = 0; i < 5; ++i) { for (let i = 0; i < 5; ++i) {
ctx.lineTo((Math.cos(((18 + 72 * i) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.x + node.rect.width / 2, (-Math.sin(((18 + 72 * i) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.y + node.rect.height / 2); ctx.lineTo((Math.cos(((18 + 72 * i) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.x + node.rect.width / 2, (-Math.sin(((18 + 72 * i) / 180) * Math.PI) * node.rect.width) / 2 + node.rect.y + node.rect.height / 2)
ctx.lineTo((Math.cos(((54 + 72 * i) / 180) * Math.PI) * node.rect.width) / 4 + node.rect.x + node.rect.width / 2, (-Math.sin(((54 + 72 * i) / 180) * Math.PI) * node.rect.width) / 4 + node.rect.y + node.rect.height / 2); ctx.lineTo((Math.cos(((54 + 72 * i) / 180) * Math.PI) * node.rect.width) / 4 + node.rect.x + node.rect.width / 2, (-Math.sin(((54 + 72 * i) / 180) * Math.PI) * node.rect.width) / 4 + node.rect.y + node.rect.height / 2)
} }
ctx.closePath(); ctx.closePath();
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=pentagram.js.map // # sourceMappingURL=pentagram.js.map

View File

@@ -1,11 +1,11 @@
import { Rect } from '../../models/rect'; import { Rect } from '../../models/rect'
export function pentagramIconRect(node) { export function pentagramIconRect (node) {
node.iconRect = new Rect(0, 0, 0, 0); node.iconRect = new Rect(0, 0, 0, 0)
} }
export function pentagramTextRect(node) { export function pentagramTextRect (node) {
var w = (node.rect.width * 2) / 5; const w = (node.rect.width * 2) / 5
var h = (node.rect.height * 2) / 5; const h = (node.rect.height * 2) / 5
node.fullTextRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + (node.rect.height - h) / 2, w, h); node.fullTextRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + (node.rect.height - h) / 2, w, h)
node.textRect = node.fullTextRect; node.textRect = node.fullTextRect
} }
//# sourceMappingURL=pentagram.rect.js.map // # sourceMappingURL=pentagram.rect.js.map

View File

@@ -1,17 +1,17 @@
export function people(ctx, node) { export function people (ctx, node) {
ctx.beginPath(); ctx.beginPath()
var r = node.rect.width / 4; const r = node.rect.width / 4
var middle = node.rect.x + node.rect.width / 2; const middle = node.rect.x + node.rect.width / 2
ctx.arc(middle, node.rect.y + r, r, 0, Math.PI * 2); ctx.arc(middle, node.rect.y + r, r, 0, Math.PI * 2)
ctx.moveTo(node.rect.x, node.rect.y + r * 3); ctx.moveTo(node.rect.x, node.rect.y + r * 3)
ctx.lineTo(node.rect.ex, node.rect.y + r * 3); ctx.lineTo(node.rect.ex, node.rect.y + r * 3)
ctx.moveTo(middle, node.rect.y + r * 2); ctx.moveTo(middle, node.rect.y + r * 2)
ctx.lineTo(middle, node.rect.y + r * 4); ctx.lineTo(middle, node.rect.y + r * 4)
ctx.moveTo(middle, node.rect.y + r * 4); ctx.moveTo(middle, node.rect.y + r * 4)
ctx.lineTo(node.rect.x, node.rect.ey); ctx.lineTo(node.rect.x, node.rect.ey)
ctx.moveTo(middle, node.rect.y + r * 4); ctx.moveTo(middle, node.rect.y + r * 4)
ctx.lineTo(node.rect.ex, node.rect.ey); ctx.lineTo(node.rect.ex, node.rect.ey);
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=people.js.map // # sourceMappingURL=people.js.map

View File

@@ -1,9 +1,9 @@
import { Rect } from '../../models/rect'; import { Rect } from '../../models/rect'
export function peopleIconRect(node) { export function peopleIconRect (node) {
node.iconRect = new Rect(0, 0, 0, 0); node.iconRect = new Rect(0, 0, 0, 0)
} }
export function peopleTextRect(node) { export function peopleTextRect (node) {
node.textRect = undefined; node.textRect = undefined
node.fullTextRect = node.textRect; node.fullTextRect = node.textRect
} }
//# sourceMappingURL=people.rect.js.map // # sourceMappingURL=people.rect.js.map

View File

@@ -1,25 +1,25 @@
export function rectangle(ctx, node) { export function rectangle (ctx, node) {
var wr = node.borderRadius; let wr = node.borderRadius
var hr = node.borderRadius; let hr = node.borderRadius
if (node.borderRadius < 1) { if (node.borderRadius < 1) {
wr = node.rect.width * node.borderRadius; wr = node.rect.width * node.borderRadius
hr = node.rect.height * node.borderRadius; hr = node.rect.height * node.borderRadius
} }
var r = wr < hr ? wr : hr; let r = wr < hr ? wr : hr
if (node.rect.width < 2 * r) { if (node.rect.width < 2 * r) {
r = node.rect.width / 2; r = node.rect.width / 2
} }
if (node.rect.height < 2 * r) { if (node.rect.height < 2 * r) {
r = node.rect.height / 2; r = node.rect.height / 2
} }
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x + r, node.rect.y); ctx.moveTo(node.rect.x + r, node.rect.y)
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y, node.rect.x + node.rect.width, node.rect.y + node.rect.height, r); ctx.arcTo(node.rect.x + node.rect.width, node.rect.y, node.rect.x + node.rect.width, node.rect.y + node.rect.height, r)
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r); ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r)
ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r); ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r)
ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r); ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r)
ctx.closePath(); ctx.closePath();
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=rectangle.js.map // # sourceMappingURL=rectangle.js.map

View File

@@ -1,11 +1,11 @@
import { Rect } from '../../models/rect'; import { Rect } from '../../models/rect'
export function rectangleIconRect(node) { export function rectangleIconRect (node) {
node.iconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.height - node.paddingTopNum - node.paddingBottomNum, node.rect.height - node.paddingTopNum - node.paddingBottomNum); node.iconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.height - node.paddingTopNum - node.paddingBottomNum, node.rect.height - node.paddingTopNum - node.paddingBottomNum)
node.fullIconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, node.rect.height - node.paddingTopNum - node.paddingBottomNum); node.fullIconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, node.rect.height - node.paddingTopNum - node.paddingBottomNum)
} }
export function rectangleTextRect(node) { export function rectangleTextRect (node) {
var height = node.rect.height - node.paddingTopNum - node.paddingBottomNum; const height = node.rect.height - node.paddingTopNum - node.paddingBottomNum
node.textRect = new Rect(node.rect.x + node.paddingLeftNum + height, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum - height, height); node.textRect = new Rect(node.rect.x + node.paddingLeftNum + height, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum - height, height)
node.fullTextRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, height); node.fullTextRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, height)
} }
//# sourceMappingURL=rectangle.rect.js.map // # sourceMappingURL=rectangle.rect.js.map

View File

@@ -1,270 +1,263 @@
import { Store } from 'le5le-store'; import { Store } from 'le5le-store'
// getWords: Get the word array from text. A single Chinese character is a word. // getWords: Get the word array from text. A single Chinese character is a word.
export function getWords(txt) { export function getWords (txt) {
var words = []; const words = []
var word = ''; let word = ''
if (!txt) { if (!txt) {
txt = ''; txt = ''
}
for (let i = 0; i < txt.length; ++i) {
const ch = txt.charCodeAt(i)
if (ch < 33 || ch > 126) {
if (word) {
words.push(word)
word = ''
}
words.push(txt[i])
continue
} else {
word += txt[i]
} }
for (var i = 0; i < txt.length; ++i) { }
var ch = txt.charCodeAt(i); if (word) {
if (ch < 33 || ch > 126) { words.push(word)
if (word) { }
words.push(word); return words
word = '';
}
words.push(txt[i]);
continue;
}
else {
word += txt[i];
}
}
if (word) {
words.push(word);
}
return words;
} }
// getWrapLines: Get the lines by wrap. // getWrapLines: Get the lines by wrap.
// words - the word array of text, to avoid spliting a word. // words - the word array of text, to avoid spliting a word.
// maxWidth - the max width of the rect. // maxWidth - the max width of the rect.
export function getWrapLines(ctx, words, maxWidth, fontSize) { export function getWrapLines (ctx, words, maxWidth, fontSize) {
var lines = []; const lines = []
var currentLine = words[0] || ''; let currentLine = words[0] || ''
for (var i = 1; i < words.length; ++i) { for (let i = 1; i < words.length; ++i) {
var word = words[i] || ''; const word = words[i] || ''
var text_1 = currentLine + word; const text_1 = currentLine + word
var chinese = text_1.match(/[\u4e00-\u9fa5]/g) || ''; const chinese = text_1.match(/[\u4e00-\u9fa5]/g) || ''
var chineseLen = chinese.length; const chineseLen = chinese.length
if ((text_1.length - chineseLen) * fontSize * 0.5 + chineseLen * fontSize < maxWidth) { if ((text_1.length - chineseLen) * fontSize * 0.5 + chineseLen * fontSize < maxWidth) {
currentLine += word; currentLine += word
} } else {
else { lines.push(currentLine)
lines.push(currentLine); currentLine = word
currentLine = word;
}
} }
lines.push(currentLine); }
return lines; lines.push(currentLine)
return lines
} }
export function getLines(ctx, pen) { export function getLines (ctx, pen) {
if (pen.text && !pen.text.split) { if (pen.text && !pen.text.split) {
pen.text += ''; pen.text += ''
} }
var lines = []; let lines = []
switch (pen.whiteSpace) { switch (pen.whiteSpace) {
case 'nowrap': case 'nowrap':
lines.push(pen.text); lines.push(pen.text)
break; break
case 'pre-line': case 'pre-line':
lines = pen.text.split(/[\n]/g); lines = pen.text.split(/[\n]/g)
break; break
default: default:
var textRect = pen.getTextRect(); var textRect = pen.getTextRect()
var paragraphs = pen.text.split(/[\n]/g); var paragraphs = pen.text.split(/[\n]/g)
for (var i = 0; i < paragraphs.length; ++i) { for (let i = 0; i < paragraphs.length; ++i) {
var l = getWrapLines(ctx, getWords(paragraphs[i]), textRect.width, pen.fontSize); const l = getWrapLines(ctx, getWords(paragraphs[i]), textRect.width, pen.fontSize)
lines.push.apply(lines, l); lines.push.apply(lines, l)
} }
break; break
} }
return lines; return lines
} }
export function calcTextRect(ctx, pen) { export function calcTextRect (ctx, pen) {
var lines = getLines(ctx, pen); const lines = getLines(ctx, pen)
var width = 0; let width = 0
for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) { for (let _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
var item = lines_1[_i]; const item = lines_1[_i]
ctx.font = (pen.fontStyle || 'normal') + " normal " + (pen.fontWeight || 'normal') + " " + pen.fontSize + "px/" + pen.lineHeight + " " + pen.fontFamily; ctx.font = (pen.fontStyle || 'normal') + ' normal ' + (pen.fontWeight || 'normal') + ' ' + pen.fontSize + 'px/' + pen.lineHeight + ' ' + pen.fontFamily
var r = ctx.measureText(item); const r = ctx.measureText(item)
var w = r.width; const w = r.width
if (w > width) { if (w > width) {
width = w; width = w
}
} }
return { }
width: width, return {
height: lines.length * pen.fontSize * pen.lineHeight, width: width,
}; height: lines.length * pen.fontSize * pen.lineHeight
}
} }
function textBk(ctx, str, x, y, height, color) { function textBk (ctx, str, x, y, height, color) {
if (!str || !color) { if (!str || !color) {
return; return
} }
var w = ctx.measureText(str).width; const w = ctx.measureText(str).width
ctx.save(); ctx.save()
ctx.fillStyle = color; ctx.fillStyle = color
var l = x - w / 2; let l = x - w / 2
var t = y - height / 2; let t = y - height / 2
switch (ctx.textAlign) { switch (ctx.textAlign) {
case 'left': case 'left':
l = x; l = x
break; break
case 'right': case 'right':
l = x - w; l = x - w
break; break
} }
switch (ctx.textBaseline) { switch (ctx.textBaseline) {
case 'top': case 'top':
t = y; t = y
break; break
case 'bottom': case 'bottom':
t = y - height; t = y - height
break; break
} }
ctx.fillRect(l, t, w, height); ctx.fillRect(l, t, w, height)
ctx.restore(); ctx.restore()
} }
export function fillText(ctx, lines, x, y, width, height, lineHeight, maxLineLen, bk) { export function fillText (ctx, lines, x, y, width, height, lineHeight, maxLineLen, bk) {
if (!maxLineLen || maxLineLen > lines.length) { if (!maxLineLen || maxLineLen > lines.length) {
maxLineLen = lines.length; maxLineLen = lines.length
} else {
maxLineLen = Math.ceil(maxLineLen)
}
for (let i = 0; i < maxLineLen - 1; ++i) {
if (bk) {
textBk(ctx, lines[i], x, y + i * lineHeight, lineHeight, bk)
} }
else { ctx.fillText(lines[i], x, y + i * lineHeight)
maxLineLen = Math.ceil(maxLineLen); }
if (maxLineLen < lines.length) {
let str = (lines[maxLineLen - 1] || '') + '...'
if (lines[maxLineLen - 1] && ctx.measureText(str).width > width) {
str = lines[maxLineLen - 1].substr(0, lines[maxLineLen - 1].length - 2) + '...'
} }
for (var i = 0; i < maxLineLen - 1; ++i) { if (bk) {
if (bk) { textBk(ctx, str, x, y + (maxLineLen - 1) * lineHeight, lineHeight, bk)
textBk(ctx, lines[i], x, y + i * lineHeight, lineHeight, bk);
}
ctx.fillText(lines[i], x, y + i * lineHeight);
} }
if (maxLineLen < lines.length) { ctx.fillText(str, x, y + (maxLineLen - 1) * lineHeight)
var str = (lines[maxLineLen - 1] || '') + '...'; } else {
if (lines[maxLineLen - 1] && ctx.measureText(str).width > width) { if (bk) {
str = lines[maxLineLen - 1].substr(0, lines[maxLineLen - 1].length - 2) + '...'; textBk(ctx, lines[maxLineLen - 1], x, y + (maxLineLen - 1) * lineHeight, lineHeight, bk)
}
if (bk) {
textBk(ctx, str, x, y + (maxLineLen - 1) * lineHeight, lineHeight, bk);
}
ctx.fillText(str, x, y + (maxLineLen - 1) * lineHeight);
}
else {
if (bk) {
textBk(ctx, lines[maxLineLen - 1], x, y + (maxLineLen - 1) * lineHeight, lineHeight, bk);
}
ctx.fillText(lines[maxLineLen - 1], x, y + (maxLineLen - 1) * lineHeight);
} }
ctx.fillText(lines[maxLineLen - 1], x, y + (maxLineLen - 1) * lineHeight)
}
} }
export function text(ctx, node) { export function text (ctx, node) {
if (!node.text) { if (!node.text) {
return; return
} }
if (!node.text.split) { if (!node.text.split) {
node.text += ''; node.text += ''
} }
ctx.save(); ctx.save()
ctx.beginPath(); ctx.beginPath()
delete ctx.shadowColor; delete ctx.shadowColor
delete ctx.shadowBlur; delete ctx.shadowBlur
ctx.font = (node.fontStyle || 'normal') + " normal " + (node.fontWeight || 'normal') + " " + node.fontSize + "px/" + node.lineHeight + " " + node.fontFamily; ctx.font = (node.fontStyle || 'normal') + ' normal ' + (node.fontWeight || 'normal') + ' ' + node.fontSize + 'px/' + node.lineHeight + ' ' + node.fontFamily
if (node.fontColor) { if (node.fontColor) {
ctx.fillStyle = node.fontColor; ctx.fillStyle = node.fontColor
} } else {
else { ctx.fillStyle = Store.get(node.generateStoreKey('LT:fontColor'))
ctx.fillStyle = Store.get(node.generateStoreKey('LT:fontColor')); }
} if (node.textAlign) {
if (node.textAlign) { ctx.textAlign = node.textAlign
ctx.textAlign = node.textAlign; }
} if (node.textBaseline) {
if (node.textBaseline) { ctx.textBaseline = node.textBaseline
ctx.textBaseline = node.textBaseline; }
} const textRect = node.getTextRect()
var textRect = node.getTextRect(); if (!textRect) {
if (!textRect) { ctx.restore()
ctx.restore(); return
return; }
} const lines = getLines(ctx, node)
var lines = getLines(ctx, node); const lineHeight = node.fontSize * node.lineHeight
var lineHeight = node.fontSize * node.lineHeight; const maxLineLen = node.textMaxLine > 0 && node.textMaxLine < lines.length ? node.textMaxLine : lines.length
var maxLineLen = node.textMaxLine > 0 && node.textMaxLine < lines.length ? node.textMaxLine : lines.length; // By default, the text is center aligned.
// By default, the text is center aligned. let x = textRect.x + textRect.width / 2
var x = textRect.x + textRect.width / 2; let y = textRect.y + (textRect.height - lineHeight * maxLineLen) / 2 + (lineHeight * 4) / 7
var y = textRect.y + (textRect.height - lineHeight * maxLineLen) / 2 + (lineHeight * 4) / 7; switch (ctx.textAlign) {
switch (ctx.textAlign) { case 'left':
case 'left': x = textRect.x
x = textRect.x; break
break; case 'right':
case 'right': x = textRect.x + textRect.width
x = textRect.x + textRect.width; break
break; }
} switch (ctx.textBaseline) {
switch (ctx.textBaseline) { case 'top':
case 'top': y = textRect.y + (lineHeight - node.fontSize) / 2
y = textRect.y + (lineHeight - node.fontSize) / 2; break
break; case 'bottom':
case 'bottom': y = textRect.ey - lineHeight * maxLineLen + lineHeight
y = textRect.ey - lineHeight * maxLineLen + lineHeight; break
break; }
} fillText(ctx, lines, x + node.textOffsetX, y + node.textOffsetY, textRect.width, textRect.height, lineHeight, maxLineLen, node.textBackground)
fillText(ctx, lines, x + node.textOffsetX, y + node.textOffsetY, textRect.width, textRect.height, lineHeight, maxLineLen, node.textBackground); ctx.restore()
ctx.restore();
} }
export function iconfont(ctx, node) { export function iconfont (ctx, node) {
ctx.save(); ctx.save()
ctx.textAlign = 'center'; ctx.textAlign = 'center'
ctx.textBaseline = 'middle'; ctx.textBaseline = 'middle'
var iconRect = node.getIconRect(); const iconRect = node.getIconRect()
var x = iconRect.x + iconRect.width / 2; let x = iconRect.x + iconRect.width / 2
var y = iconRect.y + iconRect.height / 2; let y = iconRect.y + iconRect.height / 2
switch (node.imageAlign) { switch (node.imageAlign) {
case 'top': case 'top':
y = iconRect.y; y = iconRect.y
ctx.textBaseline = 'top'; ctx.textBaseline = 'top'
break; break
case 'bottom': case 'bottom':
y = iconRect.ey; y = iconRect.ey
ctx.textBaseline = 'bottom'; ctx.textBaseline = 'bottom'
break; break
case 'left': case 'left':
x = iconRect.x; x = iconRect.x
ctx.textAlign = 'left'; ctx.textAlign = 'left'
break; break
case 'right': case 'right':
x = iconRect.ex; x = iconRect.ex
ctx.textAlign = 'right'; ctx.textAlign = 'right'
break; break
case 'left-top': case 'left-top':
x = iconRect.x; x = iconRect.x
y = iconRect.y; y = iconRect.y
ctx.textAlign = 'left'; ctx.textAlign = 'left'
ctx.textBaseline = 'top'; ctx.textBaseline = 'top'
break; break
case 'right-top': case 'right-top':
x = iconRect.ex; x = iconRect.ex
y = iconRect.y; y = iconRect.y
ctx.textAlign = 'right'; ctx.textAlign = 'right'
ctx.textBaseline = 'top'; ctx.textBaseline = 'top'
break; break
case 'left-bottom': case 'left-bottom':
x = iconRect.x; x = iconRect.x
y = iconRect.ey; y = iconRect.ey
ctx.textAlign = 'left'; ctx.textAlign = 'left'
ctx.textBaseline = 'bottom'; ctx.textBaseline = 'bottom'
break; break
case 'right-bottom': case 'right-bottom':
x = iconRect.ex; x = iconRect.ex
y = iconRect.ey; y = iconRect.ey
ctx.textAlign = 'right'; ctx.textAlign = 'right'
ctx.textBaseline = 'bottom'; ctx.textBaseline = 'bottom'
break; break
} }
if (node.iconSize > 0) { if (node.iconSize > 0) {
ctx.font = node.iconSize + "px " + node.iconFamily; ctx.font = node.iconSize + 'px ' + node.iconFamily
} } else if (iconRect.width > iconRect.height) {
else if (iconRect.width > iconRect.height) { ctx.font = iconRect.height + 'px ' + node.iconFamily
ctx.font = iconRect.height + "px " + node.iconFamily; } else {
} ctx.font = iconRect.width + 'px ' + node.iconFamily
else { }
ctx.font = iconRect.width + "px " + node.iconFamily; ctx.fillStyle = node.iconColor || Store.get(node.generateStoreKey('LT:iconColor')) || node.fontColor
} if (node.iconRotate) {
ctx.fillStyle = node.iconColor || Store.get(node.generateStoreKey('LT:iconColor')) || node.fontColor; ctx.translate(iconRect.center.x, iconRect.center.y)
if (node.iconRotate) { ctx.rotate((node.iconRotate * Math.PI) / 180)
ctx.translate(iconRect.center.x, iconRect.center.y); ctx.translate(-iconRect.center.x, -iconRect.center.y)
ctx.rotate((node.iconRotate * Math.PI) / 180); }
ctx.translate(-iconRect.center.x, -iconRect.center.y); ctx.beginPath()
} ctx.fillText(node.icon, x, y)
ctx.beginPath(); ctx.restore()
ctx.fillText(node.icon, x, y);
ctx.restore();
} }
//# sourceMappingURL=text.js.map // # sourceMappingURL=text.js.map

View File

@@ -1,9 +1,9 @@
import { Point } from '../../models/point'; import { Point } from '../../models/point'
import { Direction } from '../../models/direction'; import { Direction } from '../../models/direction'
export function triangleAnchors(node) { export function triangleAnchors (node) {
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up))
node.anchors.push(new Point(node.rect.x + (node.rect.width * 3) / 4, node.rect.y + node.rect.height / 2, Direction.Right)); node.anchors.push(new Point(node.rect.x + (node.rect.width * 3) / 4, node.rect.y + node.rect.height / 2, Direction.Right))
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height, Direction.Bottom)); node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height, Direction.Bottom))
node.anchors.push(new Point(node.rect.x + node.rect.width / 4, node.rect.y + node.rect.height / 2, Direction.Left)); node.anchors.push(new Point(node.rect.x + node.rect.width / 4, node.rect.y + node.rect.height / 2, Direction.Left))
} }
//# sourceMappingURL=triangle.anchor.js.map // # sourceMappingURL=triangle.anchor.js.map

View File

@@ -1,10 +1,10 @@
export function triangle(ctx, node) { export function triangle (ctx, node) {
ctx.beginPath(); ctx.beginPath()
ctx.moveTo(node.rect.x + node.rect.width / 2, node.rect.y); ctx.moveTo(node.rect.x + node.rect.width / 2, node.rect.y)
ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height); ctx.lineTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height)
ctx.lineTo(node.rect.x, node.rect.y + node.rect.height); ctx.lineTo(node.rect.x, node.rect.y + node.rect.height)
ctx.closePath(); ctx.closePath();
(node.fillStyle || node.bkType) && ctx.fill(); (node.fillStyle || node.bkType) && ctx.fill()
ctx.stroke(); ctx.stroke()
} }
//# sourceMappingURL=triangle.js.map // # sourceMappingURL=triangle.js.map

View File

@@ -1,23 +1,22 @@
import { Rect } from '../../models/rect'; import { Rect } from '../../models/rect'
export function triangleIconRect(node) { export function triangleIconRect (node) {
var w = (node.rect.width * 2) / 7; let w = (node.rect.width * 2) / 7
var h = (node.rect.height * 2) / 7; let h = (node.rect.height * 2) / 7
if (w > h) { if (w > h) {
w = h; w = h
} } else {
else { h = w
h = w; }
} let top = w
var top = w; if (top < 10) {
if (top < 10) { top = 10
top = 10; }
} node.iconRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + top, w, h)
node.iconRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + top, w, h);
} }
export function triangleTextRect(node) { export function triangleTextRect (node) {
node.textRect = new Rect(node.rect.x + node.rect.width / 4, node.rect.y + (node.rect.height * 2) / 3, node.rect.width / 2, node.rect.height / 3 - 5); node.textRect = new Rect(node.rect.x + node.rect.width / 4, node.rect.y + (node.rect.height * 2) / 3, node.rect.width / 2, node.rect.height / 3 - 5)
var w = node.rect.width / 2; const w = node.rect.width / 2
var h = (node.rect.height * 3) / 7; const h = (node.rect.height * 3) / 7
node.fullTextRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + node.rect.height / 2 - 5, w, h); node.fullTextRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + node.rect.height / 2 - 5, w, h)
} }
//# sourceMappingURL=triangle.rect.js.map // # sourceMappingURL=triangle.rect.js.map

View File

@@ -1,67 +1,64 @@
import { Node } from './node'; import { Node } from './node'
import { Line } from './line'; import { Line } from './line'
import { Lock } from './status'; import { Lock } from './status'
import { s8 } from '../utils'; import { s8 } from '../utils'
import { Store } from 'le5le-store'; import { Store } from 'le5le-store'
import { Rect } from './rect'; import { Rect } from './rect'
export function createData(json, tid) { export function createData (json, tid) {
var data = { let data = {
pens: [], pens: [],
lineName: 'curve', lineName: 'curve',
fromArrow: '', fromArrow: '',
toArrow: 'triangleSolid', toArrow: 'triangleSolid',
scale: 1, scale: 1,
locked: Lock.None, locked: Lock.None,
x: 0, x: 0,
y: 0, y: 0
}; }
if (typeof json === 'string') { if (typeof json === 'string') {
json = JSON.parse(json); json = JSON.parse(json)
}
data = Object.assign(data, json)
data.pens = []
if (json) {
// for old data.
if (json.nodes) {
for (let _i = 0, _a = json.nodes; _i < _a.length; _i++) {
var item = _a[_i]
item.TID = tid
data.pens.push(new Node(item))
}
for (let _b = 0, _c = json.lines; _b < _c.length; _b++) {
var item = _c[_b]
item.TID = tid
data.pens.push(new Line(item))
}
} }
data = Object.assign(data, json); // end.
data.pens = []; json.pens && json.pens.forEach(function (item) {
if (json) { tid && (item.TID = tid)
// for old data. if (!item.type) {
if (json.nodes) { data.pens.push(new Node(item))
for (var _i = 0, _a = json.nodes; _i < _a.length; _i++) { } else {
var item = _a[_i]; data.pens.push(new Line(item))
item.TID = tid; }
data.pens.push(new Node(item)); })
} if (json.bkImageRect) {
for (var _b = 0, _c = json.lines; _b < _c.length; _b++) { data.bkImageRect = new Rect(json.bkImageRect.x, json.bkImageRect.y, json.bkImageRect.width, json.bkImageRect.height)
var item = _c[_b];
item.TID = tid;
data.pens.push(new Line(item));
}
}
// end.
json.pens && json.pens.forEach(function (item) {
tid && (item.TID = tid);
if (!item.type) {
data.pens.push(new Node(item));
}
else {
data.pens.push(new Line(item));
}
});
if (json.bkImageRect) {
data.bkImageRect = new Rect(json.bkImageRect.x, json.bkImageRect.y, json.bkImageRect.width, json.bkImageRect.height);
}
} }
if (data.mqttOptions) { }
var opts = ''; if (data.mqttOptions) {
if (typeof data.mqttOptions === 'object') { let opts = ''
opts = JSON.stringify(data.mqttOptions); if (typeof data.mqttOptions === 'object') {
} opts = JSON.stringify(data.mqttOptions)
else { } else {
opts = data.mqttOptions + ''; opts = data.mqttOptions + ''
}
data.mqttOptions = JSON.parse(opts);
} }
else { data.mqttOptions = JSON.parse(opts)
data.mqttOptions = { clientId: s8() }; } else {
} data.mqttOptions = { clientId: s8() }
tid && Store.set(tid + '-topology-data', data); }
return data; tid && Store.set(tid + '-topology-data', data)
return data
} }
//# sourceMappingURL=data.js.map // # sourceMappingURL=data.js.map

View File

@@ -1,9 +1,9 @@
export var Direction; export var Direction;
(function (Direction) { (function (Direction) {
Direction[Direction["None"] = 0] = "None"; Direction[Direction.None = 0] = 'None'
Direction[Direction["Up"] = 1] = "Up"; Direction[Direction.Up = 1] = 'Up'
Direction[Direction["Right"] = 2] = "Right"; Direction[Direction.Right = 2] = 'Right'
Direction[Direction["Bottom"] = 3] = "Bottom"; Direction[Direction.Bottom = 3] = 'Bottom'
Direction[Direction["Left"] = 4] = "Left"; Direction[Direction.Left = 4] = 'Left'
})(Direction || (Direction = {})); })(Direction || (Direction = {}))
//# sourceMappingURL=direction.js.map // # sourceMappingURL=direction.js.map

View File

@@ -1,21 +1,21 @@
export var EventType; export var EventType;
(function (EventType) { (function (EventType) {
EventType[EventType["Click"] = 0] = "Click"; EventType[EventType.Click = 0] = 'Click'
EventType[EventType["DblClick"] = 1] = "DblClick"; EventType[EventType.DblClick = 1] = 'DblClick'
EventType[EventType["WebSocket"] = 2] = "WebSocket"; EventType[EventType.WebSocket = 2] = 'WebSocket'
EventType[EventType["Mqtt"] = 3] = "Mqtt"; EventType[EventType.Mqtt = 3] = 'Mqtt'
EventType[EventType["MoveIn"] = 4] = "MoveIn"; EventType[EventType.MoveIn = 4] = 'MoveIn'
EventType[EventType["MoveOut"] = 5] = "MoveOut"; EventType[EventType.MoveOut = 5] = 'MoveOut'
})(EventType || (EventType = {})); })(EventType || (EventType = {}))
export var EventAction; export var EventAction;
(function (EventAction) { (function (EventAction) {
EventAction[EventAction["Link"] = 0] = "Link"; EventAction[EventAction.Link = 0] = 'Link'
EventAction[EventAction["StartAnimate"] = 1] = "StartAnimate"; EventAction[EventAction.StartAnimate = 1] = 'StartAnimate'
EventAction[EventAction["Function"] = 2] = "Function"; EventAction[EventAction.Function = 2] = 'Function'
EventAction[EventAction["WindowFn"] = 3] = "WindowFn"; EventAction[EventAction.WindowFn = 3] = 'WindowFn'
EventAction[EventAction["SetProps"] = 4] = "SetProps"; EventAction[EventAction.SetProps = 4] = 'SetProps'
EventAction[EventAction["PauseAnimate"] = 5] = "PauseAnimate"; EventAction[EventAction.PauseAnimate = 5] = 'PauseAnimate'
EventAction[EventAction["StopAnimate"] = 6] = "StopAnimate"; EventAction[EventAction.StopAnimate = 6] = 'StopAnimate'
EventAction[EventAction["Emit"] = 7] = "Emit"; EventAction[EventAction.Emit = 7] = 'Emit'
})(EventAction || (EventAction = {})); })(EventAction || (EventAction = {}))
//# sourceMappingURL=event.js.map // # sourceMappingURL=event.js.map

View File

@@ -1,10 +1,10 @@
export * from './data'; export * from './data'
export * from './pen'; export * from './pen'
export * from './node'; export * from './node'
export * from './line'; export * from './line'
export * from './direction'; export * from './direction'
export * from './point'; export * from './point'
export * from './rect'; export * from './rect'
export * from './status'; export * from './status'
export * from './event'; export * from './event'
//# sourceMappingURL=index.js.map // # sourceMappingURL=index.js.map

Some files were not shown because too many files have changed in this diff Show More