Merge branch 'dev-3.4' of git.mesalab.cn:nezha/nezha-fronted into dev-3.4

This commit is contained in:
zyh
2022-07-15 15:07:10 +08:00
546 changed files with 13483 additions and 164 deletions

1
.gitignore vendored
View File

@@ -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

View File

@@ -504,7 +504,9 @@ textarea {
display: none !important;
}
.alert-rule-info-two{
padding: 10px 10px 10px 5px;
.alert-label-box{
margin-bottom: 25px;
.alert-label-title{
margin-right: 30px;
}

View File

@@ -291,6 +291,9 @@
#alert .name-labe {
display: none;
}
#alert .asset-manage-ip{
visibility: hidden !important;
}
.el-timeline {
.el-timeline-item {
.el-timeline-item__wrapper {

View File

@@ -25,6 +25,7 @@
display: flex;
flex-direction: row;
align-items: center;
margin-left: 5px;
}
.alert-label-value{
height: 26px;

View File

@@ -179,6 +179,10 @@
.form-row-item .nz-icon-minus-position {
right: 6px;
.nz-icon-copy{
text-align: center;
padding-top: 1.5px;
}
}
}

View File

@@ -34,7 +34,7 @@
margin-right: 12px;
}
.schedEnableTitle .week-item {
width: 32px;
width: 35px;
height: 22px;
line-height: 22px;
opacity: 0.9;
@@ -50,3 +50,6 @@
margin-bottom: 6px;
text-align: center;
}
.schedEnableTitle .week-item:nth-of-type(4){
margin-right: 0px !important;
}

View File

@@ -21,6 +21,11 @@
font-size: 12px;
position: fixed;
}
.temp-dom--16 {
visibility: hidden;
font-size: 16px;
position: fixed;
}
.home.tv,.home.se{
.left-menu{

File diff suppressed because one or more lines are too long

View File

@@ -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>

View File

@@ -211,6 +211,25 @@ export default {
if (label.indexOf('$value') !== -1) {
value = chartDataFormat.getUnit(column.unit ? column.unit : 2).compute(value, null, -1, 2)
}
if (!((typeof value) == 'string' && value.constructor == String)) {
let legend = ''
if (value.__name__) {
legend += `${value.__name__}{`
} else {
legend += '{'
}
const tagKeysArr = Object.keys(value)
tagKeysArr.forEach(tagKey => {
if (tagKey !== '__name__') {
legend += `${tagKey}="${value[tagKey]}",`
}
})
if (legend.endsWith(',')) {
legend = legend.substr(0, legend.length - 1)
}
legend += '}'
value = legend
}
}
return value || ''
})
@@ -238,6 +257,25 @@ export default {
let value = null
if (lodash.get(params, label)) {
value = lodash.get(params, label)
if (!((typeof value) == 'string' && value.constructor == String)) {
let legend = ''
if (value.__name__) {
legend += `${value.__name__}{`
} else {
legend += '{'
}
const tagKeysArr = Object.keys(value)
tagKeysArr.forEach(tagKey => {
if (tagKey !== '__name__') {
legend += `${tagKey}="${value[tagKey]}",`
}
})
if (legend.endsWith(',')) {
legend = legend.substr(0, legend.length - 1)
}
legend += '}'
value = legend
}
}
return value || label
})

View File

@@ -43,9 +43,9 @@
</el-tooltip>
</span>
<span v-if="chartInfo.type=='group'" class="chart-header__tool" @click="addChartGroup">
<el-tooltip :content="$t('button.add')" effect="light" placement="top" :title="$t('tip.add')">
<i class="nz-icon nz-icon-plus tool__icon"></i>
</el-tooltip>
<!-- <el-tooltip :content="$t('button.add')" effect="light" placement="top" > -->
<i class="nz-icon nz-icon-plus tool__icon" :title="$t('tip.add')"></i>
<!-- </el-tooltip> -->
</span>
<span class="chart-header__tool" @click="refreshChart">
<div :title="$t('dashboard.refresh')" effect="light" placement="top">

View File

@@ -57,8 +57,11 @@ export default {
this.dropdownMenuShow = false
},
duplicate () {
const obj = this.$loadsh.cloneDeep(this.chartInfo)
obj.elements = obj.oldElements
delete obj.oldElements
this.$store.dispatch('dispatchEditChart', {
chart: this.chartInfo,
chart: obj,
type: 'duplicate'
})
this.dropdownMenuShow = false

View 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';

View File

@@ -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

View File

@@ -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"}

View File

@@ -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"
}

View File

@@ -0,0 +1,2 @@
import { Node } from '@topology/core';
export declare function activityFinal(ctx: CanvasRenderingContext2D, node: Node): void;

View File

@@ -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

View File

@@ -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"}

View File

@@ -0,0 +1,3 @@
import { Node } from '@topology/core';
export declare function activityFinalIconRect(node: Node): void;
export declare function activityFinalTextRect(node: Node): void;

View File

@@ -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

View File

@@ -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"}

View File

@@ -0,0 +1,2 @@
export * from './final';
export * from './final.rect';

View File

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

View File

@@ -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"}

View File

@@ -0,0 +1,3 @@
import { Node } from '@topology/core';
export declare function forkHAnchors(node: Node): void;
export declare function forkVAnchors(node: Node): void;

View File

@@ -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

View File

@@ -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,CAA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AC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,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"}

View File

