Merge branch 'dev-3.2' of https://git.mesalab.cn/nezha/nezha-fronted into dev-3.3
# Conflicts: # .gitignore # nezha-fronted/src/assets/css/font/iconfont.js # nezha-fronted/src/components/chart/chart/chartAutotopology.vue # nezha-fronted/src/components/common/ChartDiagram/diagram.vue # nezha-fronted/src/components/common/detailView/view/detailViewRight.vue # nezha-fronted/src/components/common/js/common.js # nezha-fronted/src/components/common/js/tools.js # nezha-fronted/src/components/common/project/topologyL5.vue # nezha-fronted/static/config.json
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -18,3 +18,4 @@ nezha-fronted/src/components/page/dashboard/testData.js
|
||||
nezha-fronted/src/components/common/rightBox/tempRoghtBox.vue
|
||||
nezha-fronted/exportHtml/
|
||||
nezha-fronted/src/a.txt
|
||||
nezha-fronted/src/components/common/testTopology.vue
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -46,7 +46,7 @@ export default {
|
||||
this.isInit = false
|
||||
this.$get('monitor/project', { pageSize: -1 }).then(res => {
|
||||
this.topologyLoading = true
|
||||
const axiosAll = []
|
||||
let axiosAll = []
|
||||
let temp = []
|
||||
if (res.data.list.length === 0) {
|
||||
this.topologyLoading = false
|
||||
@@ -65,8 +65,10 @@ export default {
|
||||
res2.forEach(item => {
|
||||
temp.push(item)
|
||||
})
|
||||
// temp.push(res2[2])
|
||||
this.allProject = JSON.parse(JSON.stringify(temp))
|
||||
temp = null
|
||||
axiosAll = null
|
||||
this.topologyLoading = false
|
||||
})
|
||||
})
|
||||
@@ -100,7 +102,10 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
|
||||
this.queryAllProjectData()
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.allProject = []
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
5
nezha-fronted/src/components/common/@topology/activity-diagram/index.d.ts
vendored
Normal file
5
nezha-fronted/src/components/common/@topology/activity-diagram/index.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from './src/final';
|
||||
export * from './src/fork';
|
||||
export * from './src/swimlaneH';
|
||||
export * from './src/swimlaneV';
|
||||
export * from './src/register';
|
||||
@@ -0,0 +1,6 @@
|
||||
export * from './src/final'
|
||||
export * from './src/fork'
|
||||
export * from './src/swimlaneH'
|
||||
export * from './src/swimlaneV'
|
||||
export * from './src/register'
|
||||
// # sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../packages/activity-diagram/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@topology/activity-diagram@0.3.0",
|
||||
"D:\\a\\nezha-fronted\\nezha-fronted"
|
||||
]
|
||||
],
|
||||
"_from": "@topology/activity-diagram@0.3.0",
|
||||
"_id": "@topology/activity-diagram@0.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-9uceHdbT1MY++/2crNlZmFMVmz6sI4OqH7aUQuBT8q9RDXA7t2prFd7lx4UfaIyQqDYtYtpeCHLPlhRLsEooZg==",
|
||||
"_location": "/@topology/activity-diagram",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@topology/activity-diagram@0.3.0",
|
||||
"name": "@topology/activity-diagram",
|
||||
"escapedName": "@topology%2factivity-diagram",
|
||||
"scope": "@topology",
|
||||
"rawSpec": "0.3.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.3.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@topology/activity-diagram/-/activity-diagram-0.3.0.tgz",
|
||||
"_spec": "0.3.0",
|
||||
"_where": "D:\\a\\nezha-fronted\\nezha-fronted",
|
||||
"author": {
|
||||
"name": "alsmile123@qq.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/le5le-com/topology/issues"
|
||||
},
|
||||
"description": "A activity diagram tool using le5le-topology.",
|
||||
"gitHead": "78f2a53ca1839c89b56e2e498d17ba4eb987ad14",
|
||||
"homepage": "https://github.com/le5le-com/topology#readme",
|
||||
"keywords": [
|
||||
"topology",
|
||||
"activity",
|
||||
"diagram",
|
||||
"canvas"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "@topology/activity-diagram",
|
||||
"peerDependencies": {
|
||||
"@topology/core": "^0.3.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/le5le-com/topology.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc && npm run copy",
|
||||
"copy": "copyfiles package.json ../../dist/activity-diagram/"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "0.3.0"
|
||||
}
|
||||
2
nezha-fronted/src/components/common/@topology/activity-diagram/src/final/final.d.ts
vendored
Normal file
2
nezha-fronted/src/components/common/@topology/activity-diagram/src/final/final.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { Node } from '@topology/core';
|
||||
export declare function activityFinal(ctx: CanvasRenderingContext2D, node: Node): void;
|
||||
@@ -0,0 +1,10 @@
|
||||
export function activityFinal (ctx, node) {
|
||||
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.stroke()
|
||||
ctx.beginPath()
|
||||
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.fill()
|
||||
}
|
||||
// # sourceMappingURL=final.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"final.js","sourceRoot":"","sources":["../../../../packages/activity-diagram/src/final/final.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAAC,GAA6B,EAAE,IAAU;IACrE,GAAG,CAAC,SAAS,EAAE,CAAC;IAChB,GAAG,CAAC,OAAO,CACT,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,EACjC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAClC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,EACnB,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EACpB,CAAC,EACD,CAAC,EACD,IAAI,CAAC,EAAE,GAAG,CAAC,CACZ,CAAC;IACF,GAAG,CAAC,MAAM,EAAE,CAAC;IAEb,GAAG,CAAC,SAAS,EAAE,CAAC;IAChB,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,WAAW,CAAC;IAChC,GAAG,CAAC,OAAO,CACT,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,EACjC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAClC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,EACnB,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EACpB,CAAC,EACD,CAAC,EACD,IAAI,CAAC,EAAE,GAAG,CAAC,CACZ,CAAC;IACF,GAAG,CAAC,IAAI,EAAE,CAAC;AACb,CAAC"}
|
||||
3
nezha-fronted/src/components/common/@topology/activity-diagram/src/final/final.rect.d.ts
vendored
Normal file
3
nezha-fronted/src/components/common/@topology/activity-diagram/src/final/final.rect.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { Node } from '@topology/core';
|
||||
export declare function activityFinalIconRect(node: Node): void;
|
||||
export declare function activityFinalTextRect(node: Node): void;
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Rect } from '@topology/core'
|
||||
export function activityFinalIconRect (node) {
|
||||
node.iconRect = new Rect(0, 0, 0, 0)
|
||||
}
|
||||
export function activityFinalTextRect (node) {
|
||||
const w = (node.rect.width * 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.fullTextRect = node.textRect
|
||||
}
|
||||
// # sourceMappingURL=final.rect.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"final.rect.js","sourceRoot":"","sources":["../../../../packages/activity-diagram/src/final/final.rect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,qBAAqB,CAAC,IAAU;IAC9C,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAU;IAC9C,IAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACpC,IAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAClH,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC;AACpC,CAAC"}
|
||||
2
nezha-fronted/src/components/common/@topology/activity-diagram/src/final/index.d.ts
vendored
Normal file
2
nezha-fronted/src/components/common/@topology/activity-diagram/src/final/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './final';
|
||||
export * from './final.rect';
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './final'
|
||||
export * from './final.rect'
|
||||
// # sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/activity-diagram/src/final/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
|
||||
3
nezha-fronted/src/components/common/@topology/activity-diagram/src/fork/fork.anchor.d.ts
vendored
Normal file
3
nezha-fronted/src/components/common/@topology/activity-diagram/src/fork/fork.anchor.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { Node } from '@topology/core';
|
||||
export declare function forkHAnchors(node: Node): void;
|
||||
export declare function forkVAnchors(node: Node): void;
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Point, Direction } from '@topology/core'
|
||||
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.ex, node.rect.y + node.rect.height / 2, Direction.Right))
|
||||
const dis = 5
|
||||
for (let i = dis; node.rect.x + i < node.rect.ex; i = i + dis) {
|
||||
const pt1 = new Point(node.rect.x + i, node.rect.y, Direction.Up)
|
||||
const pt2 = new Point(node.rect.x + i, node.rect.ey, Direction.Bottom)
|
||||
pt1.hidden = true
|
||||
pt2.hidden = true
|
||||
node.anchors.push(pt1)
|
||||
node.anchors.push(pt2)
|
||||
}
|
||||
}
|
||||
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.ey, Direction.Bottom))
|
||||
const dis = 5
|
||||
for (let i = dis; node.rect.y + i < node.rect.ey; i = i + dis) {
|
||||
const pt1 = new Point(node.rect.x, node.rect.y + i, Direction.Left)
|
||||
const pt2 = new Point(node.rect.ex, node.rect.y + i, Direction.Right)
|
||||
pt1.hidden = true
|
||||
pt2.hidden = true
|
||||
node.anchors.push(pt1)
|
||||
node.anchors.push(pt2)
|
||||
}
|
||||
}
|
||||
// # sourceMappingURL=fork.anchor.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fork.anchor.js","sourceRoot":"","sources":["../../../../packages/activity-diagram/src/fork/fork.anchor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAQ,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,UAAU,YAAY,CAAC,IAAU;IACrC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9F,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAEhG,IAAM,GAAG,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE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G,GAAG,EAAE;QAC7D,IAAM,GAAG,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QACpE,IAAM,GAAG,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;QACtE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC;QAClB,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACxB;AACH,CAAC"}
|
||||
2
nezha-fronted/src/components/common/@topology/activity-diagram/src/fork/fork.d.ts
vendored
Normal file
2
nezha-fronted/src/components/common/@topology/activity-diagram/src/fork/fork.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { Node } from '@topology/core';
|
||||
export declare function fork(ctx: CanvasRenderingContext2D, node: Node): void;
|
||||
@@ -0,0 +1,25 @@
|
||||
export function fork (ctx, node) {
|
||||
let wr = node.borderRadius
|
||||
let hr = node.borderRadius
|
||||
if (node.borderRadius < 1) {
|
||||
wr = node.rect.width * node.borderRadius
|
||||
hr = node.rect.height * node.borderRadius
|
||||
}
|
||||
let r = wr < hr ? wr : hr
|
||||
if (node.rect.width < 2 * r) {
|
||||
r = node.rect.width / 2
|
||||
}
|
||||
if (node.rect.height < 2 * r) {
|
||||
r = node.rect.height / 2
|
||||
}
|
||||
ctx.beginPath()
|
||||
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.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.x + node.rect.width, node.rect.y, r)
|
||||
ctx.closePath();
|
||||
(node.fillStyle || node.bkType) && ctx.fill()
|
||||
ctx.stroke()
|
||||
}
|
||||
// # sourceMappingURL=fork.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fork.js","sourceRoot":"","sources":["../../../../packages/activity-diagram/src/fork/fork.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,IAAI,CAAC,GAA6B,EAAE,IAAU;IAC5D,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;IAC3B,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;IAC3B,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC,EAAE;QACzB,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;QACzC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC;KAC3C;IACD,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1B,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,EAAE;QAC3B,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;KACzB;IACD,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,EAAE;QAC5B,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;KAC1B;IAED,GAAG,CAAC,SAAS,EAAE,CAAC;IAChB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,C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AAC,IAAI,EAAE,CAAC;IAC9C,GAAG,CAAC,MAAM,EAAE,CAAC;AACf,CAAC"}
|
||||
3
nezha-fronted/src/components/common/@topology/activity-diagram/src/fork/fork.rect.d.ts
vendored
Normal file
3
nezha-fronted/src/components/common/@topology/activity-diagram/src/fork/fork.rect.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { Node } from '@topology/core';
|
||||
export declare function forkIconRect(node: Node): void;
|
||||
export declare function forkTextRect(node: Node): void;
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Rect } from '@topology/core'
|
||||
export function forkIconRect (node) {
|
||||
node.iconRect = new Rect(0, 0, 0, 0)
|
||||
}
|
||||
export function forkTextRect (node) {
|
||||
node.textRect = new Rect(node.rect.x, node.rect.y, node.rect.width, node.rect.height)
|
||||
node.fullTextRect = node.textRect
|
||||
}
|
||||
// # sourceMappingURL=fork.rect.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fork.rect.js","sourceRoot":"","sources":["../../../../packages/activity-diagram/src/fork/fork.rect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,YAAY,CAAC,IAAU;IACrC,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAU;IACrC,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC;AACpC,CAAC"}
|
||||
3
nezha-fronted/src/components/common/@topology/activity-diagram/src/fork/index.d.ts
vendored
Normal file
3
nezha-fronted/src/components/common/@topology/activity-diagram/src/fork/index.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './fork';
|
||||
export * from './fork.rect';
|
||||
export * from './fork.anchor';
|
||||
@@ -0,0 +1,4 @@
|
||||
export * from './fork'
|
||||
export * from './fork.rect'
|
||||
export * from './fork.anchor'
|
||||
// # sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/activity-diagram/src/fork/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
||||
1
nezha-fronted/src/components/common/@topology/activity-diagram/src/register.d.ts
vendored
Normal file
1
nezha-fronted/src/components/common/@topology/activity-diagram/src/register.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function register(): void;
|
||||
@@ -0,0 +1,13 @@
|
||||
import { registerNode } from '@topology/core'
|
||||
import { activityFinal, activityFinalIconRect, activityFinalTextRect } from './final'
|
||||
import { fork, forkHAnchors, forkVAnchors, forkIconRect, forkTextRect } from './fork'
|
||||
import { swimlaneH, swimlaneHIconRect, swimlaneHTextRect } from './swimlaneH'
|
||||
import { swimlaneV, swimlaneVIconRect, swimlaneVTextRect } from './swimlaneV'
|
||||
export function register () {
|
||||
registerNode('activityFinal', activityFinal, null, activityFinalIconRect, activityFinalTextRect)
|
||||
registerNode('swimlaneV', swimlaneV, null, swimlaneVIconRect, swimlaneVTextRect)
|
||||
registerNode('swimlaneH', swimlaneH, null, swimlaneHIconRect, swimlaneHTextRect)
|
||||
registerNode('forkH', fork, forkHAnchors, forkIconRect, forkTextRect)
|
||||
registerNode('forkV', fork, forkVAnchors, forkIconRect, forkTextRect)
|
||||
}
|
||||
// # sourceMappingURL=register.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../packages/activity-diagram/src/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACtF,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,UAAU,QAAQ;IACtB,YAAY,CAAC,eAAe,EAAE,aAAa,EAAE,IAAI,EAAE,qBAAqB,EAAE,qBAAqB,CAAC,CAAC;IACjG,YAAY,CAAC,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;IACjF,YAAY,CAAC,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;IACjF,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IACtE,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;AACxE,CAAC"}
|
||||
2
nezha-fronted/src/components/common/@topology/activity-diagram/src/swimlaneH/index.d.ts
vendored
Normal file
2
nezha-fronted/src/components/common/@topology/activity-diagram/src/swimlaneH/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './swimlaneH';
|
||||
export * from './swimlaneH.rect';
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './swimlaneH'
|
||||
export * from './swimlaneH.rect'
|
||||
// # sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/activity-diagram/src/swimlaneH/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
||||
2
nezha-fronted/src/components/common/@topology/activity-diagram/src/swimlaneH/swimlaneH.d.ts
vendored
Normal file
2
nezha-fronted/src/components/common/@topology/activity-diagram/src/swimlaneH/swimlaneH.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { Node } from '@topology/core';
|
||||
export declare function swimlaneH(ctx: CanvasRenderingContext2D, node: Node): void;
|
||||
@@ -0,0 +1,27 @@
|
||||
export function swimlaneH (ctx, node) {
|
||||
let wr = node.borderRadius
|
||||
let hr = node.borderRadius
|
||||
if (node.borderRadius < 1) {
|
||||
wr = node.rect.width * node.borderRadius
|
||||
hr = node.rect.height * node.borderRadius
|
||||
}
|
||||
let r = wr < hr ? wr : hr
|
||||
if (node.rect.width < 2 * r) {
|
||||
r = node.rect.width / 2
|
||||
}
|
||||
if (node.rect.height < 2 * r) {
|
||||
r = node.rect.height / 2
|
||||
}
|
||||
ctx.beginPath()
|
||||
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.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.x + node.rect.width, node.rect.y, r)
|
||||
ctx.closePath()
|
||||
ctx.moveTo(node.rect.x + 40, node.rect.y)
|
||||
ctx.lineTo(node.rect.x + 40, node.rect.ey);
|
||||
(node.fillStyle || node.bkType) && ctx.fill()
|
||||
ctx.stroke()
|
||||
}
|
||||
// # sourceMappingURL=swimlaneH.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"swim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|
||||
@@ -0,0 +1,3 @@
|
||||
import { Node } from '@topology/core';
|
||||
export declare function swimlaneHIconRect(node: Node): void;
|
||||
export declare function swimlaneHTextRect(node: Node): void;
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Rect } from '@topology/core'
|
||||
export function swimlaneHIconRect (node) {
|
||||
node.iconRect = new Rect(0, 0, 0, 0)
|
||||
}
|
||||
export function swimlaneHTextRect (node) {
|
||||
node.textRect = new Rect(node.rect.x + 10, node.rect.y, 20, node.rect.height)
|
||||
node.fullTextRect = node.textRect
|
||||
}
|
||||
// # sourceMappingURL=swimlaneH.rect.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"swimlaneH.rect.js","sourceRoot":"","sources":["../../../../packages/activity-diagram/src/swimlaneH/swimlaneH.rect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,iBAAiB,CAAC,IAAU;IAC1C,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAU;IAC1C,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9E,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC;AACpC,CAAC"}
|
||||
2
nezha-fronted/src/components/common/@topology/activity-diagram/src/swimlaneV/index.d.ts
vendored
Normal file
2
nezha-fronted/src/components/common/@topology/activity-diagram/src/swimlaneV/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './swimlaneV';
|
||||
export * from './swimlaneV.rect';
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './swimlaneV'
|
||||
export * from './swimlaneV.rect'
|
||||
// # sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/activity-diagram/src/swimlaneV/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
||||
2
nezha-fronted/src/components/common/@topology/activity-diagram/src/swimlaneV/swimlaneV.d.ts
vendored
Normal file
2
nezha-fronted/src/components/common/@topology/activity-diagram/src/swimlaneV/swimlaneV.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { Node } from '@topology/core';
|
||||
export declare function swimlaneV(ctx: CanvasRenderingContext2D, node: Node): void;
|
||||
@@ -0,0 +1,27 @@
|
||||
export function swimlaneV (ctx, node) {
|
||||
let wr = node.borderRadius
|
||||
let hr = node.borderRadius
|
||||
if (node.borderRadius < 1) {
|
||||
wr = node.rect.width * node.borderRadius
|
||||
hr = node.rect.height * node.borderRadius
|
||||
}
|
||||
let r = wr < hr ? wr : hr
|
||||
if (node.rect.width < 2 * r) {
|
||||
r = node.rect.width / 2
|
||||
}
|
||||
if (node.rect.height < 2 * r) {
|
||||
r = node.rect.height / 2
|
||||
}
|
||||
ctx.beginPath()
|
||||
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.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.x + node.rect.width, node.rect.y, r)
|
||||
ctx.closePath()
|
||||
ctx.moveTo(node.rect.x, node.rect.y + 40)
|
||||
ctx.lineTo(node.rect.ex, node.rect.y + 40);
|
||||
(node.fillStyle || node.bkType) && ctx.fill()
|
||||
ctx.stroke()
|
||||
}
|
||||
// # sourceMappingURL=swimlaneV.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"swimlaneV.js","sourceRoot":"","sources":["../../../../packages/activity-diagram/src/swimlaneV/swimlaneV.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,SAAS,CAAC,GAA6B,EAAE,IAAU;IACjE,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;IAC3B,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;IAC3B,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC,EAAE;QACzB,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;QACzC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC;KAC3C;IACD,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1B,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,EAAE;QAC3B,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;KACzB;IACD,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,EAAE;QAC5B,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;KAC1B;IAED,GAAG,CAAC,SAAS,EAAE,CAAC;IAChB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzC,GAAG,CAAC,KAAK,CACP,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAC7B,IAAI,CAAC,IAAI,CA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CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9C,GAAG,CAAC,MAAM,EAAE,CAAC;AACf,CAAC"}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { Node } from '@topology/core';
|
||||
export declare function swimlaneVIconRect(node: Node): void;
|
||||
export declare function swimlaneVTextRect(node: Node): void;
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Rect } from '@topology/core'
|
||||
export function swimlaneVIconRect (node) {
|
||||
node.iconRect = new Rect(0, 0, 0, 0)
|
||||
}
|
||||
export function swimlaneVTextRect (node) {
|
||||
node.textRect = new Rect(node.rect.x, node.rect.y, node.rect.width, 40)
|
||||
node.fullTextRect = node.textRect
|
||||
}
|
||||
// # sourceMappingURL=swimlaneV.rect.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"swimlaneV.rect.js","sourceRoot":"","sources":["../../../../packages/activity-diagram/src/swimlaneV/swimlaneV.rect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,iBAAiB,CAAC,IAAU;IAC1C,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAU;IAC1C,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACxE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC;AACpC,CAAC"}
|
||||
2
nezha-fronted/src/components/common/@topology/chart-diagram/index.d.ts
vendored
Normal file
2
nezha-fronted/src/components/common/@topology/chart-diagram/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './src/echarts';
|
||||
export * from './src/register';
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './src/echarts'
|
||||
export * from './src/register'
|
||||
// # sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../packages/chart-diagram/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@topology/chart-diagram@0.3.0",
|
||||
"D:\\a\\nezha-fronted\\nezha-fronted"
|
||||
]
|
||||
],
|
||||
"_from": "@topology/chart-diagram@0.3.0",
|
||||
"_id": "@topology/chart-diagram@0.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-WUfb62Op0QxS976cNqrJ1Xaq+pfURwpo67H3TENWb+OhoNfiBl9IDANxTr1UIPLYfsjqgN3Y/8lxkL33jEl/aQ==",
|
||||
"_location": "/@topology/chart-diagram",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@topology/chart-diagram@0.3.0",
|
||||
"name": "@topology/chart-diagram",
|
||||
"escapedName": "@topology%2fchart-diagram",
|
||||
"scope": "@topology",
|
||||
"rawSpec": "0.3.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.3.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@topology/chart-diagram/-/chart-diagram-0.3.0.tgz",
|
||||
"_spec": "0.3.0",
|
||||
"_where": "D:\\a\\nezha-fronted\\nezha-fronted",
|
||||
"author": {
|
||||
"name": "alsmile123@qq.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/le5le-com/topology/issues"
|
||||
},
|
||||
"description": "A chart tool using le5le-topology.",
|
||||
"gitHead": "78f2a53ca1839c89b56e2e498d17ba4eb987ad14",
|
||||
"homepage": "https://github.com/le5le-com/topology#readme",
|
||||
"keywords": [
|
||||
"topology",
|
||||
"chart",
|
||||
"canvas"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "@topology/chart-diagram",
|
||||
"peerDependencies": {
|
||||
"@topology/core": "^0.3.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/le5le-com/topology.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc && npm run copy",
|
||||
"copy": "copyfiles package.json ../../dist/chart-diagram/"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "0.3.0"
|
||||
}
|
||||
3
nezha-fronted/src/components/common/@topology/chart-diagram/src/echarts/index.d.ts
vendored
Normal file
3
nezha-fronted/src/components/common/@topology/chart-diagram/src/echarts/index.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { Node } from '@topology/core';
|
||||
export declare const echartsObjs: any;
|
||||
export declare function echarts(ctx: CanvasRenderingContext2D, node: Node): void;
|
||||
@@ -0,0 +1,44 @@
|
||||
import { s8, createDiv, rectangle } from '@topology/core'
|
||||
export var echartsObjs = {}
|
||||
export function echarts (ctx, node) {
|
||||
// 绘制一个底图,类似于占位符。
|
||||
rectangle(ctx, node)
|
||||
// tslint:disable-next-line:no-shadowed-variable
|
||||
const echarts = echartsObjs.echarts || window.echarts
|
||||
if (!node.data || !echarts) {
|
||||
return
|
||||
}
|
||||
if (typeof node.data === 'string') {
|
||||
node.data = JSON.parse(node.data)
|
||||
}
|
||||
if (!node.data.echarts) {
|
||||
return
|
||||
}
|
||||
if (!node.elementId) {
|
||||
node.elementId = s8()
|
||||
}
|
||||
if (!node.elementLoaded) {
|
||||
echartsObjs[node.id] = {
|
||||
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
|
||||
})
|
||||
}
|
||||
}
|
||||
// # sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/chart-diagram/src/echarts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAQ,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhE,MAAM,CAAC,IAAM,WAAW,GAAQ,EAAE,CAAC;AAEnC,MAAM,UAAU,OAAO,CAAC,GAA6B,EAAE,IAAU;IAC/D,iBAAiB;IACjB,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAErB,gDAAgD;IAChD,IAAM,OAAO,GAAG,WAAW,CAAC,OAAO,IAAK,MAAc,CAAC,OAAO,CAAC;IAC/D,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;QAC1B,OAAO;KACR;IAED,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACnC;IAED,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;QACtB,OAAO;KACR;IAED,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;QACnB,IAAI,CAAC,SAAS,GAAG,EAAE,EAAE,CAAC;KACvB;IAED,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;QACvB,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG;YACrB,GAAG,EAAE,SAAS,CAAC,IAAI,CAAC;SACrB,CAAC;QACF,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QACpD,cAAc;QACd,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CACvC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,EACxB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CACxB,CAAC;QACF,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAE7B,yBAAyB;QACzB,UAAU,CAAC;YACT,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QACtC,CAAC,CAAC,CAAC;KACJ;IAED,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;QACzB,+BAA+B;QAC/B,UAAU,CAAC;YACT,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC/D,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACpC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC9B,CAAC,CAAC,CAAC;KACJ;AACH,CAAC"}
|
||||
1
nezha-fronted/src/components/common/@topology/chart-diagram/src/register.d.ts
vendored
Normal file
1
nezha-fronted/src/components/common/@topology/chart-diagram/src/register.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function register(_echarts?: any): void;
|
||||
@@ -0,0 +1,10 @@
|
||||
import { registerNode, loadJS } from '@topology/core'
|
||||
import { echarts, echartsObjs } from './echarts'
|
||||
export function register (_echarts) {
|
||||
echartsObjs.echarts = _echarts
|
||||
if (!echartsObjs.echarts && !window.echarts) {
|
||||
loadJS('https://cdn.bootcdn.net/ajax/libs/echarts/4.8.0/echarts.min.js', null, true)
|
||||
}
|
||||
registerNode('echarts', echarts, null, null, null)
|
||||
}
|
||||
// # sourceMappingURL=register.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../packages/chart-diagram/src/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,UAAU,QAAQ,CAAC,QAAc;IACrC,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IAC/B,IAAI,CAAC,WAAW,CAAC,OAAO,IAAI,CAAE,MAAc,CAAC,OAAO,EAAE;QACpD,MAAM,CACJ,gEAAgE,EAChE,IAAI,EACJ,IAAI,CACL,CAAC;KACH;IACD,YAAY,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACrD,CAAC"}
|
||||
2
nezha-fronted/src/components/common/@topology/class-diagram/index.d.ts
vendored
Normal file
2
nezha-fronted/src/components/common/@topology/class-diagram/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './src/class';
|
||||
export * from './src/register';
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './src/class'
|
||||
export * from './src/register'
|
||||
// # sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../packages/class-diagram/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC"}
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@topology/class-diagram@0.3.0",
|
||||
"D:\\a\\nezha-fronted\\nezha-fronted"
|
||||
]
|
||||
],
|
||||
"_from": "@topology/class-diagram@0.3.0",
|
||||
"_id": "@topology/class-diagram@0.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-J+qKEg/+3EyyZotP2TbZtM+NcOeRh2PIEwzBZGS6KOU5RvBi4NMRO2DQNN++q8Zpb7RG7WYGAaTB2H4+YcXJzA==",
|
||||
"_location": "/@topology/class-diagram",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@topology/class-diagram@0.3.0",
|
||||
"name": "@topology/class-diagram",
|
||||
"escapedName": "@topology%2fclass-diagram",
|
||||
"scope": "@topology",
|
||||
"rawSpec": "0.3.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.3.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@topology/class-diagram/-/class-diagram-0.3.0.tgz",
|
||||
"_spec": "0.3.0",
|
||||
"_where": "D:\\a\\nezha-fronted\\nezha-fronted",
|
||||
"author": {
|
||||
"name": "alsmile123@qq.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/le5le-com/topology/issues"
|
||||
},
|
||||
"description": "A class diagram tool using le5le-topology.",
|
||||
"gitHead": "78f2a53ca1839c89b56e2e498d17ba4eb987ad14",
|
||||
"homepage": "https://github.com/le5le-com/topology#readme",
|
||||
"keywords": [
|
||||
"topology",
|
||||
"class diagram",
|
||||
"canvas"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "@topology/class-diagram",
|
||||
"peerDependencies": {
|
||||
"@topology/core": "^0.3.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/le5le-com/topology.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc && npm run copy",
|
||||
"copy": "copyfiles package.json ../../dist/class-diagram/"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "0.3.0"
|
||||
}
|
||||
3
nezha-fronted/src/components/common/@topology/class-diagram/src/class/class.d.ts
vendored
Normal file
3
nezha-fronted/src/components/common/@topology/class-diagram/src/class/class.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { Node } from '@topology/core';
|
||||
export declare function simpleClass(ctx: CanvasRenderingContext2D, node: Node): void;
|
||||
export declare function interfaceClass(ctx: CanvasRenderingContext2D, node: Node): void;
|
||||
@@ -0,0 +1,56 @@
|
||||
export function simpleClass (ctx, node) {
|
||||
let wr = node.borderRadius
|
||||
let hr = node.borderRadius
|
||||
if (node.borderRadius < 1) {
|
||||
wr = node.rect.width * node.borderRadius
|
||||
hr = node.rect.height * node.borderRadius
|
||||
}
|
||||
let r = wr < hr ? wr : hr
|
||||
if (node.rect.width < 2 * r) {
|
||||
r = node.rect.width / 2
|
||||
}
|
||||
if (node.rect.height < 2 * r) {
|
||||
r = node.rect.height / 2
|
||||
}
|
||||
ctx.beginPath()
|
||||
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.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.x + node.rect.width, node.rect.y, r)
|
||||
ctx.closePath()
|
||||
ctx.moveTo(node.rect.x, node.rect.y + 40)
|
||||
ctx.lineTo(node.rect.ex, node.rect.y + 40);
|
||||
(node.fillStyle || node.bkType) && ctx.fill()
|
||||
ctx.stroke()
|
||||
}
|
||||
export function interfaceClass (ctx, node) {
|
||||
let wr = node.borderRadius
|
||||
let hr = node.borderRadius
|
||||
if (node.borderRadius < 1) {
|
||||
wr = node.rect.width * node.borderRadius
|
||||
hr = node.rect.height * node.borderRadius
|
||||
}
|
||||
let r = wr < hr ? wr : hr
|
||||
if (node.rect.width < 2 * r) {
|
||||
r = node.rect.width / 2
|
||||
}
|
||||
if (node.rect.height < 2 * r) {
|
||||
r = node.rect.height / 2
|
||||
}
|
||||
ctx.beginPath()
|
||||
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.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.x + node.rect.width, node.rect.y, r)
|
||||
ctx.closePath()
|
||||
ctx.moveTo(node.rect.x, node.rect.y + 40)
|
||||
ctx.lineTo(node.rect.ex, node.rect.y + 40)
|
||||
const height = node.rect.y + 20 + node.rect.height / 2
|
||||
ctx.moveTo(node.rect.x, height)
|
||||
ctx.lineTo(node.rect.ex, height);
|
||||
(node.fillStyle || node.bkType) && ctx.fill()
|
||||
ctx.stroke()
|
||||
}
|
||||
// # sourceMappingURL=class.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../../../packages/class-diagram/src/class/class.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CAAC,GAA6B,EAAE,IAAU;IACnE,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;IAC3B,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;IAC3B,I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@topology/class-diagram/src/class/class.rect.d.ts
vendored
Normal file
5
nezha-fronted/src/components/common/@topology/class-diagram/src/class/class.rect.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { Node } from '@topology/core';
|
||||
export declare function simpleClassIconRect(node: Node): void;
|
||||
export declare function simpleClassTextRect(node: Node): void;
|
||||
export declare function interfaceClassIconRect(node: Node): void;
|
||||
export declare function interfaceClassTextRect(node: Node): void;
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Rect } from '@topology/core'
|
||||
export function simpleClassIconRect (node) {
|
||||
node.iconRect = new Rect(0, 0, 0, 0)
|
||||
}
|
||||
export function simpleClassTextRect (node) {
|
||||
node.textRect = new Rect(node.rect.x, node.rect.y, node.rect.width, 40)
|
||||
node.fullTextRect = node.textRect
|
||||
}
|
||||
export function interfaceClassIconRect (node) {
|
||||
node.iconRect = new Rect(0, 0, 0, 0)
|
||||
}
|
||||
export function interfaceClassTextRect (node) {
|
||||
node.textRect = new Rect(node.rect.x, node.rect.y, node.rect.width, 40)
|
||||
node.fullTextRect = node.textRect
|
||||
}
|
||||
// # sourceMappingURL=class.rect.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"class.rect.js","sourceRoot":"","sources":["../../../../packages/class-diagram/src/class/class.rect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,mBAAmB,CAAC,IAAU;IAC5C,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAU;IAC5C,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACxE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,IAAU;IAC/C,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,IAAU;IAC/C,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACxE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC;AACpC,CAAC"}
|
||||
2
nezha-fronted/src/components/common/@topology/class-diagram/src/class/index.d.ts
vendored
Normal file
2
nezha-fronted/src/components/common/@topology/class-diagram/src/class/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './class';
|
||||
export * from './class.rect';
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './class'
|
||||
export * from './class.rect'
|
||||
// # sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/class-diagram/src/class/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
|
||||
1
nezha-fronted/src/components/common/@topology/class-diagram/src/register.d.ts
vendored
Normal file
1
nezha-fronted/src/components/common/@topology/class-diagram/src/register.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function register(): void;
|
||||
@@ -0,0 +1,7 @@
|
||||
import { registerNode } from '@topology/core'
|
||||
import { simpleClass, simpleClassIconRect, simpleClassTextRect, interfaceClass, interfaceClassIconRect, interfaceClassTextRect } from './class'
|
||||
export function register () {
|
||||
registerNode('simpleClass', simpleClass, null, simpleClassIconRect, simpleClassTextRect)
|
||||
registerNode('interfaceClass', interfaceClass, null, interfaceClassIconRect, interfaceClassTextRect)
|
||||
}
|
||||
// # sourceMappingURL=register.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../packages/class-diagram/src/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,WAAW,EAAE,mBAAmB,EAAE,mBAAmB,EACrD,cAAc,EAAE,sBAAsB,EAAE,sBAAsB,EAC/D,MAAM,SAAS,CAAC;AAEjB,MAAM,UAAU,QAAQ;IACtB,YAAY,CAAC,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,mBAAmB,EAAE,mBAAmB,CAAC,CAAC;IACzF,YAAY,CAAC,gBAAgB,EAAE,cAAc,EAAE,IAAI,EAAE,sBAAsB,EAAE,sBAAsB,CAAC,CAAC;AACvG,CAAC"}
|
||||
5
nezha-fronted/src/components/common/@topology/core/index.d.ts
vendored
Normal file
5
nezha-fronted/src/components/common/@topology/core/index.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from './src/core';
|
||||
export * from './src/options';
|
||||
export * from './src/utils';
|
||||
export * from './src/models';
|
||||
export * from './src/middles';
|
||||
@@ -0,0 +1,6 @@
|
||||
export * from './src/core'
|
||||
export * from './src/options'
|
||||
export * from './src/utils'
|
||||
export * from './src/models'
|
||||
export * from './src/middles'
|
||||
// # sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../packages/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
||||
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@topology/core@0.5.33",
|
||||
"D:\\a\\nezha-fronted\\nezha-fronted"
|
||||
]
|
||||
],
|
||||
"_from": "@topology/core@0.5.33",
|
||||
"_id": "@topology/core@0.5.33",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-aS5eoCUEDbrh/TGxl2rCXmdu8ww=",
|
||||
"_location": "/@topology/core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@topology/core@0.5.33",
|
||||
"name": "@topology/core",
|
||||
"escapedName": "@topology%2fcore",
|
||||
"scope": "@topology",
|
||||
"rawSpec": "0.5.33",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.5.33"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmmirror.com/@topology/core/download/@topology/core-0.5.33.tgz",
|
||||
"_spec": "0.5.33",
|
||||
"_where": "D:\\a\\nezha-fronted\\nezha-fronted",
|
||||
"author": {
|
||||
"name": "alsmile123@qq.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/le5le-com/topology/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"le5le-store": "^1.0.7",
|
||||
"mitt": "^2.1.0",
|
||||
"mqtt": "^4.2.6"
|
||||
},
|
||||
"description": "A diagram/topology tool by js.",
|
||||
"gitHead": "78f2a53ca1839c89b56e2e498d17ba4eb987ad14",
|
||||
"homepage": "https://github.com/le5le-com/topology#readme",
|
||||
"keywords": [
|
||||
"topology",
|
||||
"diagram",
|
||||
"canvas"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "@topology/core",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/le5le-com/topology.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc && npm run copy",
|
||||
"copy": "copyfiles package.json ../../dist/core/"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "0.5.33"
|
||||
}
|
||||
60
nezha-fronted/src/components/common/@topology/core/src/activeLayer.d.ts
vendored
Normal file
60
nezha-fronted/src/components/common/@topology/core/src/activeLayer.d.ts
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
import { Options } from './options';
|
||||
import { Pen } from './models/pen';
|
||||
import { Node } from './models/node';
|
||||
import { Line } from './models/line';
|
||||
import { Rect } from './models/rect';
|
||||
import { Point } from './models/point';
|
||||
import { Layer } from './layer';
|
||||
import { Topology } from './core';
|
||||
export declare class ActiveLayer extends Layer {
|
||||
options: Options;
|
||||
rotateCPs: Point[];
|
||||
sizeCPs: Point[];
|
||||
rect: Rect;
|
||||
activeRect: Rect;
|
||||
pens: Pen[];
|
||||
rotate: number;
|
||||
lastOffsetX: number;
|
||||
lastOffsetY: number;
|
||||
initialSizeCPs: Point[];
|
||||
nodeRects: Rect[];
|
||||
childrenRects: {
|
||||
[key: string]: Rect;
|
||||
};
|
||||
childrenRotate: {
|
||||
[key: string]: number;
|
||||
};
|
||||
dockWatchers: Point[];
|
||||
topology: Topology;
|
||||
rotating: boolean;
|
||||
constructor(options: Options, TID: string);
|
||||
calcControlPoints(): void;
|
||||
locked(): boolean;
|
||||
getPoints(): Point[];
|
||||
clear(): void;
|
||||
saveNodeRects(): void;
|
||||
private saveChildrenRects;
|
||||
resize(type: number, pt1: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, pt2: {
|
||||
x: number;
|
||||
y: number;
|
||||
ctrlKey?: boolean;
|
||||
altKey?: boolean;
|
||||
shiftKey?: boolean;
|
||||
}): void;
|
||||
move(x: number, y: number): void;
|
||||
getLinesOfNode(node: Node): Line[];
|
||||
updateLines(pens?: Pen[]): void;
|
||||
offsetRotate(angle: number): void;
|
||||
rotateChildren(node: Pen): void;
|
||||
updateRotate(): void;
|
||||
add(pen: Pen): void;
|
||||
setPens(pens: Pen[]): void;
|
||||
has(pen: Pen): boolean;
|
||||
hasInAll(pen: Pen, pens?: Pen[]): boolean;
|
||||
render(ctx: CanvasRenderingContext2D): void;
|
||||
calcActiveRect(): void;
|
||||
getDockWatchers(): void;
|
||||
}
|
||||
@@ -0,0 +1,735 @@
|
||||
import { Store } from 'le5le-store'
|
||||
import { PenType } from './models/pen'
|
||||
import { Node } from './models/node'
|
||||
import { Line } from './models/line'
|
||||
import { Rect } from './models/rect'
|
||||
import { Point } from './models/point'
|
||||
import { Lock } from './models/status'
|
||||
import { drawLineFns } from './middles'
|
||||
import { getBezierPoint } from './middles/lines/curve'
|
||||
import { Layer } from './layer'
|
||||
import { find, flatNodes, getBboxOfPoints, rgba, deepClone, getRect } from './utils'
|
||||
const __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __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)
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b)
|
||||
function __ () { this.constructor = d }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __())
|
||||
}
|
||||
})()
|
||||
const ActiveLayer = /** @class */ (function (_super) {
|
||||
__extends(ActiveLayer, _super)
|
||||
function ActiveLayer (options, TID) {
|
||||
if (options === void 0) { options = {} }
|
||||
const _this = _super.call(this, TID) || this
|
||||
_this.options = options
|
||||
_this.rotateCPs = []
|
||||
_this.sizeCPs = []
|
||||
_this.pens = []
|
||||
_this.rotate = 0
|
||||
_this.lastOffsetX = 0
|
||||
_this.lastOffsetY = 0
|
||||
// 备份初始位置,方便移动事件处理
|
||||
_this.initialSizeCPs = []
|
||||
_this.nodeRects = []
|
||||
_this.childrenRects = {}
|
||||
_this.childrenRotate = {}
|
||||
// nodes移动时,停靠点的参考位置
|
||||
_this.dockWatchers = []
|
||||
_this.rotating = false
|
||||
Store.set(_this.generateStoreKey('LT:ActiveLayer'), _this)
|
||||
return _this
|
||||
}
|
||||
ActiveLayer.prototype.calcControlPoints = function () {
|
||||
if (this.pens.length === 1 && this.pens[0] instanceof Node) {
|
||||
this.rect = this.pens[0].rect
|
||||
this.sizeCPs = this.pens[0].rect.toPoints()
|
||||
this.rotateCPs = [
|
||||
new Point(this.pens[0].rect.x + this.pens[0].rect.width / 2, this.pens[0].rect.y - 35),
|
||||
new Point(this.pens[0].rect.x + this.pens[0].rect.width / 2, this.pens[0].rect.y)
|
||||
]
|
||||
if (this.rotate || this.pens[0].rotate) {
|
||||
for (let _i = 0, _a = this.sizeCPs; _i < _a.length; _i++) {
|
||||
var pt = _a[_i]
|
||||
if (this.pens[0].rotate) {
|
||||
pt.rotate(this.pens[0].rotate, this.pens[0].rect.center)
|
||||
}
|
||||
if (this.rotate) {
|
||||
pt.rotate(this.rotate, this.rect.center)
|
||||
}
|
||||
}
|
||||
for (let _b = 0, _c = this.rotateCPs; _b < _c.length; _b++) {
|
||||
var pt = _c[_b]
|
||||
if (this.pens[0].rotate) {
|
||||
pt.rotate(this.pens[0].rotate, this.pens[0].rect.center)
|
||||
}
|
||||
if (this.rotate) {
|
||||
pt.rotate(this.rotate, this.rect.center)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.options.hideRotateCP || this.pens[0].hideRotateCP) {
|
||||
this.rotateCPs = [new Point(-1000, -1000), new Point(-1000, -1000)]
|
||||
}
|
||||
return
|
||||
}
|
||||
const _d = getBboxOfPoints(this.getPoints()); const x1 = _d.x1; const y1 = _d.y1; const x2 = _d.x2; const y2 = _d.y2
|
||||
this.rect = new Rect(x1, y1, x2 - x1, y2 - y1)
|
||||
this.sizeCPs = [
|
||||
new Point(x1, y1),
|
||||
new Point(x2, y1),
|
||||
new Point(x2, y2),
|
||||
new Point(x1, y2)
|
||||
]
|
||||
this.rotateCPs = [
|
||||
new Point(x1 + (x2 - x1) / 2, y1 - 35),
|
||||
new Point(x1 + (x2 - x1) / 2, y1)
|
||||
]
|
||||
if (this.options.hideRotateCP) {
|
||||
this.rotateCPs = [new Point(-1000, -1000), new Point(-1000, -1000)]
|
||||
}
|
||||
}
|
||||
ActiveLayer.prototype.locked = function () {
|
||||
for (let _i = 0, _a = this.pens; _i < _a.length; _i++) {
|
||||
const item = _a[_i]
|
||||
if (!item.locked) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
ActiveLayer.prototype.getPoints = function () {
|
||||
const points = []
|
||||
for (let _i = 0, _a = this.pens; _i < _a.length; _i++) {
|
||||
const item = _a[_i]
|
||||
if (item.type === PenType.Node) {
|
||||
const pts = item.rect.toPoints()
|
||||
if (item.rotate) {
|
||||
for (let _b = 0, pts_1 = pts; _b < pts_1.length; _b++) {
|
||||
const pt = pts_1[_b]
|
||||
pt.rotate(item.rotate, item.rect.center)
|
||||
}
|
||||
}
|
||||
points.push.apply(points, pts)
|
||||
} else if (item instanceof Line) {
|
||||
if (item.children) {
|
||||
item.children.forEach(function (child) {
|
||||
points.push(child.from)
|
||||
points.push(child.to)
|
||||
if (child.name === 'curve') {
|
||||
for (let i = 0.01; i < 1; i += 0.02) {
|
||||
points.push(getBezierPoint(i, child.from, child.controlPoints[0], child.controlPoints[1], child.to))
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (item.from) {
|
||||
points.push(item.from)
|
||||
points.push(item.to)
|
||||
if (item.name === 'curve') {
|
||||
for (let i = 0.01; i < 1; i += 0.02) {
|
||||
points.push(getBezierPoint(i, item.from, item.controlPoints[0], item.controlPoints[1], item.to))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return points
|
||||
}
|
||||
ActiveLayer.prototype.clear = function () {
|
||||
this.pens = []
|
||||
this.sizeCPs = []
|
||||
this.rotateCPs = []
|
||||
Store.set(this.generateStoreKey('LT:activeNode'), undefined)
|
||||
}
|
||||
// 即将缩放选中的nodes,备份nodes最初大小,方便缩放比例计算
|
||||
ActiveLayer.prototype.saveNodeRects = function () {
|
||||
this.nodeRects = []
|
||||
this.childrenRects = {}
|
||||
for (let _i = 0, _a = this.pens; _i < _a.length; _i++) {
|
||||
var item = _a[_i]
|
||||
if (item.type && item.from) {
|
||||
this.nodeRects.push(new Rect(item.from.x, item.from.y, item.rect.width, item.rect.height))
|
||||
} else {
|
||||
this.nodeRects.push(new Rect(item.rect.x, item.rect.y, item.rect.width, item.rect.height))
|
||||
}
|
||||
this.saveChildrenRects(item)
|
||||
}
|
||||
this.initialSizeCPs = []
|
||||
for (let _b = 0, _c = this.sizeCPs; _b < _c.length; _b++) {
|
||||
var item = _c[_b]
|
||||
this.initialSizeCPs.push(item.clone())
|
||||
}
|
||||
this.getDockWatchers()
|
||||
}
|
||||
ActiveLayer.prototype.saveChildrenRects = function (node) {
|
||||
if (node.type || !node.children) {
|
||||
return
|
||||
}
|
||||
for (let _i = 0, _a = node.children; _i < _a.length; _i++) {
|
||||
const item = _a[_i]
|
||||
this.childrenRects[item.id] = new Rect(item.rect.x, item.rect.y, item.rect.width, item.rect.height)
|
||||
this.childrenRotate[item.id] = item.rotate
|
||||
this.saveChildrenRects(item)
|
||||
}
|
||||
}
|
||||
// pt1 - the point of mouse down.
|
||||
// pt2 - the point of mouse move.
|
||||
ActiveLayer.prototype.resize = function (type, pt1, pt2) {
|
||||
const p1 = new Point(pt1.x, pt1.y)
|
||||
const p2 = new Point(pt2.x, pt2.y)
|
||||
if (this.pens.length === 1 && this.pens[0].rotate % 360) {
|
||||
p1.rotate(-this.pens[0].rotate, this.nodeRects[0].center)
|
||||
p2.rotate(-this.pens[0].rotate, this.nodeRects[0].center)
|
||||
}
|
||||
const x = p2.x - p1.x
|
||||
const y = p2.y - p1.y
|
||||
let offsetX = x - this.lastOffsetX
|
||||
let offsetY = y - this.lastOffsetY
|
||||
this.lastOffsetX = x
|
||||
this.lastOffsetY = y
|
||||
const w = this.activeRect.width
|
||||
const h = this.activeRect.height
|
||||
if (pt2.shiftKey) {
|
||||
offsetY = (offsetX * h) / w
|
||||
}
|
||||
// const lines: Line[] = [];
|
||||
switch (type) {
|
||||
case 0:
|
||||
if (this.activeRect.width - offsetX < 5 || this.activeRect.height - offsetY < 5) {
|
||||
return
|
||||
}
|
||||
if (!pt2.shiftKey) {
|
||||
// offsetX = -offsetX;
|
||||
// offsetY = -offsetY;
|
||||
this.activeRect.x += offsetX
|
||||
this.activeRect.y += offsetY
|
||||
this.activeRect.width -= offsetX
|
||||
this.activeRect.height -= offsetY
|
||||
} else {
|
||||
offsetX = -offsetX
|
||||
offsetY = -offsetY
|
||||
this.activeRect.ex += offsetX
|
||||
this.activeRect.ey += offsetY
|
||||
this.activeRect.width += offsetX
|
||||
this.activeRect.height += offsetY
|
||||
}
|
||||
break
|
||||
case 1:
|
||||
// offsetY = -offsetY;
|
||||
if (this.activeRect.width + offsetX < 5 || this.activeRect.height - offsetY < 5) {
|
||||
return
|
||||
}
|
||||
if (!pt2.shiftKey) {
|
||||
this.activeRect.ex += offsetX
|
||||
this.activeRect.y += offsetY
|
||||
this.activeRect.width += offsetX
|
||||
this.activeRect.height -= offsetY
|
||||
} else {
|
||||
// offsetX = -offsetX;
|
||||
// offsetY = -offsetY;
|
||||
this.activeRect.ex += offsetX
|
||||
this.activeRect.ey += offsetY
|
||||
this.activeRect.width += offsetX
|
||||
this.activeRect.height += offsetY
|
||||
}
|
||||
break
|
||||
case 2:
|
||||
if (this.activeRect.width + offsetX < 5 || this.activeRect.height + offsetY < 5) {
|
||||
return
|
||||
}
|
||||
this.activeRect.ex += offsetX
|
||||
this.activeRect.ey += offsetY
|
||||
this.activeRect.width += offsetX
|
||||
this.activeRect.height += offsetY
|
||||
break
|
||||
case 3:
|
||||
// offsetX = -offsetX;
|
||||
if (this.activeRect.width - offsetX < 5 || this.activeRect.height + offsetY < 5) {
|
||||
return
|
||||
}
|
||||
if (!pt2.shiftKey) {
|
||||
this.activeRect.x += offsetX
|
||||
this.activeRect.ey += offsetY
|
||||
this.activeRect.width -= offsetX
|
||||
this.activeRect.height += offsetY
|
||||
} else {
|
||||
offsetX = -offsetX
|
||||
offsetY = -offsetY
|
||||
this.activeRect.ex += offsetX
|
||||
this.activeRect.ey += offsetY
|
||||
this.activeRect.width += offsetX
|
||||
this.activeRect.height += offsetY
|
||||
}
|
||||
break
|
||||
}
|
||||
const scaleX = this.activeRect.width / w
|
||||
const scaleY = this.activeRect.height / h
|
||||
// let i = 0;
|
||||
for (let _i = 0, _a = this.pens; _i < _a.length; _i++) {
|
||||
const item = _a[_i]
|
||||
if (item.locked) {
|
||||
continue
|
||||
}
|
||||
switch (item.type) {
|
||||
case PenType.Line:
|
||||
break
|
||||
default:
|
||||
item.oldRect = item.rect.clone()
|
||||
if (!this.options.disableSizeX &&
|
||||
!pt2.ctrlKey &&
|
||||
!item.disableSizeX) {
|
||||
// item.rect.width = this.nodeRects[i].width + offsetX;
|
||||
item.rect.width *= scaleX
|
||||
if (item.imageWidth) {
|
||||
item.imageWidth *= scaleX
|
||||
}
|
||||
}
|
||||
if (!this.options.disableSizeY &&
|
||||
!pt2.altKey &&
|
||||
!item.disableSizeY) {
|
||||
// item.rect.height = this.nodeRects[i].height + offsetY;
|
||||
item.rect.height *= scaleY
|
||||
if (item.imageHeight) {
|
||||
item.imageHeight *= scaleY
|
||||
}
|
||||
}
|
||||
if ((!this.options.disableSizeX &&
|
||||
pt2.shiftKey &&
|
||||
!item.disableSizeX) ||
|
||||
(!this.options.disableSizeY &&
|
||||
pt2.shiftKey &&
|
||||
!item.disableSizeY)) {
|
||||
// item.rect.width = this.nodeRects[i].width + offsetX;
|
||||
// item.rect.height = this.nodeRects[i].height + offsetY;
|
||||
item.rect.width *= scaleX
|
||||
item.rect.height *= scaleY
|
||||
if (item.imageWidth) {
|
||||
item.imageWidth *= scaleX
|
||||
}
|
||||
if (item.imageHeight) {
|
||||
item.imageHeight *= scaleY
|
||||
}
|
||||
}
|
||||
switch (type) {
|
||||
case 0:
|
||||
item.rect.x = item.rect.ex - item.rect.width
|
||||
item.rect.y = item.rect.ey - item.rect.height
|
||||
break
|
||||
case 1:
|
||||
item.rect.ex = item.rect.x + item.rect.width
|
||||
item.rect.y = item.rect.ey - item.rect.height
|
||||
break
|
||||
case 2:
|
||||
item.rect.ex = item.rect.x + item.rect.width
|
||||
item.rect.ey = item.rect.y + item.rect.height
|
||||
break
|
||||
case 3:
|
||||
item.rect.x = item.rect.ex - item.rect.width
|
||||
item.rect.ey = item.rect.y + item.rect.height
|
||||
break
|
||||
}
|
||||
item.scalePoints()
|
||||
item.rect.calcCenter()
|
||||
item.init()
|
||||
item.calcChildrenRect()
|
||||
break
|
||||
}
|
||||
if (item.parentId) {
|
||||
let parent_1 = void 0
|
||||
for (let _b = 0, _c = this.data.pens; _b < _c.length; _b++) {
|
||||
const n = _c[_b]
|
||||
if (n.id === item.parentId) {
|
||||
parent_1 = n
|
||||
item.calcRectInParent(parent_1)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
// ++i;
|
||||
}
|
||||
this.updateLines()
|
||||
}
|
||||
ActiveLayer.prototype.move = function (x, y) {
|
||||
if (this.nodeRects.length !== this.pens.length) {
|
||||
return
|
||||
}
|
||||
let i = 0
|
||||
const _loop_1 = function (item) {
|
||||
if (item.locked) {
|
||||
return 'continue'
|
||||
}
|
||||
if (item instanceof Node) {
|
||||
const offsetX = this_1.nodeRects[i].x + x - item.rect.x
|
||||
const offsetY = this_1.nodeRects[i].y + y - item.rect.y
|
||||
item.translate(offsetX, offsetY)
|
||||
const lines = this_1.getLinesOfNode(item)
|
||||
for (let _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
|
||||
const line = lines_1[_i]
|
||||
line.translate(offsetX, offsetY)
|
||||
}
|
||||
item.calcChildrenRect()
|
||||
if (item.parentId && !item.locked) {
|
||||
let parent_2 = void 0
|
||||
for (let _a = 0, _b = this_1.data.pens; _a < _b.length; _a++) {
|
||||
const n = _b[_a]
|
||||
if (n.id === item.parentId) {
|
||||
parent_2 = n
|
||||
item.calcRectInParent(parent_2)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item instanceof Line && item.from) {
|
||||
const offsetX_1 = this_1.nodeRects[i].x + x - item.from.x
|
||||
const offsetY_1 = this_1.nodeRects[i].y + y - item.from.y
|
||||
if (item.parentId) {
|
||||
const items = find(item.parentId, this_1.data.pens)
|
||||
items.forEach(function (l) {
|
||||
l.translate(offsetX_1, offsetY_1)
|
||||
})
|
||||
} else {
|
||||
item.translate(offsetX_1, offsetY_1)
|
||||
}
|
||||
}
|
||||
++i
|
||||
}
|
||||
var this_1 = this
|
||||
for (let _i = 0, _a = this.pens; _i < _a.length; _i++) {
|
||||
const item = _a[_i]
|
||||
_loop_1(item)
|
||||
}
|
||||
this.updateLines()
|
||||
this.topology.dispatch('move', this.pens)
|
||||
}
|
||||
ActiveLayer.prototype.getLinesOfNode = function (node) {
|
||||
const result = []
|
||||
const nodesLines = flatNodes([node])
|
||||
for (let _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
||||
const pen = _a[_i]
|
||||
if (!(pen instanceof Line)) {
|
||||
continue
|
||||
}
|
||||
const line = pen
|
||||
let fromIn = false
|
||||
let toIn = false
|
||||
for (let _b = 0, _c = nodesLines.nodes; _b < _c.length; _b++) {
|
||||
const item = _c[_b]
|
||||
if (line.from && line.from.id === item.id) {
|
||||
fromIn = true
|
||||
}
|
||||
if (line.to && line.to.id === item.id) {
|
||||
toIn = true
|
||||
}
|
||||
}
|
||||
if (fromIn && toIn) {
|
||||
result.push(line)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
ActiveLayer.prototype.updateLines = function (pens) {
|
||||
if (!pens) {
|
||||
pens = this.pens
|
||||
}
|
||||
const allPens = flatNodes(this.data.pens)
|
||||
const allLines = allPens.lines
|
||||
let nodes = allPens.nodes
|
||||
if (!this.options.autoAnchor) { // 非自动瞄点,只要活动层的 nodes
|
||||
nodes = flatNodes(pens).nodes
|
||||
}
|
||||
const lines = []
|
||||
for (let _i = 0, allLines_1 = allLines; _i < allLines_1.length; _i++) {
|
||||
const line = allLines_1[_i]
|
||||
for (let _a = 0, nodes_1 = nodes; _a < nodes_1.length; _a++) {
|
||||
const item = nodes_1[_a]
|
||||
let cnt = 0
|
||||
if (line.from && line.from.id === item.id) {
|
||||
if (line.from.autoAnchor) {
|
||||
var autoAnchor = item.nearestAnchor(line.to)
|
||||
if (autoAnchor.index > -1) {
|
||||
line.from.anchorIndex = autoAnchor.index
|
||||
line.from.direction = autoAnchor.direction
|
||||
}
|
||||
}
|
||||
if (line.from.anchorIndex >= 0) {
|
||||
line.from.x = item.rotatedAnchors[line.from.anchorIndex].x
|
||||
line.from.y = item.rotatedAnchors[line.from.anchorIndex].y
|
||||
++cnt
|
||||
}
|
||||
}
|
||||
if (line.to && line.to.id === item.id) {
|
||||
if (line.to.autoAnchor) {
|
||||
var autoAnchor = item.nearestAnchor(line.from)
|
||||
if (autoAnchor.index > -1) {
|
||||
line.to.anchorIndex = autoAnchor.index
|
||||
line.to.direction = autoAnchor.direction
|
||||
}
|
||||
}
|
||||
if (line.to.anchorIndex >= 0) {
|
||||
line.to.x = item.rotatedAnchors[line.to.anchorIndex].x
|
||||
line.to.y = item.rotatedAnchors[line.to.anchorIndex].y
|
||||
++cnt
|
||||
}
|
||||
}
|
||||
if (cnt && !this.data.manualCps) {
|
||||
line.calcControlPoints()
|
||||
}
|
||||
line.textRect = undefined
|
||||
Store.set(this.generateStoreKey('pts-') + line.id, undefined)
|
||||
lines.push(line)
|
||||
}
|
||||
}
|
||||
Store.set(this.generateStoreKey('LT:updateLines'), lines)
|
||||
}
|
||||
ActiveLayer.prototype.offsetRotate = function (angle) {
|
||||
this.rotating = true
|
||||
let i = 0
|
||||
for (let _i = 0, _a = this.pens; _i < _a.length; _i++) {
|
||||
const item = _a[_i]
|
||||
if (!(item instanceof Node)) {
|
||||
continue
|
||||
}
|
||||
const center = this.nodeRects[i].center.clone()
|
||||
if (this.pens.length > 1) {
|
||||
center.rotate(angle, this.rect.center)
|
||||
}
|
||||
item.rect.x = center.x - item.rect.width / 2
|
||||
item.rect.y = center.y - item.rect.height / 2
|
||||
item.rect.ex = item.rect.x + item.rect.width
|
||||
item.rect.ey = item.rect.y + item.rect.height
|
||||
item.rect.calcCenter()
|
||||
item.init()
|
||||
item.offsetRotate = angle
|
||||
item.calcRotateAnchors(item.rotate + item.offsetRotate)
|
||||
this.rotateChildren(item)
|
||||
++i
|
||||
}
|
||||
this.rotate = angle
|
||||
this.topology.dispatch('rotated', this.pens)
|
||||
}
|
||||
ActiveLayer.prototype.rotateChildren = function (node) {
|
||||
if (node.type !== PenType.Node || !node.children) {
|
||||
return
|
||||
}
|
||||
for (let _i = 0, _a = node.children; _i < _a.length; _i++) {
|
||||
const item = _a[_i]
|
||||
if (item.type !== PenType.Node) {
|
||||
continue
|
||||
}
|
||||
const oldCenter = this.childrenRects[item.id].center.clone()
|
||||
const newCenter = this.childrenRects[item.id].center
|
||||
.clone()
|
||||
.rotate(this.rotate, this.rect.center)
|
||||
const rect = this.childrenRects[item.id].clone()
|
||||
rect.translate(newCenter.x - oldCenter.x, newCenter.y - oldCenter.y)
|
||||
item.rect = rect
|
||||
item.rotate = this.childrenRotate[item.id] + this.rotate
|
||||
item.init()
|
||||
this.rotateChildren(item)
|
||||
}
|
||||
}
|
||||
ActiveLayer.prototype.updateRotate = function () {
|
||||
for (let _i = 0, _a = this.pens; _i < _a.length; _i++) {
|
||||
const item = _a[_i]
|
||||
item.rotate += item.offsetRotate
|
||||
if (item.type === PenType.Node && item.rectInParent) {
|
||||
item.rectInParent.rotate += item.offsetRotate
|
||||
}
|
||||
item.offsetRotate = 0
|
||||
}
|
||||
this.rotate = 0
|
||||
this.rotating = false
|
||||
}
|
||||
ActiveLayer.prototype.add = function (pen) {
|
||||
if (this.has(pen)) {
|
||||
return
|
||||
}
|
||||
this.pens.push(pen)
|
||||
if (pen instanceof Node) {
|
||||
Store.set(this.generateStoreKey('LT:activeNode'), pen)
|
||||
}
|
||||
}
|
||||
ActiveLayer.prototype.setPens = function (pens) {
|
||||
this.pens = pens
|
||||
if (this.pens.length === 1 && this.pens[0] instanceof Node) {
|
||||
Store.set(this.generateStoreKey('LT:activeNode'), this.pens[0])
|
||||
}
|
||||
}
|
||||
ActiveLayer.prototype.has = function (pen) {
|
||||
for (let _i = 0, _a = this.pens; _i < _a.length; _i++) {
|
||||
const item = _a[_i]
|
||||
if (item.id === pen.id) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
ActiveLayer.prototype.hasInAll = function (pen, pens) {
|
||||
if (!pens) {
|
||||
pens = this.pens
|
||||
}
|
||||
for (let _i = 0, pens_1 = pens; _i < pens_1.length; _i++) {
|
||||
const item = pens_1[_i]
|
||||
if (item.id === pen.id) {
|
||||
return true
|
||||
}
|
||||
if (item.children) {
|
||||
const has = this.hasInAll(pen, item.children)
|
||||
if (has) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
ActiveLayer.prototype.render = function (ctx) {
|
||||
const _this = this
|
||||
if (this.data.locked > Lock.Readonly ||
|
||||
this.options.activeColor === 'transparent') {
|
||||
return
|
||||
}
|
||||
if (!this.pens.length) {
|
||||
return
|
||||
}
|
||||
this.pens.forEach(function (pen) {
|
||||
if (!pen.getTID()) {
|
||||
pen.setTID(_this.TID)
|
||||
}
|
||||
})
|
||||
if (this.pens.length === 1 || !this.rotating) {
|
||||
this.calcControlPoints()
|
||||
}
|
||||
ctx.save()
|
||||
ctx.strokeStyle = this.options.activeColor
|
||||
ctx.fillStyle = '#fff'
|
||||
ctx.lineWidth = 1
|
||||
const TID = this.TID
|
||||
const scale = Store.get(this.generateStoreKey('LT:scale')) || 1
|
||||
for (let _i = 0, _a = this.pens; _i < _a.length; _i++) {
|
||||
var item = _a[_i]
|
||||
if (this.data.locked && item instanceof Node) {
|
||||
var tmp = new Node(item)
|
||||
tmp.setTID(TID)
|
||||
tmp.data = undefined
|
||||
tmp.fillStyle = undefined
|
||||
tmp.bkType = 0
|
||||
tmp.icon = ''
|
||||
tmp.image = ''
|
||||
tmp.text = ''
|
||||
if (tmp.strokeStyle !== 'transparent') {
|
||||
tmp.strokeStyle = '#ffffff'
|
||||
tmp.lineWidth += 2
|
||||
tmp.render(ctx)
|
||||
tmp.strokeStyle = this.options.activeColor
|
||||
tmp.lineWidth -= 2
|
||||
}
|
||||
tmp.render(ctx)
|
||||
}
|
||||
if (item instanceof Line) {
|
||||
var tmp = new Line(item)
|
||||
tmp.lineWidth *= 2
|
||||
tmp.toArrowSize =
|
||||
(tmp.toArrowSize * scale - 1.5 * tmp.lineWidth) / scale
|
||||
tmp.fromArrowSize =
|
||||
(tmp.fromArrowSize * scale - 1.5 * tmp.lineWidth) / scale
|
||||
tmp.setTID(TID)
|
||||
tmp.strokeStyle = rgba(0.2, this.options.activeColor)
|
||||
tmp.borderWidth = 4
|
||||
tmp.borderColor = rgba(0.1, this.options.activeColor)
|
||||
tmp.fromArrowColor = this.options.activeColor
|
||||
tmp.toArrowColor = this.options.activeColor
|
||||
tmp.render(ctx)
|
||||
if (!this.data.locked && !item.locked) {
|
||||
drawLineFns[item.name] &&
|
||||
drawLineFns[item.name].drawControlPointsFn(ctx, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.pens.length === 1 && this.pens[0].type === PenType.Line) {
|
||||
ctx.restore() // 对应前面的 save() , 保持状态一致
|
||||
return
|
||||
}
|
||||
// This is diffence between single node and more.
|
||||
if (this.rotate && this.pens.length > 1) {
|
||||
ctx.translate(this.rect.center.x, this.rect.center.y)
|
||||
ctx.rotate((this.rotate * Math.PI) / 180)
|
||||
ctx.translate(-this.rect.center.x, -this.rect.center.y)
|
||||
}
|
||||
if (this.data.locked || this.locked()) {
|
||||
ctx.restore()
|
||||
return
|
||||
}
|
||||
// Occupied territory.
|
||||
ctx.save()
|
||||
ctx.globalAlpha = 0.3
|
||||
ctx.translate(0.5, 0.5)
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(this.sizeCPs[0].x, this.sizeCPs[0].y)
|
||||
ctx.lineTo(this.sizeCPs[1].x, this.sizeCPs[1].y)
|
||||
ctx.lineTo(this.sizeCPs[2].x, this.sizeCPs[2].y)
|
||||
ctx.lineTo(this.sizeCPs[3].x, this.sizeCPs[3].y)
|
||||
ctx.closePath()
|
||||
ctx.stroke()
|
||||
ctx.restore()
|
||||
// Draw rotate control point.
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(this.rotateCPs[0].x, this.rotateCPs[0].y)
|
||||
ctx.lineTo(this.rotateCPs[1].x, this.rotateCPs[1].y)
|
||||
ctx.stroke()
|
||||
ctx.beginPath()
|
||||
ctx.arc(this.rotateCPs[0].x, this.rotateCPs[0].y, 5, 0, Math.PI * 2)
|
||||
ctx.fill()
|
||||
ctx.stroke()
|
||||
// Draw size control points.
|
||||
if (!this.options.hideSizeCP &&
|
||||
(this.pens.length > 1 || !this.pens[0].hideSizeCP)) {
|
||||
ctx.lineWidth = 1
|
||||
for (let _b = 0, _c = this.sizeCPs; _b < _c.length; _b++) {
|
||||
var item = _c[_b]
|
||||
ctx.save()
|
||||
ctx.beginPath()
|
||||
if (this.pens.length === 1 && (this.pens[0].rotate || this.rotate)) {
|
||||
ctx.translate(item.x, item.y)
|
||||
ctx.rotate(((this.pens[0].rotate + this.rotate) * Math.PI) / 180)
|
||||
ctx.translate(-item.x, -item.y)
|
||||
}
|
||||
ctx.fillRect(item.x - 4.5, item.y - 4.5, 8, 8)
|
||||
ctx.strokeRect(item.x - 5.5, item.y - 5.5, 10, 10)
|
||||
ctx.restore()
|
||||
}
|
||||
}
|
||||
ctx.restore()
|
||||
}
|
||||
ActiveLayer.prototype.calcActiveRect = function () {
|
||||
if (this.pens.length === 1) {
|
||||
if (this.pens[0].rect.height === 0) {
|
||||
// 处理直线这种高度为0的情况
|
||||
this.pens[0].rect.height = 1
|
||||
}
|
||||
this.activeRect = deepClone(this.pens[0].rect)
|
||||
} else {
|
||||
this.activeRect = getRect(this.pens)
|
||||
}
|
||||
}
|
||||
ActiveLayer.prototype.getDockWatchers = function () {
|
||||
if (this.pens.length === 1) {
|
||||
this.dockWatchers = this.nodeRects[0].toPoints()
|
||||
this.dockWatchers.unshift(this.nodeRects[0].center)
|
||||
return
|
||||
}
|
||||
if (!this.rect) {
|
||||
return
|
||||
}
|
||||
this.dockWatchers = this.rect.toPoints()
|
||||
this.dockWatchers.unshift(this.rect.center)
|
||||
}
|
||||
return ActiveLayer
|
||||
}(Layer))
|
||||
export { ActiveLayer }
|
||||
// # sourceMappingURL=activeLayer.js.map
|
||||
File diff suppressed because one or more lines are too long
21
nezha-fronted/src/components/common/@topology/core/src/animateLayer.d.ts
vendored
Normal file
21
nezha-fronted/src/components/common/@topology/core/src/animateLayer.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Pen } from './models/pen';
|
||||
import { Line } from './models/line';
|
||||
import { Options } from './options';
|
||||
import { Layer } from './layer';
|
||||
export declare class AnimateLayer extends Layer {
|
||||
options: Options;
|
||||
pens: Map<any, any>;
|
||||
private timer;
|
||||
private lastNow;
|
||||
private subscribeUpdate;
|
||||
private subscribePlay;
|
||||
constructor(options: Options, TID: string);
|
||||
getAnimateLine(item: Pen): Line;
|
||||
findLine(pen: Pen): Pen;
|
||||
readyPlay(tag?: string, auto?: boolean, pens?: Pen[]): void;
|
||||
animate(): void;
|
||||
updateLines(lines: Line[]): void;
|
||||
render(ctx: CanvasRenderingContext2D): void;
|
||||
stop(): void;
|
||||
destroy(): void;
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
import { Store } from 'le5le-store'
|
||||
import { PenType } from './models/pen'
|
||||
import { Node } from './models/node'
|
||||
import { Line } from './models/line'
|
||||
import { Layer } from './layer'
|
||||
import { s8 } from './utils/uuid'
|
||||
import { find } from './utils/canvas'
|
||||
const __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __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)
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b)
|
||||
function __ () { this.constructor = d }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __())
|
||||
}
|
||||
})()
|
||||
const AnimateLayer = /** @class */ (function (_super) {
|
||||
__extends(AnimateLayer, _super)
|
||||
function AnimateLayer (options, TID) {
|
||||
if (options === void 0) { options = {} }
|
||||
const _this = _super.call(this, TID) || this
|
||||
_this.options = options
|
||||
_this.pens = new Map()
|
||||
_this.lastNow = 0
|
||||
Store.set(_this.generateStoreKey('LT:AnimateLayer'), _this)
|
||||
if (!_this.options.animateColor) {
|
||||
_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) {
|
||||
const 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) {
|
||||
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()
|
||||
}
|
||||
}
|
||||
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 () {
|
||||
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
|
||||
File diff suppressed because one or more lines are too long
22
nezha-fronted/src/components/common/@topology/core/src/canvas.d.ts
vendored
Normal file
22
nezha-fronted/src/components/common/@topology/core/src/canvas.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Observer } from 'le5le-store';
|
||||
import { TopologyData } from './models/data';
|
||||
import { Options } from './options';
|
||||
import { Layer } from './layer';
|
||||
export declare class Canvas extends Layer {
|
||||
parentElem: HTMLElement;
|
||||
options: Options;
|
||||
static dpiRatio: number;
|
||||
protected data: TopologyData;
|
||||
canvas: HTMLCanvasElement;
|
||||
width: number;
|
||||
height: number;
|
||||
subcribe: Observer;
|
||||
constructor(parentElem: HTMLElement, options: Options, TID: string);
|
||||
resize(size?: {
|
||||
width: number;
|
||||
height: number;
|
||||
}): void;
|
||||
render(): void;
|
||||
getDpiRatio(): number;
|
||||
destroy(): void;
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import { Store } from 'le5le-store'
|
||||
import { Layer } from './layer'
|
||||
const __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __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)
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b)
|
||||
function __ () { this.constructor = d }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __())
|
||||
}
|
||||
})()
|
||||
const Canvas = /** @class */ (function (_super) {
|
||||
__extends(Canvas, _super)
|
||||
function Canvas (parentElem, options, TID) {
|
||||
if (options === void 0) { options = {} }
|
||||
const _this = _super.call(this, TID) || this
|
||||
_this.parentElem = parentElem
|
||||
_this.options = options
|
||||
_this.canvas = document.createElement('canvas')
|
||||
_this.width = 0
|
||||
_this.height = 0
|
||||
_this.subcribe = Store.subscribe(_this.generateStoreKey('topology-data'), function (val) {
|
||||
_this.data = val
|
||||
})
|
||||
_this.canvas.style.position = 'absolute'
|
||||
_this.canvas.style.left = '0'
|
||||
_this.canvas.style.top = '0'
|
||||
_this.canvas.style.outline = 'none'
|
||||
if (!Canvas.dpiRatio) {
|
||||
if (!options.extDpiRatio && options.extDpiRatio !== 0) {
|
||||
if (window && window.devicePixelRatio > 1) {
|
||||
options.extDpiRatio = 0.25
|
||||
} else {
|
||||
options.extDpiRatio = 0
|
||||
}
|
||||
}
|
||||
Canvas.dpiRatio = (window ? window.devicePixelRatio : 0) + options.extDpiRatio
|
||||
if (Canvas.dpiRatio < 1) {
|
||||
Canvas.dpiRatio = 1
|
||||
}
|
||||
}
|
||||
return _this
|
||||
}
|
||||
Canvas.prototype.resize = function (size) {
|
||||
if (size) {
|
||||
this.width = size.width | 0
|
||||
this.height = size.height | 0
|
||||
} else {
|
||||
if (this.options.width && this.options.width !== 'auto') {
|
||||
this.width = +this.options.width
|
||||
} else {
|
||||
this.width = this.parentElem.clientWidth
|
||||
}
|
||||
if (this.options.height && this.options.height !== 'auto') {
|
||||
this.height = +this.options.height
|
||||
} else {
|
||||
this.height = this.parentElem.clientHeight
|
||||
}
|
||||
}
|
||||
this.canvas.style.width = this.width + 'px'
|
||||
this.canvas.style.height = this.height + 'px'
|
||||
this.canvas.width = (this.width * Canvas.dpiRatio) | 0
|
||||
this.canvas.height = (this.height * Canvas.dpiRatio) | 0
|
||||
this.canvas.getContext('2d').scale(Canvas.dpiRatio, Canvas.dpiRatio)
|
||||
Store.set(this.generateStoreKey('LT:size'), { width: this.canvas.width, height: this.canvas.height })
|
||||
}
|
||||
Canvas.prototype.render = function () {
|
||||
const ctx = this.canvas.getContext('2d')
|
||||
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)
|
||||
}
|
||||
Canvas.prototype.getDpiRatio = function () {
|
||||
return Canvas.dpiRatio
|
||||
}
|
||||
Canvas.prototype.destroy = function () {
|
||||
this.subcribe.unsubscribe()
|
||||
this.activeLayer = null
|
||||
this.hoverLayer = null
|
||||
this.animateLayer = null
|
||||
this.subcribe = null
|
||||
this.options = null
|
||||
this.parentElem = null
|
||||
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
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"canvas.js","sourceRoot":"","sources":["../../../packages/core/src/canvas.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAY,KAAK,EAAE,MAAM,aAAa,CAAC;AAI9C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIhC;IAA4B,0BAAK;IAQ/B,gBAAmB,UAAuB,EAAS,OAAqB,EAAE,GAAW;QAAlC,wBAAA,EAAA,YAAqB;QAAxE,YACE,kBAAM,GAAG,CAAC,SAwBX;QAzBkB,gBAAU,GAAV,UAAU,CAAa;QAAS,aAAO,GAAP,OAAO,CAAc;QAJxE,YAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC1C,WAAK,GAAG,CAAC,CAAC;QACV,YAAM,GAAG,CAAC,CAAC;QAIT,KAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,KAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,EAAE,UAAC,GAAG;YAC1E,KAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAClB,CAAC,CAAC,CAAC;QACH,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;QACxC,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC;QAC7B,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;QAC5B,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QAEnC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;YACp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-fronted/src/components/common/@topology/core/src/core.d.ts
vendored
Normal file
274
nezha-fronted/src/components/common/@topology/core/src/core.d.ts
vendored
Normal file
@@ -0,0 +1,274 @@
|
||||
import { Emitter, EventType, Handler } from 'mitt';
|
||||
import { Options, Padding } from './options';
|
||||
import { Pen } from './models/pen';
|
||||
import { Node } from './models/node';
|
||||
import { Point } from './models/point';
|
||||
import { Line } from './models/line';
|
||||
import { TopologyData } from './models/data';
|
||||
import { Lock } from './models/status';
|
||||
import { Offscreen } from './offscreen';
|
||||
import { RenderLayer } from './renderLayer';
|
||||
import { HoverLayer } from './hoverLayer';
|
||||
import { ActiveLayer } from './activeLayer';
|
||||
import { AnimateLayer } from './animateLayer';
|
||||
import { DivLayer } from './divLayer';
|
||||
import { Rect } from './models/rect';
|
||||
import { Socket } from './socket';
|
||||
import { MQTT } from './mqtt';
|
||||
import { EventType as SocketEventType } from './models';
|
||||
declare enum MoveInType {
|
||||
None = 0,
|
||||
Line = 1,
|
||||
LineFrom = 2,
|
||||
LineTo = 3,
|
||||
LineControlPoint = 4,
|
||||
Nodes = 5,
|
||||
ResizeCP = 6,
|
||||
HoverAnchors = 7,
|
||||
AutoAnchor = 8,
|
||||
Rotate = 9,
|
||||
GraffitiReady = 10,
|
||||
Graffiti = 11,
|
||||
LinesReady = 12,
|
||||
Lines = 13
|
||||
}
|
||||
interface ICaches {
|
||||
index: number;
|
||||
dbIndex: number;
|
||||
list: TopologyData[];
|
||||
}
|
||||
export declare class Topology {
|
||||
VERSION: string;
|
||||
id: string;
|
||||
data: TopologyData;
|
||||
clipboard: TopologyData;
|
||||
caches: ICaches;
|
||||
options: Options;
|
||||
cacheTimer: any;
|
||||
parentElem: HTMLElement;
|
||||
canvas: RenderLayer;
|
||||
offscreen: Offscreen;
|
||||
hoverLayer: HoverLayer;
|
||||
activeLayer: ActiveLayer;
|
||||
animateLayer: AnimateLayer;
|
||||
divLayer: DivLayer;
|
||||
private subcribe;
|
||||
private subcribeRender;
|
||||
private subcribeImage;
|
||||
private imageTimer;
|
||||
private subcribeAnimateEnd;
|
||||
private subcribeAnimateMoved;
|
||||
private subcribeMediaEnd;
|
||||
private subcribeEmit;
|
||||
touchedNode: any;
|
||||
lastHoverNode: Node;
|
||||
lastHoverLine: Line;
|
||||
touches?: TouchList;
|
||||
touchScale?: number;
|
||||
touchStart: number;
|
||||
touchCenter?: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
input: HTMLTextAreaElement;
|
||||
inputObj: Pen;
|
||||
mouseDown: {
|
||||
x: number;
|
||||
y: number;
|
||||
restore?: boolean;
|
||||
};
|
||||
spaceDown: boolean;
|
||||
lastTranlated: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
moveIn: {
|
||||
type: MoveInType;
|
||||
activeAnchorIndex: number;
|
||||
hoverAnchorIndex: number;
|
||||
hoverNode: Node;
|
||||
hoverLine: Line;
|
||||
activeNode: Node;
|
||||
lineControlPoint: Point;
|
||||
};
|
||||
canvasPos?: DOMRect;
|
||||
needCache: boolean;
|
||||
private tip;
|
||||
private raf;
|
||||
tipMarkdown: HTMLElement;
|
||||
tipMarkdownContent: HTMLElement;
|
||||
tipMarkdownArrowUp: HTMLElement;
|
||||
tipMarkdownArrowDown: HTMLElement;
|
||||
tipElem: HTMLElement;
|
||||
socket: Socket;
|
||||
mqtt: MQTT;
|
||||
get ramCaches(): number;
|
||||
get clearElementIdPensName(): string[];
|
||||
private socketFn;
|
||||
_emitter: Emitter;
|
||||
private scheduledAnimationFrame;
|
||||
private scrolling;
|
||||
private rendering;
|
||||
private actionTimer;
|
||||
constructor(parent: string | HTMLElement, options?: Options);
|
||||
private setupDom;
|
||||
private setupSubscribe;
|
||||
private setupMouseEvent;
|
||||
private onScroll;
|
||||
private preventDefault;
|
||||
private ontouchend;
|
||||
winResize: () => void;
|
||||
resize(size?: {
|
||||
width: number;
|
||||
height: number;
|
||||
}): void;
|
||||
dropNodes(jsonList: any[], offsetX: number, offsetY: number): void;
|
||||
addNode(node: Node | any, focus?: boolean): any;
|
||||
addLine(line: any, focus?: boolean): any;
|
||||
render(noFocus?: boolean): this;
|
||||
calibrateMouse: (pt: {
|
||||
x: number;
|
||||
y: number;
|
||||
}) => {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
open(data?: TopologyData | string): void;
|
||||
/**
|
||||
* 执行初始化函数 initJS
|
||||
* */
|
||||
private doInitJS;
|
||||
subscribeSocket: () => boolean;
|
||||
openSocket(url?: string): void;
|
||||
closeSocket(): void;
|
||||
openMqtt(url?: string, options?: any): void;
|
||||
closeMqtt(): void;
|
||||
doSocket(message: any, type?: SocketEventType): void;
|
||||
overflow(padding?: number): {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
private setNodeText;
|
||||
onMouseMove: (e: {
|
||||
x: number;
|
||||
y: number;
|
||||
buttons?: number;
|
||||
ctrlKey?: boolean;
|
||||
shiftKey?: boolean;
|
||||
altKey?: boolean;
|
||||
pageX?: number;
|
||||
pageY?: number;
|
||||
}) => boolean;
|
||||
onmousedown: (e: {
|
||||
x: number;
|
||||
y: number;
|
||||
button?: number;
|
||||
ctrlKey?: boolean;
|
||||
shiftKey?: boolean;
|
||||
altKey?: boolean;
|
||||
pageX?: number;
|
||||
pageY?: number;
|
||||
}) => void;
|
||||
onmouseup: (e: {
|
||||
x: number;
|
||||
y: number;
|
||||
button?: number;
|
||||
ctrlKey?: boolean;
|
||||
shiftKey?: boolean;
|
||||
altKey?: boolean;
|
||||
}) => void;
|
||||
private ondblclick;
|
||||
private onkeydown;
|
||||
private getMoveIn;
|
||||
inChildNode(pt: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, children: Pen[]): any;
|
||||
inNode(pt: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, node: Node, inChild?: boolean): any;
|
||||
inLine(point: {
|
||||
x: number;
|
||||
y: number;
|
||||
}, line: Line): any;
|
||||
private getLineDock;
|
||||
private getPensInRect;
|
||||
private getAngle;
|
||||
showInput(item: Pen): void;
|
||||
getRect(pens?: Pen[]): Rect;
|
||||
getDockPos(offsetX: number, offsetY: number, noDock?: boolean): {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
cache(): void;
|
||||
cacheReplace(pens: Pen[]): void;
|
||||
undo(noRedo?: boolean, force?: boolean): void;
|
||||
redo(force?: boolean): void;
|
||||
toImage(padding?: Padding, callback?: any): string;
|
||||
saveAsImage(name?: string, padding?: Padding): void;
|
||||
delete(param?: string | Pen[], force?: boolean): void;
|
||||
deleteAnchors(param?: Pen[], force?: boolean): void;
|
||||
delEmptyLines(deleteedId?: string): void;
|
||||
cut(): void;
|
||||
copy(): void;
|
||||
paste(): void;
|
||||
/**
|
||||
* 粘贴当前画笔,位置偏移 offset
|
||||
* */
|
||||
pastePen(pen: Pen, idMaps?: any, offset?: number, parentId?: string): void;
|
||||
animate(autoplay?: boolean): void;
|
||||
updateProps(cache?: boolean, pens?: Pen[]): void;
|
||||
lock(lock: Lock): void;
|
||||
lockPens(pens: Pen[], lock: Lock): void;
|
||||
up(pen: Pen, pens?: Pen[]): void;
|
||||
top(pen: Pen, pens?: Pen[]): void;
|
||||
down(pen: Pen, pens?: Pen[]): void;
|
||||
bottom(pen: Pen, pens?: Pen[]): void;
|
||||
getParent(pen: Pen): Node;
|
||||
combine(pens?: Pen[], stand?: boolean): void;
|
||||
uncombine(node?: Pen): void;
|
||||
find(idOrTag: string, pens?: Pen[] | boolean, array?: boolean): Pen | Pen[];
|
||||
findIndex(pen: Pen, pens?: Pen[]): number;
|
||||
play(idOrTag: string, pause?: boolean): void;
|
||||
translate(x: number, y: number, process?: boolean, noNotice?: boolean): void;
|
||||
scale(scale: number, center?: {
|
||||
x: number;
|
||||
y: number;
|
||||
}): void;
|
||||
scaleTo(scale: number, center?: {
|
||||
x: number;
|
||||
y: number;
|
||||
}): void;
|
||||
round(): void;
|
||||
centerView(padding?: Padding): boolean;
|
||||
fitView(viewPadding?: Padding): void;
|
||||
hasView(): boolean;
|
||||
getViewCenter(viewPadding?: Padding): {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
generateStoreKey(key: string): string;
|
||||
private createMarkdownTip;
|
||||
private showTip;
|
||||
private hideTip;
|
||||
scroll(x: number, y: number): void;
|
||||
toComponent(pens?: Pen[]): Node;
|
||||
clearBkImg(): void;
|
||||
dispatch(event: string, data?: any): this;
|
||||
on(eventType: EventType, handler: Handler): this;
|
||||
off(eventType: EventType, handler: Handler): this;
|
||||
emit(eventType: EventType, params: any): this;
|
||||
getValue(idOrTag: string, attr?: string): any;
|
||||
setValue(idOrTag: any, val: any, attr?: string): void;
|
||||
willRender(): void;
|
||||
setLineName(name: 'curve' | 'line' | 'polyline' | 'mind', render?: boolean): void;
|
||||
setColor(color: string): void;
|
||||
setFontColor(color: string): void;
|
||||
setIconColor(color: string): void;
|
||||
setBkColor(color: string): void;
|
||||
pureData(): any;
|
||||
pureDataChildren(data: any): void;
|
||||
destroy(): void;
|
||||
}
|
||||
export {};
|
||||
3018
nezha-fronted/src/components/common/@topology/core/src/core.js
Normal file
3018
nezha-fronted/src/components/common/@topology/core/src/core.js
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
54
nezha-fronted/src/components/common/@topology/core/src/divLayer.d.ts
vendored
Normal file
54
nezha-fronted/src/components/common/@topology/core/src/divLayer.d.ts
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
import { Options } from './options';
|
||||
import { Node } from './models/node';
|
||||
import { Layer } from './layer';
|
||||
export declare class DivLayer extends Layer {
|
||||
parentElem: HTMLElement;
|
||||
options: Options;
|
||||
canvas: HTMLDivElement;
|
||||
player: HTMLDivElement;
|
||||
curNode: Node;
|
||||
playBtn: HTMLElement;
|
||||
currentTime: HTMLElement;
|
||||
progressCurrent: HTMLElement;
|
||||
progress: HTMLElement;
|
||||
loop: HTMLElement;
|
||||
media: HTMLMediaElement;
|
||||
audios: {
|
||||
[key: string]: {
|
||||
player: HTMLElement;
|
||||
current: HTMLElement;
|
||||
media: HTMLMediaElement;
|
||||
};
|
||||
};
|
||||
iframes: {
|
||||
[key: string]: HTMLIFrameElement;
|
||||
};
|
||||
elements: {
|
||||
[key: string]: HTMLElement;
|
||||
};
|
||||
gifs: {
|
||||
[key: string]: HTMLImageElement;
|
||||
};
|
||||
private subcribeDiv;
|
||||
private subcribePlay;
|
||||
private subcribeNode;
|
||||
constructor(parentElem: HTMLElement, options: Options, TID: string);
|
||||
addDiv: (node: Node) => void;
|
||||
createPlayer: () => void;
|
||||
getMediaCurrent: () => void;
|
||||
addMedia: (node: Node, type: string) => HTMLDivElement;
|
||||
play(idOrTag: any, pause?: boolean): void;
|
||||
playOne(item: Node, pause?: boolean): void;
|
||||
addIframe(node: Node): HTMLIFrameElement;
|
||||
addGif(node: Node): HTMLImageElement;
|
||||
setElemPosition: (node: Node, elem: HTMLElement) => void;
|
||||
removeDiv: (item: Node) => void;
|
||||
clear(shallow?: boolean): void;
|
||||
formatSeconds(seconds: number): string;
|
||||
resize(size?: {
|
||||
width: number;
|
||||
height: number;
|
||||
}): void;
|
||||
render(): void;
|
||||
destroy(): void;
|
||||
}
|
||||
@@ -0,0 +1,527 @@
|
||||
import { Store } from 'le5le-store'
|
||||
import { Lock } from './models/status'
|
||||
import { images, PenType } from './models/pen'
|
||||
import { Layer } from './layer'
|
||||
import { find } from './utils'
|
||||
const __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __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)
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b)
|
||||
function __ () { this.constructor = d }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __())
|
||||
}
|
||||
})()
|
||||
let videos = {}
|
||||
const DivLayer = /** @class */ (function (_super) {
|
||||
__extends(DivLayer, _super)
|
||||
function DivLayer (parentElem, options, TID) {
|
||||
if (options === void 0) { options = {} }
|
||||
const _this = _super.call(this, TID) || this
|
||||
_this.parentElem = parentElem
|
||||
_this.options = options
|
||||
_this.canvas = document.createElement('div')
|
||||
_this.player = document.createElement('div')
|
||||
_this.audios = {}
|
||||
_this.iframes = {}
|
||||
_this.elements = {}
|
||||
_this.gifs = {}
|
||||
_this.addDiv = function (node) {
|
||||
if (node.audio) {
|
||||
if (_this.audios[node.id] && _this.audios[node.id].media.src !== node.audio) {
|
||||
_this.audios[node.id].media.src = node.audio
|
||||
}
|
||||
setTimeout(function () {
|
||||
_this.setElemPosition(node, (_this.audios[node.id] && _this.audios[node.id].player) || _this.addMedia(node, 'audio'))
|
||||
})
|
||||
}
|
||||
if (node.video) {
|
||||
if (videos[node.id] && videos[node.id].media.src !== node.video) {
|
||||
videos[node.id].media.src = node.video
|
||||
}
|
||||
setTimeout(function () {
|
||||
_this.setElemPosition(node, (videos[node.id] && videos[node.id].player) || _this.addMedia(node, 'video'))
|
||||
})
|
||||
}
|
||||
if (node.iframe) {
|
||||
if (!_this.iframes[node.id]) {
|
||||
_this.addIframe(node)
|
||||
setTimeout(function () {
|
||||
_this.addDiv(node)
|
||||
})
|
||||
} else {
|
||||
if (_this.iframes[node.id].src !== node.iframe) {
|
||||
_this.iframes[node.id].src = node.iframe
|
||||
}
|
||||
_this.setElemPosition(node, _this.iframes[node.id])
|
||||
}
|
||||
}
|
||||
if (node.elementId) {
|
||||
if (!_this.elements[node.id]) {
|
||||
_this.elements[node.id] = document.getElementById(node.elementId)
|
||||
if (_this.elements[node.id]) {
|
||||
_this.canvas.appendChild(_this.elements[node.id])
|
||||
}
|
||||
}
|
||||
_this.setElemPosition(node, _this.elements[node.id])
|
||||
}
|
||||
if (node.gif) {
|
||||
if (node.image.indexOf('.gif') < 0) {
|
||||
node.gif = false
|
||||
_this.canvas.removeChild(_this.gifs[node.id])
|
||||
_this.gifs[node.id] = undefined
|
||||
} else if (node.img) {
|
||||
if (_this.gifs[node.id] && _this.gifs[node.id].src !== node.image) {
|
||||
_this.gifs[node.id].src = node.image
|
||||
}
|
||||
if (_this.gifs[node.id]) {
|
||||
_this.setElemPosition(node, _this.gifs[node.id])
|
||||
} else {
|
||||
_this.addGif(node)
|
||||
_this.setElemPosition(node, node.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node.children) {
|
||||
for (let _i = 0, _a = node.children; _i < _a.length; _i++) {
|
||||
const child = _a[_i]
|
||||
if (child.type === PenType.Line) {
|
||||
continue
|
||||
}
|
||||
_this.addDiv(child)
|
||||
}
|
||||
}
|
||||
}
|
||||
_this.createPlayer = function () {
|
||||
_this.player.style.position = 'fixed'
|
||||
_this.player.style.outline = 'none'
|
||||
_this.player.style.top = '-99999px'
|
||||
_this.player.style.height = '40px'
|
||||
_this.player.style.padding = '10px 15px'
|
||||
_this.player.style.background = 'rgba(200,200,200,.1)'
|
||||
_this.player.style.display = 'flex'
|
||||
_this.player.style.alignItems = 'center'
|
||||
_this.player.style.userSelect = 'initial'
|
||||
_this.player.style.pointerEvents = 'initial'
|
||||
_this.player.style.zIndex = '1'
|
||||
_this.playBtn = document.createElement('i')
|
||||
_this.currentTime = document.createElement('span')
|
||||
_this.progress = document.createElement('div')
|
||||
_this.progressCurrent = document.createElement('div')
|
||||
_this.loop = document.createElement('i')
|
||||
_this.myfullScreen = document.createElement('i')
|
||||
_this.playBtn.className = _this.options.playIcon
|
||||
_this.playBtn.style.fontSize = '18px'
|
||||
_this.playBtn.style.lineHeight = '20px'
|
||||
_this.playBtn.style.cursor = 'pointer'
|
||||
_this.currentTime.style.padding = '0 10px'
|
||||
_this.currentTime.innerText = '0 / 0'
|
||||
_this.progress.style.position = 'relative'
|
||||
_this.progress.style.flexGrow = '1'
|
||||
_this.progress.style.top = '0'
|
||||
_this.progress.style.height = '4px'
|
||||
_this.progress.style.background = '#ccc'
|
||||
_this.progress.style.borderRadius = '2px'
|
||||
_this.progress.style.overflow = 'hidden'
|
||||
_this.progress.style.cursor = 'pointer'
|
||||
_this.progressCurrent.style.position = 'absolute'
|
||||
_this.progressCurrent.style.left = '0'
|
||||
_this.progressCurrent.style.top = '0'
|
||||
_this.progressCurrent.style.bottom = '0'
|
||||
_this.progressCurrent.style.width = '0'
|
||||
_this.progressCurrent.style.background = '#52c41a'
|
||||
_this.loop.style.margin = '0 10px'
|
||||
_this.loop.style.padding = '2px 5px'
|
||||
_this.loop.style.borderRadius = '2px'
|
||||
_this.loop.className = _this.options.loopIcon
|
||||
_this.loop.style.fontSize = '18px'
|
||||
_this.loop.style.lineHeight = '20px'
|
||||
_this.loop.style.cursor = 'pointer'
|
||||
_this.myfullScreen.className = _this.options.fullScreenIcon
|
||||
_this.myfullScreen.style.fontSize = '17px'
|
||||
_this.myfullScreen.style.lineHeight = '20px'
|
||||
_this.myfullScreen.style.cursor = 'pointer'
|
||||
_this.player.appendChild(_this.playBtn)
|
||||
_this.player.appendChild(_this.currentTime)
|
||||
_this.player.appendChild(_this.progress)
|
||||
_this.progress.appendChild(_this.progressCurrent)
|
||||
_this.player.appendChild(_this.loop)
|
||||
_this.player.appendChild(_this.myfullScreen)
|
||||
_this.playBtn.onclick = function () {
|
||||
if (_this.media.paused) {
|
||||
_this.media.play()
|
||||
_this.playBtn.className = _this.options.pauseIcon
|
||||
} else {
|
||||
_this.media.pause()
|
||||
_this.playBtn.className = _this.options.playIcon
|
||||
}
|
||||
}
|
||||
_this.progress.onclick = function (e) {
|
||||
_this.media.currentTime = (e.offsetX / _this.progress.clientWidth) * _this.media.duration
|
||||
}
|
||||
_this.loop.onclick = function () {
|
||||
_this.media.loop = !_this.media.loop
|
||||
_this.curNode.playLoop = _this.media.loop
|
||||
if (_this.media.loop) {
|
||||
_this.loop.style.background = '#ddd'
|
||||
} else {
|
||||
_this.loop.style.background = 'none'
|
||||
}
|
||||
}
|
||||
_this.myfullScreen.onclick = function () {
|
||||
_this.media.requestFullscreen()
|
||||
}
|
||||
}
|
||||
_this.getMediaCurrent = function () {
|
||||
if (!_this.media) {
|
||||
return
|
||||
}
|
||||
_this.currentTime.innerText =
|
||||
_this.formatSeconds(_this.media.currentTime) + ' / ' + _this.formatSeconds(_this.media.duration)
|
||||
_this.progressCurrent.style.width =
|
||||
(_this.media.currentTime / _this.media.duration) * _this.progress.clientWidth + 'px'
|
||||
}
|
||||
_this.addMedia = function (node, type) {
|
||||
let player = document.createElement('div')
|
||||
let current = document.createElement('div')
|
||||
let media = document.createElement(type)
|
||||
player.id = node.id
|
||||
current.style.position = 'absolute'
|
||||
current.style.outline = 'none'
|
||||
current.style.left = '0'
|
||||
current.style.bottom = '0'
|
||||
current.style.height = '2px'
|
||||
current.style.background = '#52c41a'
|
||||
media.style.position = 'absolute'
|
||||
media.style.outline = 'none'
|
||||
media.style.left = '0'
|
||||
media.style.right = '0'
|
||||
media.style.top = '0'
|
||||
media.style.bottom = '0'
|
||||
if (type === 'video') {
|
||||
media.style.width = node.rect.width + 'px'
|
||||
media.style.height = node.rect.height + 'px'
|
||||
}
|
||||
player.style.background = 'transparent'
|
||||
if (node.playType === 1) {
|
||||
media.autoplay = true
|
||||
}
|
||||
media.loop = node.playLoop
|
||||
media.ontimeupdate = function () {
|
||||
current.style.width = (media.currentTime / media.duration) * node.rect.width + 'px'
|
||||
_this.getMediaCurrent()
|
||||
if (_this.media === media) {
|
||||
if (node.playLoop) {
|
||||
media.loop = true
|
||||
_this.loop.style.background = '#ddd'
|
||||
} else {
|
||||
media.loop = false
|
||||
_this.loop.style.background = 'none'
|
||||
}
|
||||
}
|
||||
}
|
||||
media.onended = function () {
|
||||
Store.set(_this.generateStoreKey('mediaEnd'), node)
|
||||
if (_this.media === media) {
|
||||
_this.playBtn.className = _this.options.playIcon
|
||||
}
|
||||
_this.play(node.nextPlay)
|
||||
}
|
||||
media.onloadedmetadata = function () {
|
||||
_this.getMediaCurrent()
|
||||
}
|
||||
media.src = node[type]
|
||||
player.appendChild(media)
|
||||
player.appendChild(current)
|
||||
if (type === 'video') {
|
||||
videos[node.id] = {
|
||||
player: player,
|
||||
current: current,
|
||||
media: media
|
||||
}
|
||||
} else {
|
||||
_this.audios[node.id] = {
|
||||
player: player,
|
||||
current: current,
|
||||
media: media
|
||||
}
|
||||
}
|
||||
_this.canvas.appendChild(player)
|
||||
setTimeout(() => {
|
||||
player = null
|
||||
current = null
|
||||
media = null
|
||||
}, 100)
|
||||
return player
|
||||
}
|
||||
_this.setElemPosition = function (node, elem) {
|
||||
if (!elem) {
|
||||
return
|
||||
}
|
||||
elem.style.position = 'absolute'
|
||||
elem.style.outline = 'none'
|
||||
elem.style.left = node.rect.x + _this.data.x + 'px'
|
||||
elem.style.top = node.rect.y + _this.data.y + 'px'
|
||||
elem.style.width = node.rect.width + 'px'
|
||||
elem.style.height = node.rect.height + 'px'
|
||||
elem.style.display = node.visible ? 'inline' : 'none' // 是否隐藏元素
|
||||
if (node.rotate || node.offsetRotate) {
|
||||
elem.style.transform = 'rotate(' + (node.rotate + node.offsetRotate) + 'deg)'
|
||||
}
|
||||
if (node.video && videos[node.id] && videos[node.id].media) {
|
||||
videos[node.id].media.style.width = '100%'
|
||||
videos[node.id].media.style.height = '100%'
|
||||
}
|
||||
if (_this.data.locked > Lock.None || node.locked > Lock.None) {
|
||||
elem.style.userSelect = 'initial'
|
||||
elem.style.pointerEvents = 'initial'
|
||||
} else {
|
||||
elem.style.userSelect = 'none'
|
||||
elem.style.pointerEvents = 'none'
|
||||
}
|
||||
}
|
||||
_this.removeDiv = function (item) {
|
||||
if (_this.curNode && item.id === _this.curNode.id) {
|
||||
_this.curNode = undefined
|
||||
_this.media = undefined
|
||||
_this.player.style.top = '-99999px'
|
||||
}
|
||||
if (item.audio) {
|
||||
_this.canvas.removeChild(_this.audios[item.id].player)
|
||||
_this.audios[item.id] = undefined
|
||||
}
|
||||
if (item.video) {
|
||||
_this.canvas.removeChild(videos[item.id].player)
|
||||
videos[item.id] = undefined
|
||||
}
|
||||
if (item.iframe) {
|
||||
_this.canvas.removeChild(_this.iframes[item.id])
|
||||
_this.iframes[item.id] = undefined
|
||||
}
|
||||
if (item.elementId) {
|
||||
_this.canvas.removeChild(_this.elements[item.id])
|
||||
_this.elements[item.id] = undefined
|
||||
item.elementId = ''
|
||||
}
|
||||
if (item.gif) {
|
||||
_this.canvas.removeChild(_this.gifs[item.id])
|
||||
_this.gifs[item.id] = undefined
|
||||
}
|
||||
if (item.children) {
|
||||
for (let _i = 0, _a = item.children; _i < _a.length; _i++) {
|
||||
const child = _a[_i]
|
||||
if (child.type === PenType.Line) {
|
||||
continue
|
||||
}
|
||||
_this.removeDiv(child)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!_this.options.playIcon) {
|
||||
_this.options.playIcon = 't-icon t-play'
|
||||
}
|
||||
if (!_this.options.pauseIcon) {
|
||||
_this.options.pauseIcon = 't-icon t-pause'
|
||||
}
|
||||
if (!_this.options.fullScreenIcon) {
|
||||
_this.options.fullScreenIcon = 't-icon t-full-screen'
|
||||
}
|
||||
if (!_this.options.loopIcon) {
|
||||
_this.options.loopIcon = 't-icon t-loop'
|
||||
}
|
||||
_this.canvas.style.position = 'absolute'
|
||||
_this.canvas.style.left = '0'
|
||||
_this.canvas.style.top = '0'
|
||||
_this.canvas.style.outline = 'none'
|
||||
_this.canvas.style.background = 'transparent'
|
||||
parentElem.appendChild(_this.canvas)
|
||||
parentElem.appendChild(_this.player)
|
||||
_this.createPlayer()
|
||||
_this.subcribeDiv = Store.subscribe(_this.generateStoreKey('LT:addDiv'), _this.addDiv)
|
||||
_this.subcribeDiv = Store.subscribe(_this.generateStoreKey('LT:removeDiv'), _this.removeDiv)
|
||||
_this.subcribePlay = Store.subscribe(_this.generateStoreKey('LT:play'), function (e) {
|
||||
_this.playOne(e.pen, e.pause)
|
||||
})
|
||||
_this.subcribeNode = Store.subscribe(_this.generateStoreKey('LT:activeNode'), function (node) {
|
||||
if (!node || (!node.video && !node.audio)) {
|
||||
_this.player.style.top = '-99999px'
|
||||
return
|
||||
}
|
||||
if (node.audio && _this.audios[node.id]) {
|
||||
_this.media = _this.audios[node.id].media
|
||||
} else if (node.video && videos[node.id]) {
|
||||
_this.media = videos[node.id].media
|
||||
} else {
|
||||
return
|
||||
}
|
||||
_this.curNode = node
|
||||
const rect = _this.parentElem.getBoundingClientRect()
|
||||
_this.player.style.top = rect.top + _this.parentElem.clientHeight - 40 + 'px'
|
||||
_this.player.style.left = rect.left + 'px'
|
||||
_this.player.style.width = _this.parentElem.clientWidth + 'px'
|
||||
_this.getMediaCurrent()
|
||||
if (_this.media.paused) {
|
||||
_this.playBtn.className = _this.options.playIcon
|
||||
} else {
|
||||
_this.playBtn.className = _this.options.pauseIcon
|
||||
}
|
||||
})
|
||||
_this.fullscreenchange = function (e) {
|
||||
if (!_this.media) {
|
||||
return
|
||||
}
|
||||
if (document.fullscreen) {
|
||||
_this.media.controls = true
|
||||
_this.media.style.userSelect = 'initial'
|
||||
_this.media.style.pointerEvents = 'initial'
|
||||
} else {
|
||||
_this.media.style.userSelect = 'none'
|
||||
_this.media.style.pointerEvents = 'none'
|
||||
_this.media.controls = false
|
||||
}
|
||||
}
|
||||
document.addEventListener('fullscreenchange', _this.fullscreenchange)
|
||||
return _this
|
||||
}
|
||||
DivLayer.prototype.play = function (idOrTag, pause) {
|
||||
const _this = this
|
||||
if (!idOrTag) {
|
||||
return
|
||||
}
|
||||
const pens = find(idOrTag, this.data.pens)
|
||||
pens.forEach(function (item) {
|
||||
_this.playOne(item, pause)
|
||||
})
|
||||
}
|
||||
DivLayer.prototype.playOne = function (item, pause) {
|
||||
if (item.audio && this.audios[item.id] && this.audios[item.id].media) {
|
||||
if (pause) {
|
||||
this.audios[item.id].media.pause()
|
||||
} else if (this.audios[item.id].media.paused) {
|
||||
this.audios[item.id].media.play()
|
||||
}
|
||||
} else if (item.video && videos[item.id].media) {
|
||||
if (pause) {
|
||||
videos[item.id].media.pause()
|
||||
} else if (videos[item.id].media.paused) {
|
||||
videos[item.id].media.play()
|
||||
}
|
||||
}
|
||||
}
|
||||
DivLayer.prototype.addIframe = function (node) {
|
||||
const iframe = document.createElement('iframe')
|
||||
iframe.scrolling = 'no'
|
||||
iframe.frameBorder = '0'
|
||||
iframe.src = node.iframe
|
||||
this.iframes[node.id] = iframe
|
||||
this.canvas.appendChild(iframe)
|
||||
return iframe
|
||||
}
|
||||
DivLayer.prototype.addGif = function (node) {
|
||||
this.gifs[node.id] = node.img
|
||||
this.canvas.appendChild(node.img)
|
||||
}
|
||||
DivLayer.prototype.clear = function (shallow) {
|
||||
this.canvas.innerHTML = ''
|
||||
this.audios = {}
|
||||
videos = {}
|
||||
this.iframes = {}
|
||||
this.elements = {}
|
||||
this.gifs = {}
|
||||
if (!shallow) {
|
||||
// tslint:disable-next-line:forin
|
||||
for (const key in images) {
|
||||
delete images[key]
|
||||
}
|
||||
}
|
||||
this.player.style.top = '-99999px'
|
||||
}
|
||||
DivLayer.prototype.formatSeconds = function (seconds) {
|
||||
const h = Math.floor(seconds / 3600)
|
||||
const m = Math.floor(seconds / 60) % 60
|
||||
const s = Math.floor(seconds % 60)
|
||||
let txt = s + ''
|
||||
if (m) {
|
||||
txt = m + ':' + s
|
||||
} else {
|
||||
txt = '0:' + s
|
||||
}
|
||||
if (h) {
|
||||
txt = h + ':' + m + ':' + s
|
||||
}
|
||||
return txt
|
||||
}
|
||||
DivLayer.prototype.resize = function (size) {
|
||||
if (size) {
|
||||
this.canvas.style.width = size.width + 'px'
|
||||
this.canvas.style.height = size.height + 'px'
|
||||
} else {
|
||||
if (this.options.width && this.options.width !== 'auto') {
|
||||
this.canvas.style.width = this.options.width + 'px'
|
||||
} else {
|
||||
this.canvas.style.width = this.parentElem.clientWidth + 'px'
|
||||
}
|
||||
if (this.options.height && this.options.height !== 'auto') {
|
||||
this.canvas.style.height = this.options.height + 'px'
|
||||
} else {
|
||||
this.canvas.style.height = this.parentElem.clientHeight - 8 + 'px'
|
||||
}
|
||||
}
|
||||
}
|
||||
DivLayer.prototype.render = function () {
|
||||
for (let _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
||||
const item = _a[_i]
|
||||
if (!item.getTID()) {
|
||||
item.setTID(this.TID)
|
||||
}
|
||||
this.addDiv(item)
|
||||
}
|
||||
}
|
||||
DivLayer.prototype.destroy = function () {
|
||||
_super.prototype.destroy.call(this)
|
||||
this.clear()
|
||||
this.subcribeDiv.unsubscribe()
|
||||
this.subcribeNode.unsubscribe()
|
||||
this.subcribePlay.unsubscribe()
|
||||
this.parentElem.removeChild(this.canvas)
|
||||
this.parentElem.removeChild(this.player)
|
||||
document.removeEventListener('fullscreenchange', this.fullscreenchange)
|
||||
Object.keys(this.audios).forEach(key => {
|
||||
this.audios[key] = null
|
||||
})
|
||||
this.myfullScreen.onclick = null
|
||||
this.playBtn.onclick = null
|
||||
this.progress.onclick = null
|
||||
this.loop.onclick = null
|
||||
this.subcribeDiv = null
|
||||
this.subcribeNode = null
|
||||
this.subcribePlay = null
|
||||
this.parentElem = null
|
||||
this.options = null
|
||||
this.canvas = null
|
||||
this.player = null
|
||||
this.audios = null
|
||||
this.iframes = null
|
||||
this.elements = null
|
||||
this.gifs = null
|
||||
this.playBtn = null
|
||||
this.currentTime = null
|
||||
this.progress = null
|
||||
this.progressCurrent = null
|
||||
this.loop = null
|
||||
videos = null
|
||||
this.iframes = null
|
||||
this.elements = null
|
||||
this.gifs = null
|
||||
this.addDiv = null
|
||||
this.createPlayer = null
|
||||
this.setElemPosition = null
|
||||
}
|
||||
return DivLayer
|
||||
}(Layer))
|
||||
export { DivLayer }
|
||||
// # sourceMappingURL=divLayer.js.map
|
||||
File diff suppressed because one or more lines are too long
27
nezha-fronted/src/components/common/@topology/core/src/hoverLayer.d.ts
vendored
Normal file
27
nezha-fronted/src/components/common/@topology/core/src/hoverLayer.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Rect } from './models/rect';
|
||||
import { Point } from './models/point';
|
||||
import { Line } from './models/line';
|
||||
import { Node } from './models/node';
|
||||
import { Pen } from './models/pen';
|
||||
import { Options } from './options';
|
||||
import { Layer } from './layer';
|
||||
export declare class HoverLayer extends Layer {
|
||||
options: Options;
|
||||
line: Line;
|
||||
initLine: Line;
|
||||
node: Node;
|
||||
hoverLineCP: Point;
|
||||
lasthoverLineCP: Point;
|
||||
dockAnchor: Point;
|
||||
hoverAnchorIndex: number;
|
||||
dockLineX: number;
|
||||
dockLineY: number;
|
||||
root: Node;
|
||||
dragRect: Rect;
|
||||
constructor(options: Options, TID: string);
|
||||
lineTo(to: Point, toArrow?: string): void;
|
||||
lineFrom(from: Point): void;
|
||||
render(ctx: CanvasRenderingContext2D): void;
|
||||
getRoot(pen: Pen): any;
|
||||
clear(): void;
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
import { PenType } from './models/pen'
|
||||
import { Store } from 'le5le-store'
|
||||
import { Lock } from './models/status'
|
||||
import { Layer } from './layer'
|
||||
import { rgba } from './utils/math'
|
||||
const __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __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)
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b)
|
||||
function __ () { this.constructor = d }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __())
|
||||
}
|
||||
})()
|
||||
const HoverLayer = /** @class */ (function (_super) {
|
||||
__extends(HoverLayer, _super)
|
||||
function HoverLayer (options, TID) {
|
||||
if (options === void 0) { options = {} }
|
||||
const _this = _super.call(this, TID) || this
|
||||
_this.options = options
|
||||
_this.hoverAnchorIndex = -1
|
||||
_this.dockLineX = 0
|
||||
_this.dockLineY = 0
|
||||
Store.set(_this.generateStoreKey('LT:HoverLayer'), _this)
|
||||
return _this
|
||||
}
|
||||
HoverLayer.prototype.lineTo = function (to, toArrow) {
|
||||
if (toArrow === void 0) { toArrow = 'triangleSolid' }
|
||||
if (!this.line || this.line.locked) {
|
||||
return
|
||||
}
|
||||
this.line.setTo(to, toArrow)
|
||||
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.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
|
||||
}
|
||||
if (pen.hideAnchor) {
|
||||
return
|
||||
}
|
||||
for (let _i = 0, _a = pen.rotatedAnchors; _i < _a.length; _i++) {
|
||||
const 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 (let i = 0; i < this.node.rotatedAnchors.length; ++i) {
|
||||
if (this.node.locked ||
|
||||
this.node.hideAnchor ||
|
||||
(this.node.rotatedAnchors[i].hidden && this.hoverAnchorIndex !== i)) {
|
||||
continue
|
||||
}
|
||||
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.strokeStyle = this.node.rotatedAnchors[i].strokeStyle || this.options.hoverColor
|
||||
ctx.fillStyle = this.node.rotatedAnchors[i].fillStyle || this.options.anchorFillStyle
|
||||
ctx.fill()
|
||||
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.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.dockAnchor) {
|
||||
ctx.save()
|
||||
ctx.beginPath()
|
||||
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
|
||||
ctx.fill()
|
||||
ctx.stroke()
|
||||
ctx.restore()
|
||||
}
|
||||
if (this.hoverLineCP) {
|
||||
ctx.beginPath()
|
||||
ctx.arc(this.hoverLineCP.x, this.hoverLineCP.y, 5, 0, Math.PI * 2)
|
||||
ctx.fill()
|
||||
}
|
||||
ctx.strokeStyle = rgba(0.5, this.options.hoverColor)
|
||||
ctx.lineWidth = 1
|
||||
if (this.dockLineX > 0) {
|
||||
var size = Store.get(this.generateStoreKey('LT:size'))
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(this.dockLineX, -this.data.y)
|
||||
ctx.lineTo(this.dockLineX, size.height)
|
||||
ctx.stroke()
|
||||
}
|
||||
if (this.dockLineY > 0) {
|
||||
var size = Store.get(this.generateStoreKey('LT:size'))
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(-this.data.x, this.dockLineY)
|
||||
ctx.lineTo(size.width, this.dockLineY)
|
||||
ctx.stroke()
|
||||
}
|
||||
// Select nodes by drag.
|
||||
if (this.dragRect) {
|
||||
ctx.fillStyle = rgba(0.2, this.options.dragColor)
|
||||
ctx.strokeStyle = this.options.dragColor
|
||||
ctx.beginPath()
|
||||
ctx.strokeRect(this.dragRect.x, this.dragRect.y, this.dragRect.width, this.dragRect.height)
|
||||
ctx.fillRect(this.dragRect.x, this.dragRect.y, this.dragRect.width, this.dragRect.height)
|
||||
}
|
||||
}
|
||||
HoverLayer.prototype.getRoot = function (pen) {
|
||||
if (!pen.parentId) {
|
||||
return null
|
||||
}
|
||||
for (let _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
||||
const item = _a[_i]
|
||||
if (item.id === pen.parentId) {
|
||||
const n = this.getRoot(item)
|
||||
return n || item
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
HoverLayer.prototype.clear = function () {
|
||||
this.node = undefined
|
||||
this.line = undefined
|
||||
}
|
||||
return HoverLayer
|
||||
}(Layer))
|
||||
export { HoverLayer }
|
||||
// # sourceMappingURL=hoverLayer.js.map
|
||||
File diff suppressed because one or more lines are too long
10
nezha-fronted/src/components/common/@topology/core/src/layer.d.ts
vendored
Normal file
10
nezha-fronted/src/components/common/@topology/core/src/layer.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Observer } from 'le5le-store';
|
||||
import { TopologyData } from './models/data';
|
||||
export declare class Layer {
|
||||
protected TID: string;
|
||||
protected data: TopologyData;
|
||||
subcribe: Observer;
|
||||
constructor(TID: string);
|
||||
protected generateStoreKey(key: any): string;
|
||||
destroy(): void;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Store } from 'le5le-store'
|
||||
const Layer = /** @class */ (function () {
|
||||
function Layer (TID) {
|
||||
const _this = this
|
||||
this.TID = TID
|
||||
this.subcribe = Store.subscribe(this.generateStoreKey('topology-data'), function (val) {
|
||||
_this.data = val
|
||||
})
|
||||
}
|
||||
Layer.prototype.generateStoreKey = function (key) {
|
||||
return this.TID + '-' + key
|
||||
}
|
||||
Layer.prototype.destroy = function () {
|
||||
this.subcribe.unsubscribe()
|
||||
this.subcribe = null
|
||||
}
|
||||
return Layer
|
||||
}())
|
||||
export { Layer }
|
||||
// # sourceMappingURL=layer.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"layer.js","sourceRoot":"","sources":["../../../packages/core/src/layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,MAAM,aAAa,CAAC;AAG9C;IAIE,eAAY,GAAW;QAAvB,iBAKC;QAJC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,EAAE,UAAC,GAAG;YAC1E,KAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAES,gCAAgB,GAA1B,UAA2B,GAAG;QAC5B,OAAU,IAAI,CAAC,GAAG,SAAI,GAAK,CAAC;IAC9B,CAAC;IAED,uBAAO,GAAP;QACE,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;IAC9B,CAAC;IACH,YAAC;AAAD,CAAC,AAlBD,IAkBC"}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user