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
0276125a
Commit
0276125a
authored
May 27, 2020
by
任建锋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--
parent
7de225e4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
116 additions
and
25 deletions
+116
-25
project.js
src/store/modules/project.js
+24
-6
PropsTab.vue
src/views/Editor/Inspector/PropsTab.vue
+17
-0
Views.vue
src/views/Editor/Views.vue
+37
-3
drawCanvasPanel.vue
src/views/Editor/components/drawCanvasPanel.vue
+29
-11
editControlView.vue
src/views/Editor/components/editControlView.vue
+9
-5
No files found.
src/store/modules/project.js
View file @
0276125a
...
@@ -430,9 +430,9 @@ export const projectStore = {
...
@@ -430,9 +430,9 @@ export const projectStore = {
copyNode
(
state
,
{
node
,
parentNode
,
copyState
})
{
copyNode
(
state
,
{
node
,
parentNode
,
copyState
})
{
let
_node1
=
node
;
let
_node1
=
node
;
console
.
log
(
_node1
)
//
console.log(_node1)
copyNodeCatch
=
clonePureObj
(
_node1
)
copyNodeCatch
=
clonePureObj
(
_node1
)
console
.
log
(
"copyNodeCatch"
,
copyNodeCatch
)
//
console.log("copyNodeCatch", copyNodeCatch)
if
(
copyState
==
1
)
{
if
(
copyState
==
1
)
{
//复制行为
//复制行为
copyNodeCatch
.
events
copyNodeCatch
.
events
...
@@ -444,7 +444,7 @@ export const projectStore = {
...
@@ -444,7 +444,7 @@ export const projectStore = {
//copy(JSON.stringify(copyNodeCatch))
//copy(JSON.stringify(copyNodeCatch))
function
deleteChildEvent
(
copyNodeCatch
)
{
function
deleteChildEvent
(
copyNodeCatch
)
{
console
.
log
(
123
)
//
console.log(123)
delete
copyNodeCatch
.
events
;
delete
copyNodeCatch
.
events
;
if
(
copyNodeCatch
.
children
)
{
if
(
copyNodeCatch
.
children
)
{
for
(
let
item
of
copyNodeCatch
.
children
)
{
for
(
let
item
of
copyNodeCatch
.
children
)
{
...
@@ -459,7 +459,7 @@ export const projectStore = {
...
@@ -459,7 +459,7 @@ export const projectStore = {
pasteNode
(
state
,
{
node
,
parentNode
,
pasteState
})
{
pasteNode
(
state
,
{
node
,
parentNode
,
pasteState
})
{
let
_node1
=
copyNodeCatch
;
let
_node1
=
copyNodeCatch
;
console
.
log
(
copyNodeCatch
);
//
console.log(copyNodeCatch);
if
(
_node1
)
{
if
(
_node1
)
{
let
_node
=
copyBaseRoot
(
_node1
);
let
_node
=
copyBaseRoot
(
_node1
);
setUUIDForAllChildren
(
_node
);
setUUIDForAllChildren
(
_node
);
...
@@ -807,6 +807,8 @@ export const projectStore = {
...
@@ -807,6 +807,8 @@ export const projectStore = {
activeComponent
({
state
,
commit
},
data
)
{
activeComponent
({
state
,
commit
},
data
)
{
// debugger;
// debugger;
resetScrollType
(
data
.
data
)
let
getTopView
=
node
=>
{
let
getTopView
=
node
=>
{
// console.log("node",node)
// console.log("node",node)
if
(
node
.
parent
&&
!
node
.
parent
.
parent
)
{
if
(
node
.
parent
&&
!
node
.
parent
.
parent
)
{
...
@@ -837,6 +839,7 @@ export const projectStore = {
...
@@ -837,6 +839,7 @@ export const projectStore = {
commit
(
'activeComponent'
,
data
.
data
);
commit
(
'activeComponent'
,
data
.
data
);
},
},
/**
/**
* 修改属性
* 修改属性
*/
*/
...
@@ -853,12 +856,12 @@ export const projectStore = {
...
@@ -853,12 +856,12 @@ export const projectStore = {
_props
[
key
]
=
value
;
_props
[
key
]
=
value
;
});
});
console
.
log
(
"props"
,
commit
,
state
,
props
,
state
.
activeComponent
)
//
console.log("props",commit,state,props,state.activeComponent)
if
(
nodeUUidCatch
==
state
.
activeComponent
.
uuid
){
if
(
nodeUUidCatch
==
state
.
activeComponent
.
uuid
){
// events.$emit('canvasKeyVupdate', {props},"update");
// events.$emit('canvasKeyVupdate', {props},"update");
}
}
nodeUUidCatch
=
state
.
activeComponent
.
uuid
nodeUUidCatch
=
state
.
activeComponent
.
uuid
console
.
log
(
"nodeUUidCatch"
,
nodeUUidCatch
)
//
console.log("nodeUUidCatch",nodeUUidCatch)
/*if (hasAssetsDep) {
/*if (hasAssetsDep) {
commit('updateAssetDep');
commit('updateAssetDep');
...
@@ -1066,6 +1069,21 @@ function setUUIDForAllChildren(node) {
...
@@ -1066,6 +1069,21 @@ function setUUIDForAllChildren(node) {
}
}
}
}
//重置编辑视图数据为实际视图数据
function
resetScrollType
(
data
)
{
if
(
data
.
type
==
"editScrollList"
){
data
.
type
=
"scrollList"
}
if
(
data
.
type
==
"editScrollView"
){
data
.
type
=
"scrollView"
}
if
(
data
.
children
){
for
(
let
itme
of
data
.
children
){
resetScrollType
(
itme
)
}
}
}
let
copyNodeCatch
=
null
;
let
copyNodeCatch
=
null
;
function
copyBaseRoot
(
node
)
{
function
copyBaseRoot
(
node
)
{
...
...
src/views/Editor/Inspector/PropsTab.vue
View file @
0276125a
...
@@ -85,6 +85,9 @@
...
@@ -85,6 +85,9 @@
computed
:
{
computed
:
{
...
mapGetters
([
'activeComponent'
,
'activeComponentCopy'
,
'componentList'
]),
...
mapGetters
([
'activeComponent'
,
'activeComponentCopy'
,
'componentList'
]),
propsMeta
()
{
propsMeta
()
{
this
.
resetScrollType
(
this
.
activeComponent
)
console
.
log
(
this
.
activeComponent
.
type
)
return
getCmpProps
(
this
.
activeComponent
.
type
);
return
getCmpProps
(
this
.
activeComponent
.
type
);
},
},
customCmdKeys
()
{
customCmdKeys
()
{
...
@@ -109,6 +112,20 @@
...
@@ -109,6 +112,20 @@
}
}
},
},
methods
:
{
methods
:
{
//重置编辑视图数据为实际视图数据
resetScrollType
(
data
)
{
if
(
data
.
type
==
"editScrollList"
){
data
.
type
=
"scrollList"
}
if
(
data
.
type
==
"editScrollView"
){
data
.
type
=
"scrollView"
}
if
(
data
.
children
){
for
(
let
itme
of
data
.
children
){
this
.
resetScrollType
(
itme
)
}
}
},
propsUpdate
(
val
){
propsUpdate
(
val
){
// console.log("propsUpdate",val)
// console.log("propsUpdate",val)
this
.
makeProjectDirty
()
this
.
makeProjectDirty
()
...
...
src/views/Editor/Views.vue
View file @
0276125a
...
@@ -126,14 +126,42 @@
...
@@ -126,14 +126,42 @@
this
.
$refs
.
tree
.
setCurrentKey
(
node
.
uuid
);
this
.
$refs
.
tree
.
setCurrentKey
(
node
.
uuid
);
this
.
expandedKeys
=
[
node
.
uuid
];
this
.
expandedKeys
=
[
node
.
uuid
];
},
},
//重置编辑视图数据为实际视图数据
resetScrollType
(
data
)
{
if
(
data
.
type
==
"editScrollList"
){
data
.
type
=
"scrollList"
}
if
(
data
.
type
==
"editScrollView"
){
data
.
type
=
"scrollView"
}
if
(
data
.
children
){
for
(
let
itme
of
data
.
children
){
this
.
resetScrollType
(
itme
)
}
}
//console.log("1122334")
},
locateViewNodeActive
(
node
)
{
locateViewNodeActive
(
node
)
{
if
(
this
.
$refs
.
tree
){
if
(
this
.
$refs
.
tree
){
console
.
log
(
"选中"
)
//
console.log("选中")
this
.
$refs
.
tree
.
setCurrentKey
(
node
.
uuid
);
this
.
$refs
.
tree
.
setCurrentKey
(
node
.
uuid
);
this
.
expandedKeys
=
[
node
.
uuid
];
this
.
expandedKeys
=
[
node
.
uuid
];
let
data
=
this
.
$refs
.
tree
.
getCurrentNode
()
let
data
=
this
.
$refs
.
tree
.
getCurrentNode
()
let
nodeDom
=
this
.
$refs
.
tree
.
getNode
(
data
)
let
nodeDom
=
this
.
$refs
.
tree
.
getNode
(
data
)
//this.resetScrollType(this.activeComponent)
this
.
resetScrollType
(
data
)
this
.
resetScrollType
(
nodeDom
.
data
)
// if(data.type=="editScrollList"){
// data.type="scrollList"
// nodeDom.data.type="scrollList"
// }
// if(data.type=="editScrollView"){
// data.type="scrollView"
// nodeDom.data.type="scrollView"
// }
//console.log(data,nodeDom)
this
.
$store
.
dispatch
(
'activeComponent'
,
{
data
,
node
:
nodeDom
});
this
.
$store
.
dispatch
(
'activeComponent'
,
{
data
,
node
:
nodeDom
});
let
styleCatch
=
{
let
styleCatch
=
{
...
@@ -252,8 +280,13 @@
...
@@ -252,8 +280,13 @@
* 点击左侧视图列表
* 点击左侧视图列表
*/
*/
handleNodeClick
(
data
,
node
)
{
handleNodeClick
(
data
,
node
)
{
console
.
log
(
'handleNodeClick'
,
data
,
node
);
console
.
log
(
this
.
getCurrentPath
(
node
))
this
.
resetScrollType
(
data
)
this
.
resetScrollType
(
node
.
data
)
// console.log('handleNodeClick',data,node);
// console.log(this.getCurrentPath(node))
this
.
$store
.
dispatch
(
'activeComponent'
,
{
data
,
node
});
this
.
$store
.
dispatch
(
'activeComponent'
,
{
data
,
node
});
events
.
$emit
(
'canvasActiveNodeByTree'
,
this
.
getCurrentPath
(
node
));
events
.
$emit
(
'canvasActiveNodeByTree'
,
this
.
getCurrentPath
(
node
));
...
@@ -282,6 +315,7 @@
...
@@ -282,6 +315,7 @@
}
}
}
}
path
.
shift
();
path
.
shift
();
//console.log(path.join("/"))
return
path
.
join
(
"/"
);
return
path
.
join
(
"/"
);
},
},
toAddView
()
{
toAddView
()
{
...
...
src/views/Editor/components/drawCanvasPanel.vue
View file @
0276125a
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
/>
/>
<!--
<div
class=
"touch-layer"
></div>
-->
<!--
<div
class=
"touch-layer"
></div>
-->
</div>
</div>
<edit-control-view
:targetNode=
"targetNode"
:activeComponent=
"activeComponent"
></edit-control-view>
<edit-control-view
:targetNode=
"targetNode"
></edit-control-view>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
@@ -58,10 +58,28 @@
...
@@ -58,10 +58,28 @@
RuntimeLayer
,
EditControlView
},
RuntimeLayer
,
EditControlView
},
methods
:
{
methods
:
{
moveEdit
(
e
,
type
){
moveEdit
(
e
,
type
){
events
.
$emit
(
'setMoveEdit'
,
{
e
,
type
});
let
_type
=
type
;
// console.log("_type",_type)
events
.
$emit
(
'setMoveEdit'
,
{
e
,
_type
});
},
//重置编辑视图数据为实际视图数据
resetScrollType
(
data
)
{
if
(
data
.
type
==
"editScrollList"
){
data
.
type
=
"scrollList"
}
if
(
data
.
type
==
"editScrollView"
){
data
.
type
=
"scrollView"
}
if
(
data
.
children
){
for
(
let
itme
of
data
.
children
){
this
.
resetScrollType
(
itme
)
}
}
},
},
onRuntimeLayerLaunched
()
{
onRuntimeLayerLaunched
()
{
events
.
$emit
(
"viewReset"
)
//
events.$emit("viewReset")
},
},
onSelectNode
(
nodePath
)
{
onSelectNode
(
nodePath
)
{
if
(
!
nodePath
)
{
if
(
!
nodePath
)
{
...
@@ -77,7 +95,7 @@
...
@@ -77,7 +95,7 @@
getNode
(
type
)
{
getNode
(
type
)
{
if
(
type
==
"end"
){
if
(
type
==
"end"
){
this
.
targetNode
=
this
.
$refs
.
runtimeLayer
.
getNode
(
this
.
nodePath
);
this
.
targetNode
=
this
.
$refs
.
runtimeLayer
.
getNode
(
this
.
nodePath
);
console
.
log
(
"this.targetNode"
,
this
.
targetNode
)
//
console.log("this.targetNode",this.targetNode)
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
targetNode
=
this
.
$refs
.
runtimeLayer
.
getNode
(
this
.
nodePath
);
this
.
targetNode
=
this
.
$refs
.
runtimeLayer
.
getNode
(
this
.
nodePath
);
events
.
$emit
(
'locate-view-node-active'
,
this
.
targetNode
);
events
.
$emit
(
'locate-view-node-active'
,
this
.
targetNode
);
...
@@ -87,13 +105,13 @@
...
@@ -87,13 +105,13 @@
}
}
},
},
onModifyProp
(
key
,
value
,
type
)
{
onModifyProp
(
key
,
value
,
type
)
{
console
.
log
(
"修改 key v"
)
//
console.log("修改 key v")
if
(
key
==
"source"
||
key
==
"autoPlay"
){
if
(
key
==
"source"
||
key
==
"autoPlay"
){
events
.
$emit
(
"viewReset"
)
events
.
$emit
(
"viewReset"
)
}
}
if
(
key
==
"width"
||
key
==
"height"
){
//
if(key=="width"||key=="height"){
console
.
error
(
"修改长宽"
)
//
console.error("修改长宽")
}
//
}
if
(
this
.
$refs
.
runtimeLayer
){
if
(
this
.
$refs
.
runtimeLayer
){
this
.
$refs
.
runtimeLayer
.
modifyProps
(
this
.
nodePath
,
{
this
.
$refs
.
runtimeLayer
.
modifyProps
(
this
.
nodePath
,
{
[
key
]:
value
,
[
key
]:
value
,
...
@@ -124,7 +142,7 @@
...
@@ -124,7 +142,7 @@
}
}
},
},
canvasViewUpdate
(){
canvasViewUpdate
(){
this
.
$refs
.
runtimeLayer
.
showView
(
this
.
views
[
0
]);
this
.
$refs
.
runtimeLayer
&&
this
.
$refs
.
runtimeLayer
.
showView
(
this
.
views
[
0
]);
}
}
,
canvasActiveNodeByTree
(
nodePath
){
,
canvasActiveNodeByTree
(
nodePath
){
this
.
nodePath
=
nodePath
this
.
nodePath
=
nodePath
...
@@ -166,7 +184,7 @@
...
@@ -166,7 +184,7 @@
events
.
$on
(
"viewReset"
,()
=>
{
events
.
$on
(
"viewReset"
,()
=>
{
this
.
$refs
.
runtimeLayer
.
showView
(
this
.
views
[
0
]);
this
.
$refs
.
runtimeLayer
&&
this
.
$refs
.
runtimeLayer
.
showView
(
this
.
views
[
0
]);
})
})
},
},
watch
:
{
watch
:
{
...
...
src/views/Editor/components/editControlView.vue
View file @
0276125a
...
@@ -132,11 +132,11 @@ export default {
...
@@ -132,11 +132,11 @@ export default {
this
.
changeMoveOffsetY1
=
e
.
y
;
this
.
changeMoveOffsetY1
=
e
.
y
;
this
.
changeMoveOffsetX
=
this
.
changeMoveOffsetX1
-
this
.
changeMoveOffsetX2
this
.
changeMoveOffsetX
=
this
.
changeMoveOffsetX1
-
this
.
changeMoveOffsetX2
this
.
changeMoveOffsetY
=
this
.
changeMoveOffsetY1
-
this
.
changeMoveOffsetY2
this
.
changeMoveOffsetY
=
this
.
changeMoveOffsetY1
-
this
.
changeMoveOffsetY2
console
.
log
(
"this.changeMoveOffsetX"
,)
//
console.log( "this.changeMoveOffsetX",)
this
.
changeMoveOffsetX2
=
e
.
x
;
this
.
changeMoveOffsetX2
=
e
.
x
;
this
.
changeMoveOffsetY2
=
e
.
y
;
this
.
changeMoveOffsetY2
=
e
.
y
;
console
.
log
(
this
.
changeMoveOffsetX
)
//
console.log(this.changeMoveOffsetX)
this
.
modifyCopyPropertiesCon
();
this
.
modifyCopyPropertiesCon
();
}
}
...
@@ -300,6 +300,10 @@ export default {
...
@@ -300,6 +300,10 @@ export default {
this
.
moveEdit
(
e
,
`mousemove`
)
this
.
moveEdit
(
e
,
`mousemove`
)
})
})
events
.
$on
(
"viewReset"
,()
=>
{
//this.canFouce=false
})
//this.styleCatch=JSON.parse(JSON.stringify(this.targetNode));
//this.styleCatch=JSON.parse(JSON.stringify(this.targetNode));
...
@@ -332,7 +336,7 @@ export default {
...
@@ -332,7 +336,7 @@ export default {
},
},
computed
:
{
computed
:
{
position
()
{
position
()
{
console
.
log
(
"位置更新"
)
//
console.log("位置更新")
let
result
=
{};
let
result
=
{};
result
.
x
=
this
.
styleCatch
.
x
;
result
.
x
=
this
.
styleCatch
.
x
;
result
.
y
=
this
.
styleCatch
.
y
;
result
.
y
=
this
.
styleCatch
.
y
;
...
@@ -344,7 +348,7 @@ export default {
...
@@ -344,7 +348,7 @@ export default {
}
}
let
{
rotation
,
scaleX
,
scaleY
,
x
,
y
}
=
this
.
matrixToGroup
(
this
.
styleCatch
.
worldMatrix
)
let
{
rotation
,
scaleX
,
scaleY
,
x
,
y
}
=
this
.
matrixToGroup
(
this
.
styleCatch
.
worldMatrix
)
console
.
log
(
"测试矩阵"
,
this
.
matrixToGroup
(
this
.
styleCatch
.
worldMatrix
))
//
console.log("测试矩阵",this.matrixToGroup(this.styleCatch.worldMatrix))
if
(
this
.
styleCatch
.
instanceType
==
"Sprite"
&&!
this
.
styleCatch
.
source
){
if
(
this
.
styleCatch
.
instanceType
==
"Sprite"
&&!
this
.
styleCatch
.
source
){
scaleX
=
1
;
scaleX
=
1
;
...
@@ -395,7 +399,7 @@ export default {
...
@@ -395,7 +399,7 @@ export default {
},
},
watch
:
{
watch
:
{
views
:
function
(
newVal
)
{
views
:
function
(
newVal
)
{
console
.
log
(
newVal
);
//
console.log(newVal);
},
},
"activeComponent.properties"
:{
"activeComponent.properties"
:{
handler
(
newVal
)
{
handler
(
newVal
)
{
...
...
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