Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-editor
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
zeroing-editor
Commits
8f8ad27b
Commit
8f8ad27b
authored
Nov 19, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
行为编辑区缩放功能
parent
c04cd69a
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
184 additions
and
31 deletions
+184
-31
index.js
mock/api/editor/info/index.js
+75
-1
logo.png
src/assets/logo.png
+0
-0
behavior.js
src/store/modules/behavior.js
+13
-3
behavior.scss
src/themes/light/behavior.scss
+6
-0
BehaviorEditor.vue
src/views/Editor/behavior-editor/BehaviorEditor.vue
+9
-1
Board.vue
src/views/Editor/behavior-editor/Board.vue
+79
-24
ProcessNode.vue
src/views/Editor/behavior-editor/Board/ProcessNode.vue
+2
-2
No files found.
mock/api/editor/info/index.js
View file @
8f8ad27b
This diff is collapsed.
Click to expand it.
src/assets/logo.png
deleted
100644 → 0
View file @
c04cd69a
6.69 KB
src/store/modules/behavior.js
View file @
8f8ad27b
...
@@ -25,6 +25,7 @@ export const behaviorStore = {
...
@@ -25,6 +25,7 @@ export const behaviorStore = {
targetUUID
:
''
,
targetUUID
:
''
,
lineID
:
0
,
lineID
:
0
,
boardOffset
:
{
x
:
0
,
y
:
0
},
boardOffset
:
{
x
:
0
,
y
:
0
},
boardScale
:
1
,
},
},
},
},
mutations
:
{
mutations
:
{
...
@@ -78,12 +79,12 @@ export const behaviorStore = {
...
@@ -78,12 +79,12 @@ export const behaviorStore = {
},
},
deleteProcessMeta
(
state
,
{
meta
,
process
})
{
deleteProcessMeta
(
state
,
{
meta
,
process
})
{
let
container
;
let
container
;
if
(
meta
.
isInline
)
{
if
(
meta
.
isInline
)
{
container
=
process
.
meta
.
metas
;
container
=
process
.
meta
.
metas
;
}
else
{
}
else
{
container
=
state
.
data
.
processes
;
container
=
state
.
data
.
processes
;
}
}
if
(
container
)
{
if
(
container
)
{
for
(
let
i
=
0
,
li
=
container
.
length
;
i
<
li
;
i
++
)
{
for
(
let
i
=
0
,
li
=
container
.
length
;
i
<
li
;
i
++
)
{
const
process
=
container
[
i
];
const
process
=
container
[
i
];
...
@@ -106,6 +107,15 @@ export const behaviorStore = {
...
@@ -106,6 +107,15 @@ export const behaviorStore = {
state
.
processStack
.
splice
(
index
);
state
.
processStack
.
splice
(
index
);
updatePropsEditable
(
state
);
updatePropsEditable
(
state
);
},
},
setScale
(
state
,
value
)
{
let
scale
=
state
.
drawState
.
boardScale
;
if
(
value
===
0
)
{
scale
=
1
;
}
else
{
scale
+=
value
;
}
state
.
drawState
.
boardScale
=
Math
.
max
(
Math
.
min
(
4
,
scale
),
0.1
);
}
},
},
getters
:
{
getters
:
{
customProcessMap
:
state
=>
{
customProcessMap
:
state
=>
{
...
...
src/themes/light/behavior.scss
View file @
8f8ad27b
...
@@ -62,6 +62,12 @@ $dock-pin-width: 9px;
...
@@ -62,6 +62,12 @@ $dock-pin-width: 9px;
border-bottom
:
1px
solid
$--border-color-light
;
border-bottom
:
1px
solid
$--border-color-light
;
}
}
.operate-bar
{
padding
:
3px
;
border-bottom
:
1px
solid
$--border-color-light
;
}
}
}
.board
{
.board
{
...
...
src/views/Editor/behavior-editor/BehaviorEditor.vue
View file @
8f8ad27b
...
@@ -11,6 +11,13 @@
...
@@ -11,6 +11,13 @@
</split-panes>
</split-panes>
<div
class=
"center full-size background"
splitpanes-min=
"20"
:splitpanes-size=
"70"
>
<div
class=
"center full-size background"
splitpanes-min=
"20"
:splitpanes-size=
"70"
>
<edit-path
:processStack=
"processStack"
@
pop=
"onPop"
/>
<edit-path
:processStack=
"processStack"
@
pop=
"onPop"
/>
<div
class=
"operate-bar"
>
<el-button-group>
<el-button
size=
"mini"
icon=
"el-icon-zoom-out"
@
click=
"setScale(-0.1)"
/>
<el-button
size=
"mini"
@
click=
"setScale(0)"
>
1:1
</el-button>
<el-button
size=
"mini"
icon=
"el-icon-zoom-in"
@
click=
"setScale(0.1)"
/>
</el-button-group>
</div>
<board
ref=
"board"
@
select-process-node=
"onSelectProcessNode"
@
edit-process=
"editProcess"
@
edit-meta=
"onEditMeta"
/>
<board
ref=
"board"
@
select-process-node=
"onSelectProcessNode"
@
edit-process=
"editProcess"
@
edit-meta=
"onEditMeta"
/>
</div>
</div>
<div
class=
"properties background full-size"
splitpanes-min=
"20"
:splitpanes-size=
"20"
>
<div
class=
"properties background full-size"
splitpanes-min=
"20"
:splitpanes-size=
"20"
>
...
@@ -106,7 +113,7 @@
...
@@ -106,7 +113,7 @@
cancelButtonText
:
this
.
$t
(
'Cancel'
),
cancelButtonText
:
this
.
$t
(
'Cancel'
),
type
:
'warning'
type
:
'warning'
}).
then
(()
=>
{
}).
then
(()
=>
{
this
.
deleteProcessMeta
(
meta
.
id
);
this
.
deleteProcessMeta
(
{
meta
}
);
}).
catch
((
e
)
=>
{
}).
catch
((
e
)
=>
{
});
});
}
}
...
@@ -132,6 +139,7 @@
...
@@ -132,6 +139,7 @@
'clearProcessStack'
,
'clearProcessStack'
,
'pushProcessStack'
,
'pushProcessStack'
,
'popProcessStack'
,
'popProcessStack'
,
'setScale'
,
]),
]),
...
mapGetters
([
...
mapGetters
([
'metaInUse'
,
'metaInUse'
,
...
...
src/views/Editor/behavior-editor/Board.vue
View file @
8f8ad27b
<
template
>
<
template
>
<div
class=
"board"
@
dragover=
"onDragOver"
@
drop=
"onDrop"
v-resize=
"onResize"
>
<div
class=
"board"
@
dragover=
"onDragOver"
@
drop=
"onDrop"
v-resize=
"onResize"
>
<svg
class=
"svg-board full-size"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
<!--
<el-scrollbar
class=
"full-size"
>
-->
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
<svg
ref=
"board"
class=
"svg-board full-size"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
<g
id=
"layer"
stroke-width=
"2"
fill=
"none"
fill-rule=
"evenodd"
>
xmlns:xlink=
"http://www.w3.org/1999/xlink"
@
mousedown=
"onBoardMouseDown"
>
<link-line
v-for=
"(line, key, index) in lines"
:data=
"line"
:key=
"index"
@
dblclick=
"onDeleteLine"
></link-line>
<g
ref=
"borderWrapper"
:style=
"boardStyle"
>
<path
v-show=
"lineDrawing.visible"
class=
"line hover"
:d=
"lineDrawing.path"
></path>
<g
id=
"layer"
stroke-width=
"2"
fill=
"none"
fill-rule=
"evenodd"
>
</g>
<link-line
v-for=
"(line, key, index) in lines"
:data=
"line"
:key=
"index"
@
dblclick=
"onDeleteLine"
></link-line>
<g
id=
"nodes"
>
<path
v-show=
"lineDrawing.visible"
class=
"line hover"
:d=
"lineDrawing.path"
></path>
<process-node
v-for=
"(process, key, index) of subProcessMap"
:ref=
"'pn_' + key"
:process=
"process"
:key=
"index"
</g>
@
click=
"onClickProcessNode(process, key)"
<g
id=
"nodes"
>
@
hover-pin=
"onPinHover"
<process-node
v-for=
"(process, key, index) of subProcessMap"
:ref=
"'pn_' + key"
:process=
"process"
@
leave-pin=
"onPinLeave"
:key=
"index"
@
down-pin=
"onPintDown"
@
click=
"onClickProcessNode(process, key)"
@
delete=
"onProcessNodeDelete"
@
hover-pin=
"onPinHover"
@
edit-meta=
"onEditMeta"
@
leave-pin=
"onPinLeave"
@
dblclick=
"editSubProcess(process)"
@
down-pin=
"onPintDown"
@
meta-modified=
"onProcessMetaModified"
@
delete=
"onProcessNodeDelete"
/>
@
edit-meta=
"onEditMeta"
@
dblclick=
"editSubProcess(process)"
@
meta-modified=
"onProcessMetaModified"
/>
</g>
</g>
</g>
</svg>
</svg>
<!--
</el-scrollbar>
-->
<tool-tip
ref=
"toolTip"
/>
<tool-tip
ref=
"toolTip"
/>
<inline-choose-dialog
ref=
"inlineChooseDialog"
/>
<inline-choose-dialog
ref=
"inlineChooseDialog"
/>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
//:style="boardStyle"
import
{
mapState
,
mapMutations
,
mapGetters
,
mapActions
}
from
'vuex'
import
{
mapState
,
mapMutations
,
mapGetters
,
mapActions
}
from
'vuex'
import
ProcessNode
from
"./Board/ProcessNode"
;
import
ProcessNode
from
"./Board/ProcessNode"
;
import
Process
from
"./Board/Process"
;
import
Process
from
"./Board/Process"
;
...
@@ -36,7 +42,7 @@
...
@@ -36,7 +42,7 @@
import
InlineChooseDialog
from
"./InlineChooseDialog"
;
import
InlineChooseDialog
from
"./InlineChooseDialog"
;
const
customs
=
[
'custom'
,
'divider'
];
const
customs
=
[
'custom'
,
'divider'
];
//todo 缩放功能
export
default
{
export
default
{
name
:
"Board"
,
name
:
"Board"
,
components
:
{
InlineChooseDialog
,
ToolTip
,
LinkLine
,
ProcessNode
,},
components
:
{
InlineChooseDialog
,
ToolTip
,
LinkLine
,
ProcessNode
,},
...
@@ -52,6 +58,10 @@
...
@@ -52,6 +58,10 @@
path
:
''
,
path
:
''
,
process
:
null
,
process
:
null
,
},
},
boardOffset
:
{
x
:
0
,
y
:
0
,
}
}
}
},
},
mounted
()
{
mounted
()
{
...
@@ -61,7 +71,13 @@
...
@@ -61,7 +71,13 @@
...
mapState
({
...
mapState
({
drawState
:
state
=>
state
.
behavior
.
drawState
,
drawState
:
state
=>
state
.
behavior
.
drawState
,
editable
:
state
=>
state
.
behavior
.
editable
,
editable
:
state
=>
state
.
behavior
.
editable
,
})
scale
:
state
=>
state
.
behavior
.
drawState
.
boardScale
,
}),
boardStyle
()
{
return
{
transform
:
`scale(
${
this
.
scale
}
) translate(
${
this
.
boardOffset
.
x
}
px,
${
this
.
boardOffset
.
y
}
px)`
}
},
},
},
methods
:
{
methods
:
{
...
mapActions
([
...
mapActions
([
...
@@ -72,6 +88,8 @@
...
@@ -72,6 +88,8 @@
'deleteProcessMeta'
,
'deleteProcessMeta'
,
]),
]),
async
edit
(
process
,
resolveProcess
)
{
async
edit
(
process
,
resolveProcess
)
{
this
.
boardOffset
.
x
=
0
;
this
.
boardOffset
.
y
=
0
;
this
.
selectedProcessNode
=
null
;
this
.
selectedProcessNode
=
null
;
this
.
process
=
process
;
this
.
process
=
process
;
this
.
resolveProcess
=
resolveProcess
;
this
.
resolveProcess
=
resolveProcess
;
...
@@ -143,7 +161,7 @@
...
@@ -143,7 +161,7 @@
x
:
e
.
offsetX
-
9
,
x
:
e
.
offsetX
-
9
,
y
:
e
.
offsetY
,
y
:
e
.
offsetY
,
});
});
if
(
!
data
)
{
if
(
!
data
)
{
return
;
return
;
}
}
this
.
addSubProcess
(
data
.
uuid
,
data
);
this
.
addSubProcess
(
data
.
uuid
,
data
);
...
@@ -213,9 +231,10 @@
...
@@ -213,9 +231,10 @@
this
.
onMouseMove
(
e
);
this
.
onMouseMove
(
e
);
},
},
onMouseMove
(
e
)
{
onMouseMove
(
e
)
{
const
scale
=
this
.
scale
;
let
x
=
e
.
x
-
this
.
drawState
.
boardOffset
.
x
;
let
x
=
e
.
x
-
this
.
drawState
.
boardOffset
.
x
;
let
y
=
e
.
y
-
this
.
drawState
.
boardOffset
.
y
;
let
y
=
e
.
y
-
this
.
drawState
.
boardOffset
.
y
;
this
.
lineDrawing
.
path
=
this
.
drawingLineStart
+
`
${
x
}
,
${
y
}
${
x
}
,
${
y
}
`
;
this
.
lineDrawing
.
path
=
this
.
drawingLineStart
+
`
${
x
/
scale
}
,
${
y
/
scale
}
${
x
/
scale
}
,
${
y
/
scale
}
`
;
},
},
onMouseUp
(
e
)
{
onMouseUp
(
e
)
{
document
.
removeEventListener
(
"mousemove"
,
this
.
onMouseMove
);
document
.
removeEventListener
(
"mousemove"
,
this
.
onMouseMove
);
...
@@ -256,11 +275,11 @@
...
@@ -256,11 +275,11 @@
});
});
}
}
},
},
onEditMeta
(
data
,
meta
){
onEditMeta
(
data
,
meta
)
{
this
.
$emit
(
'edit-meta'
,
meta
);
this
.
$emit
(
'edit-meta'
,
meta
);
},
},
editSubProcess
(
process
)
{
editSubProcess
(
process
)
{
if
(
!
process
.
meta
.
isDivider
&&
(
this
.
editable
||
process
.
meta
.
sub
&&
Object
.
keys
(
process
.
meta
.
sub
).
length
>
0
))
{
if
(
!
process
.
meta
.
isDivider
&&
(
this
.
editable
||
process
.
meta
.
type
!==
'builtin'
||
process
.
meta
.
sub
&&
Object
.
keys
(
process
.
meta
.
sub
).
length
>
0
))
{
this
.
$emit
(
'edit-process'
,
process
);
this
.
$emit
(
'edit-process'
,
process
);
}
}
},
},
...
@@ -309,7 +328,43 @@
...
@@ -309,7 +328,43 @@
}
}
}
}
});
});
}
},
onBoardMouseDown
(
e
)
{
if
(
e
.
target
!==
this
.
$refs
.
board
)
{
return
;
}
document
.
addEventListener
(
"mousemove"
,
this
.
onBoardMouseMove
);
document
.
addEventListener
(
"mouseup"
,
this
.
onBoardMouseUp
);
const
{
screenX
,
screenY
}
=
e
;
this
.
boardDragDownPos
=
{
x
:
screenX
,
y
:
screenY
};
this
.
boardDragStartPos
=
{
x
:
this
.
boardOffset
.
x
,
y
:
this
.
boardOffset
.
y
,
}
},
onBoardMouseMove
(
e
)
{
if
(
!
this
.
boardDragDownPos
)
{
return
;
}
const
{
x
,
y
}
=
this
.
boardDragDownPos
;
const
{
screenX
,
screenY
}
=
e
;
const
offset
=
{
x
:
screenX
-
x
,
y
:
screenY
-
y
,
};
this
.
boardOffset
.
x
=
this
.
boardDragStartPos
.
x
+
offset
.
x
/
this
.
scale
;
this
.
boardOffset
.
y
=
this
.
boardDragStartPos
.
y
+
offset
.
y
/
this
.
scale
;
//console.log(this.boardOffset.x, this.boardOffset.y);
},
onBoardMouseUp
(
e
)
{
if
(
!
this
.
boardDragDownPos
)
{
return
;
}
this
.
boardDragDownPos
=
null
;
},
}
}
}
}
</
script
>
</
script
>
...
...
src/views/Editor/behavior-editor/Board/ProcessNode.vue
View file @
8f8ad27b
...
@@ -158,8 +158,8 @@
...
@@ -158,8 +158,8 @@
const
{
x
,
y
,
dx
,
dy
}
=
this
.
mouseDownPos
;
const
{
x
,
y
,
dx
,
dy
}
=
this
.
mouseDownPos
;
const
offset
=
this
.
offset
=
{
x
:
e
.
screenX
-
x
,
y
:
e
.
screenY
-
y
};
const
offset
=
this
.
offset
=
{
x
:
e
.
screenX
-
x
,
y
:
e
.
screenY
-
y
};
const
tx
=
offset
.
x
+
dx
;
const
tx
=
offset
.
x
/
this
.
drawState
.
boardScale
+
dx
;
const
ty
=
offset
.
y
+
dy
;
const
ty
=
offset
.
y
/
this
.
drawState
.
boardScale
+
dy
;
this
.
data
.
design
.
x
=
tx
;
this
.
data
.
design
.
x
=
tx
;
this
.
data
.
design
.
y
=
ty
;
this
.
data
.
design
.
y
=
ty
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment