feat: 修改topology 添加连线为点击添加一条直线
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
const data = {
|
||||
borderType: 0,
|
||||
disableInput: true,
|
||||
rotate: 0,
|
||||
borderColor: '#22222200',
|
||||
data: {
|
||||
parent: '',
|
||||
statistic: 'last',
|
||||
legend: '',
|
||||
enable: {
|
||||
tooltip: false,
|
||||
valueMapping: false
|
||||
},
|
||||
valueMapping: [
|
||||
|
||||
],
|
||||
params: {
|
||||
borderColor: '#22222200',
|
||||
color: '#222222FF',
|
||||
animateColor: '#FA901CFF'
|
||||
},
|
||||
value: ''
|
||||
},
|
||||
lineAnimateType: 0,
|
||||
color: '#222222FF',
|
||||
animateSpan: 1,
|
||||
animateReverse: false,
|
||||
toArrow: 'triangleSolid',
|
||||
lineName: 'line',
|
||||
anchors: [
|
||||
{
|
||||
x: 0,
|
||||
start: true,
|
||||
y: 0,
|
||||
id: '5e66fc16',
|
||||
penId: '6c5996e8',
|
||||
lineLength: 150,
|
||||
},
|
||||
{
|
||||
shiftKey: false,
|
||||
buttons: 1,
|
||||
clientY: 203,
|
||||
clientX: 1482,
|
||||
ctrlKey: false,
|
||||
x: 1,
|
||||
y: 1,
|
||||
altKey: false,
|
||||
id: '31eb0808',
|
||||
pageY: 203,
|
||||
penId: '6c5996e8',
|
||||
pageX: 1482
|
||||
}
|
||||
],
|
||||
type: 1,
|
||||
lineWidth: 1,
|
||||
isBottom: true,
|
||||
borderWidth: 0,
|
||||
fromArrow: '',
|
||||
id: '',
|
||||
text: '',
|
||||
moduleId: '',
|
||||
locked: 0,
|
||||
height: 2,
|
||||
visible: true,
|
||||
nzName: '',
|
||||
isNz: true,
|
||||
length: 164.01219466856725,
|
||||
moduleData: {
|
||||
moduleId: '',
|
||||
moduleName: '',
|
||||
show: false,
|
||||
error: false,
|
||||
expressArr: [
|
||||
|
||||
],
|
||||
expressAllArr: [
|
||||
|
||||
],
|
||||
state: {
|
||||
error: false,
|
||||
asset: 0,
|
||||
alert: 0,
|
||||
endpoint: 0
|
||||
}
|
||||
},
|
||||
ex: -1659,
|
||||
ey: -193,
|
||||
lineDash: [
|
||||
|
||||
],
|
||||
name: 'line',
|
||||
x: -1823,
|
||||
width: 164,
|
||||
y: -195,
|
||||
fontSize: 12,
|
||||
lineHeight: 1.5,
|
||||
animateColor: '#FA901CFF',
|
||||
autoPlay: false
|
||||
}
|
||||
|
||||
export default data
|
||||
@@ -208,9 +208,6 @@ export default {
|
||||
if (pen.data && pen.data.params) {
|
||||
return
|
||||
}
|
||||
if (name) {
|
||||
pen.text = name
|
||||
}
|
||||
pen.data = {
|
||||
params: {
|
||||
animateColor: pen.animateColor || '#FA901CFF',
|
||||
|
||||
@@ -9,13 +9,22 @@
|
||||
<i class="nz-icon nz-icon-juxing" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="tools-left-draw"
|
||||
class="top-tool-item"
|
||||
:class="drawLineFlag ? 'is-active-meta2d' : ''"
|
||||
@click="changeState('drawLineFlag')"
|
||||
:title="$t('project.topology.addLine')">
|
||||
<div id="tools-left-addline"
|
||||
class="top-tool-item top-tool-item-delete"
|
||||
:title="$t('project.topology.addNode')"
|
||||
@click="addLine">
|
||||
<div
|
||||
>
|
||||
<i class="nz-icon nz-icon-xiantiao" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div id="tools-left-draw"-->
|
||||
<!-- class="top-tool-item"-->
|
||||
<!-- :class="drawLineFlag ? 'is-active-meta2d' : ''"-->
|
||||
<!-- @click="changeState('drawLineFlag')"-->
|
||||
<!-- :title="$t('project.topology.addLine')">-->
|
||||
<!-- <i class="nz-icon nz-icon-xiantiao" />-->
|
||||
<!-- </div>-->
|
||||
<div id="undo"
|
||||
class="top-tool-item"
|
||||
:class="undoFlag ? '' : 'is-active-meta2d' "
|
||||
@@ -85,8 +94,8 @@
|
||||
<script>
|
||||
import { getTopology } from '../../js/common'
|
||||
import bus from '@/libs/bus'
|
||||
import { deepClone } from '@meta2d/core'
|
||||
|
||||
import { deepClone, s8 } from '@meta2d/core'
|
||||
import lineData from './js/defaultPenLineData'
|
||||
export default {
|
||||
name: 'topologyTopTool',
|
||||
data () {
|
||||
@@ -196,6 +205,30 @@ export default {
|
||||
}
|
||||
getTopology(this.meta2dId).addPen(pen , true)
|
||||
},
|
||||
addLine () {
|
||||
const data = getTopology(this.meta2dId).data()
|
||||
const offestX = data.x
|
||||
const offestY = data.y
|
||||
const penId = s8()
|
||||
lineData.anchors[0].id = s8()
|
||||
lineData.anchors[1].id = s8()
|
||||
lineData.anchors[0].penId = penId
|
||||
lineData.anchors[1].penId = s8()
|
||||
const pen = {
|
||||
...lineData,
|
||||
id: penId,
|
||||
nzName: 'elements-' + getTopology(this.meta2dId).store.data.pens.length,
|
||||
type: 1,
|
||||
x: 100 - offestX,
|
||||
y: 100 - offestY,
|
||||
width: 150,
|
||||
length: 150,
|
||||
lineName: 'line',
|
||||
ex: 100 - offestX + 150,
|
||||
ey: 100 - offestY
|
||||
}
|
||||
getTopology(this.meta2dId).addPen(pen , true)
|
||||
},
|
||||
changeDrawLineFlag () {
|
||||
if (this.dragstartFlag) {
|
||||
this.dragstartFlag = false
|
||||
|
||||
Reference in New Issue
Block a user