@@ -0,0 +1,2 @@
import { Node } from '@topology/core';
export declare function fork(ctx: CanvasRenderingContext2D, node: Node): void;

View File

@@ -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

View File

@@ -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,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,CAAC,CAAC,EACX,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAC7B,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAC9B,CAAC,CACF,CAAC;IACF,GAAG,CAAC,KAAK,CACP,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAC7B,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAC9B,IAAI,CAAC,IAAI,CAAC,CAAC,EACX,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAC9B,CAAC,CACF,CAAC;IACF,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpF,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnF,GAAG,CAAC,SAAS,EAAE,CAAC;IAEhB,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9C,GAAG,CAAC,MAAM,EAAE,CAAC;AACf,CAAC"}

View File

@@ -0,0 +1,3 @@
import { Node } from '@topology/core';
export declare function forkIconRect(node: Node): void;
export declare function forkTextRect(node: Node): void;

View File

@@ -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

View File

@@ -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"}

View File

@@ -0,0 +1,3 @@
export * from './fork';
export * from './fork.rect';
export * from './fork.anchor';

View File

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

View File

@@ -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"}

View File

@@ -0,0 +1 @@
export declare function register(): void;

View File

@@ -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

View File

@@ -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"}

View File

@@ -0,0 +1,2 @@
export * from './swimlaneH';
export * from './swimlaneH.rect';

View File

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

View File

@@ -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"}

View File

@@ -0,0 +1,2 @@
import { Node } from '@topology/core';
export declare function swimlaneH(ctx: CanvasRenderingContext2D, node: Node): void;

View File

@@ -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

View File

@@ -0,0 +1 @@
{"version":3,"file":"swimlaneH.js","sourceRoot":"","sources":["../../../../packages/activity-diagram/src/swimlaneH/swimlaneH.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,SAAS,CA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C,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAC7B,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAC9B,IAAI,CAAC,IAAI,CAAC,CAAC,EACX,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAC9B,CAAC,CACF,CAAC;IACF,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpF,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnF,GAAG,CAAC,SAAS,EAAE,CAAC;IAEhB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1C,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAE3C,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9C,GAAG,CAAC,MAAM,EAAE,CAAC;AACf,CAAC"}

View File

@@ -0,0 +1,3 @@
import { Node } from '@topology/core';
export declare function swimlaneHIconRect(node: Node): void;
export declare function swimlaneHTextRect(node: Node): void;

View File

@@ -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

View File

@@ -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"}

View File

@@ -0,0 +1,2 @@
export * from './swimlaneV';
export * from './swimlaneV.rect';

View File

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

View File

@@ -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"}

View File

@@ -0,0 +1,2 @@
import { Node } from '@topology/core';
export declare function swimlaneV(ctx: CanvasRenderingContext2D, node: Node): void;

View File

@@ -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

View File

@@ -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,CA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AE,CAAC,CAAC,CAAC;IACpF,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnF,GAAG,CAAC,SAAS,EAAE,CAAC;IAEhB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC1C,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAE3C,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9C,GAAG,CAAC,MAAM,EAAE,CAAC;AACf,CAAC"}

View File

@@ -0,0 +1,3 @@
import { Node } from '@topology/core';
export declare function swimlaneVIconRect(node: Node): void;
export declare function swimlaneVTextRect(node: Node): void;

View File

@@ -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

View File

@@ -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"}

View File

@@ -0,0 +1,2 @@
export * from './src/echarts';
export * from './src/register';

View File

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

View File

@@ -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"}

View File

@@ -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"
}

View File

@@ -0,0 +1,3 @@
import { Node } from '@topology/core';
export declare const echartsObjs: any;
export declare function echarts(ctx: CanvasRenderingContext2D, node: Node): void;

View File

@@ -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

View File

@@ -0,0 +1 @@
{"version":3,"file":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,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"}

View File

@@ -0,0 +1 @@
export declare function register(_echarts?: any): void;

View File

@@ -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

View File

@@ -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"}

View File

@@ -0,0 +1,2 @@
export * from './src/class';
export * from './src/register';

View File

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

View File

@@ -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"}

View File

@@ -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"
}

View 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;

View File

@@ -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

View File

@@ -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,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,IAA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AAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnF,GAAG,CAAC,SAAS,EAAE,CAAC;IAEhB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC1C,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAE3C,IAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IACvD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAChC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAEjC,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9C,GAAG,CAAC,MAAM,EAAE,CAAC;AACf,CAAC"}

View 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;

View File

@@ -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

View File

@@ -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"}

View File

@@ -0,0 +1,2 @@
export * from './class';
export * from './class.rect';

View File

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

View File

@@ -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"}

View File

@@ -0,0 +1 @@
export declare function register(): void;

View File

@@ -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

View File

@@ -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"}

View 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';

View File

@@ -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

View File

@@ -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"}

View File

@@ -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"
}

View 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;
}

View File

@@ -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

View 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;
}

View File

@@ -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

View 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;
}

View File

@@ -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

View File

@@ -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,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C,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAErE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IACxG,CAAC;IAED,uBAAM,GAAN;QACE,IAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACzC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IAED,4BAAW,GAAX;QACE,OAAO,MAAM,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,wBAAO,GAAP;QACE,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;IAC9B,CAAC;IAvEM,eAAQ,GAAG,CAAC,CAAC;IAwEtB,aAAC;CAAA,AAzED,CAA4B,KAAK,GAyEhC;SAzEY,MAAM"}

View 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 {};

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

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