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
0bce7f80
Commit
0bce7f80
authored
May 14, 2020
by
任建锋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--
parent
ef24bbd3
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
72 additions
and
66 deletions
+72
-66
index.vue
src/components/customElement/node/index.vue
+9
-4
config.js
src/config.js
+1
-1
project.js
src/store/modules/project.js
+5
-0
common.js
src/utils/common.js
+5
-4
Playground.vue
src/views/Editor/Playground.vue
+10
-1
Views.vue
src/views/Editor/Views.vue
+10
-2
drawCanvasPanel.vue
src/views/Editor/components/drawCanvasPanel.vue
+26
-50
editControlView.vue
src/views/Editor/components/editControlView.vue
+1
-3
viewsCanvasTree.vue
src/views/Editor/components/viewsCanvasTree.vue
+5
-1
No files found.
src/components/customElement/node/index.vue
View file @
0bce7f80
<
template
>
<
template
>
<div
:style=
"customStyle"
@
click
.
self
.
stop=
"clickViewHandle(view)"
class=
"zero-custom-cmp zero-custom-node"
>
<div
:style=
"customStyle"
class=
"zero-custom-cmp zero-custom-node"
>
<p
class=
"custom-node-html"
v-if=
"selfText"
>
{{
selfText
}}
</p>
<p
class=
"custom-node-html"
v-if=
"selfText"
>
{{
selfText
}}
</p>
<slot></slot>
<slot></slot>
</div>
</div>
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
</
style
>
</
style
>
<
script
>
<
script
>
import
events
from
"@/global-events.js"
export
default
{
export
default
{
name
:
'customNode'
,
name
:
'customNode'
,
props
:
{
props
:
{
...
@@ -38,12 +40,15 @@ export default {
...
@@ -38,12 +40,15 @@ export default {
},
},
computed
:
{
computed
:
{
selfText
()
{
selfText
()
{
return
this
.
properties
?
this
.
properties
.
text
||
''
:
''
;
return
this
.
properties
?
''
||
''
:
''
;
//return this.properties ? this.properties.text || '' : '';
}
}
},
},
methods
:
{
methods
:
{
clickViewHandle
(
data
)
{
clickViewHandle
(
e
)
{
this
.
$store
.
dispatch
(
'activeComponent'
,
{
data
,
fromPlayground
:
true
});
console
.
log
(
"click"
,
e
.
offsetX
)
// events.$emit("onClickTouchLayer",e);
// this.$store.dispatch('activeComponent', {data, fromPlayground: true});
}
}
}
}
};
};
...
...
src/config.js
View file @
0bce7f80
...
@@ -8,7 +8,7 @@ if (process.env.NODE_ENV === 'development') {
...
@@ -8,7 +8,7 @@ if (process.env.NODE_ENV === 'development') {
//API_HOST = '//192.168.1.16:7777';
//API_HOST = '//192.168.1.16:7777';
API_HOST
=
'//10.10.35.210:3000'
;
API_HOST
=
'//10.10.35.210:3000'
;
//API_HOST = '//192.168.0.105:7777';
//API_HOST = '//192.168.0.105:7777';
//API_HOST = '//localhost:
3002
';
//API_HOST = '//localhost:
8080
';
//API_HOST = window.__data.apiHost;
//API_HOST = window.__data.apiHost;
//API_HOST = 'http://beacon.duiba.com.cn';
//API_HOST = 'http://beacon.duiba.com.cn';
//API_HOST = 'http://beacon.duibadev.com.cn';
//API_HOST = 'http://beacon.duibadev.com.cn';
...
...
src/store/modules/project.js
View file @
0bce7f80
...
@@ -26,6 +26,8 @@ import {packageStore} from "./package"
...
@@ -26,6 +26,8 @@ import {packageStore} from "./package"
import
{
toZeroing
}
from
"psd-parse-web"
import
{
toZeroing
}
from
"psd-parse-web"
import
{
arrayFind
}
from
"element-ui/src/utils/util"
;
import
{
arrayFind
}
from
"element-ui/src/utils/util"
;
import
{
uploadFiles
}
from
"./editor"
;
import
{
uploadFiles
}
from
"./editor"
;
import
events
from
"@/global-events.js"
const
storeName
=
'project'
;
const
storeName
=
'project'
;
const
psStoreName
=
'pack-history'
;
const
psStoreName
=
'pack-history'
;
...
@@ -811,6 +813,9 @@ export const projectStore = {
...
@@ -811,6 +813,9 @@ export const projectStore = {
_props
[
key
]
=
value
;
_props
[
key
]
=
value
;
});
});
console
.
log
(
"props"
,
props
,
state
.
activeComponent
)
events
.
$emit
(
'canvasKeyVupdate'
,
{
props
,
activeComponent
:
state
.
activeComponent
});
/*if (hasAssetsDep) {
/*if (hasAssetsDep) {
commit('updateAssetDep');
commit('updateAssetDep');
}*/
}*/
...
...
src/utils/common.js
View file @
0bce7f80
...
@@ -33,10 +33,10 @@ const attrShortMapper = {
...
@@ -33,10 +33,10 @@ const attrShortMapper = {
size
:
'font-size'
,
size
:
'font-size'
,
font
:
'font-family'
,
font
:
'font-family'
,
alpha
:
'opacity'
,
alpha
:
'opacity'
,
strokeColor
:
'border-color'
,
//
strokeColor: 'border-color',
strokeWidth
:
'border-width'
,
//
strokeWidth: 'border-width',
fillColor
:
'background-color'
,
//
fillColor: 'background-color',
source
:
'background-image'
,
//
source: 'background-image',
anchorX
:
'-webkit-transform-origin-x'
,
anchorX
:
'-webkit-transform-origin-x'
,
anchorY
:
'-webkit-transform-origin-y'
,
anchorY
:
'-webkit-transform-origin-y'
,
};
};
...
@@ -195,6 +195,7 @@ export const styles = {
...
@@ -195,6 +195,7 @@ export const styles = {
return
[
'transform'
,
[
`scaleY(
${
value
}
)`
]];
//`transform: scaleY(${value});`;
return
[
'transform'
,
[
`scaleY(
${
value
}
)`
]];
//`transform: scaleY(${value});`;
case
'visible'
:
case
'visible'
:
return
[
'display'
,
[
value
?
'block'
:
'none'
]];
// `display: ${value ? 'block' : 'none'};`;
return
[
'display'
,
[
value
?
'block'
:
'none'
]];
// `display: ${value ? 'block' : 'none'};`;
//return ['display', ['none']]; // `display: ${value ? 'block' : 'none'};`;
case
'-webkit-transform-origin-x'
:
case
'-webkit-transform-origin-x'
:
return
[
'-webkit-transform-origin-x'
,
[
`
${
value
}
px`
]];
// `display: ${value ? 'block' : 'none'};`;
return
[
'-webkit-transform-origin-x'
,
[
`
${
value
}
px`
]];
// `display: ${value ? 'block' : 'none'};`;
case
'-webkit-transform-origin-y'
:
case
'-webkit-transform-origin-y'
:
...
...
src/views/Editor/Playground.vue
View file @
0bce7f80
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
</el-form>
</el-form>
</div>
</div>
<div
class=
"zero-playground-body-center"
:style=
"playgroundStyle"
>
<div
class=
"zero-playground-body-center"
:style=
"playgroundStyle"
ref=
"zeroPlayground"
@
mousedown=
"clickViewHandle"
>
<!--
<div
class=
"zero-playground-draw-panel"
>
-->
<!--
<div
class=
"zero-playground-draw-panel"
>
-->
<draw-canvas-panel></draw-canvas-panel>
<draw-canvas-panel></draw-canvas-panel>
<!--
</div>
-->
<!--
</div>
-->
...
@@ -51,6 +51,15 @@ export default {
...
@@ -51,6 +51,15 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
clickViewHandle
(
e
)
{
console
.
log
(
e
.
pageX
-
this
.
$refs
.
zeroPlayground
.
getBoundingClientRect
().
left
/
2
)
events
.
$emit
(
"onClickTouchLayer"
,{
x
:
e
.
pageX
-
this
.
$refs
.
zeroPlayground
.
getBoundingClientRect
().
left
/
2
,
y
:
e
.
pageY
-
this
.
$refs
.
zeroPlayground
.
getBoundingClientRect
().
top
/
2
});
// this.$store.dispatch('activeComponent', {data, fromPlayground: true});
},
mouseWheel
(
e
){
mouseWheel
(
e
){
if
(
!
this
.
hasCtrlState
){
if
(
!
this
.
hasCtrlState
){
return
;
return
;
...
...
src/views/Editor/Views.vue
View file @
0bce7f80
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
:allow-drag=
"allowDrag"
:allow-drag=
"allowDrag"
:allow-drop=
"allowDrop"
:allow-drop=
"allowDrop"
:filter-node-method=
"filterNodeMethod"
:filter-node-method=
"filterNodeMethod"
@
node-click
=
"handleNodeClick"
@
current-change
=
"handleNodeClick"
@
node-drop=
"onNodeDrop"
@
node-drop=
"onNodeDrop"
>
>
<div
slot-scope=
"
{ node, data }" class="tree-node">
<div
slot-scope=
"
{ node, data }" class="tree-node">
...
@@ -98,6 +98,7 @@
...
@@ -98,6 +98,7 @@
},
},
mounted
()
{
mounted
()
{
events
.
$on
(
'locate-view-node'
,
this
.
locateViewNode
);
events
.
$on
(
'locate-view-node'
,
this
.
locateViewNode
);
events
.
$on
(
'locate-view-node-active'
,
this
.
locateViewNodeActive
);
},
},
destroyed
()
{
destroyed
()
{
events
.
$off
(
'locate-view-node'
,
this
.
locateViewNode
);
events
.
$off
(
'locate-view-node'
,
this
.
locateViewNode
);
...
@@ -123,6 +124,13 @@
...
@@ -123,6 +124,13 @@
this
.
$refs
.
tree
.
setCurrentKey
(
node
.
uuid
);
this
.
$refs
.
tree
.
setCurrentKey
(
node
.
uuid
);
this
.
expandedKeys
=
[
node
.
uuid
];
this
.
expandedKeys
=
[
node
.
uuid
];
},
},
locateViewNodeActive
(
node
)
{
this
.
$refs
.
tree
.
setCurrentKey
(
node
.
uuid
);
this
.
expandedKeys
=
[
node
.
uuid
];
let
data
=
this
.
$refs
.
tree
.
getCurrentNode
()
let
nodeDom
=
this
.
$refs
.
tree
.
getNode
(
data
)
this
.
$store
.
dispatch
(
'activeComponent'
,
{
data
,
node
:
nodeDom
});
},
updateFilter
()
{
updateFilter
()
{
if
(
this
.
$refs
.
tree
)
{
if
(
this
.
$refs
.
tree
)
{
this
.
$refs
.
tree
.
filter
(
this
.
filterText
);
this
.
$refs
.
tree
.
filter
(
this
.
filterText
);
...
@@ -219,7 +227,7 @@
...
@@ -219,7 +227,7 @@
* 点击左侧视图列表
* 点击左侧视图列表
*/
*/
handleNodeClick
(
data
,
node
)
{
handleNodeClick
(
data
,
node
)
{
console
.
log
(
'handleNodeClick'
);
console
.
log
(
'handleNodeClick'
,
data
,
node
);
this
.
$store
.
dispatch
(
'activeComponent'
,
{
data
,
node
});
this
.
$store
.
dispatch
(
'activeComponent'
,
{
data
,
node
});
},
},
...
...
src/views/Editor/components/drawCanvasPanel.vue
View file @
0bce7f80
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<
template
>
<
template
>
<div
class=
"zero-draw-panel-container"
>
<div
class=
"zero-draw-panel-container"
>
<div
class=
"zero-components-container"
>
<div
class=
"zero-components-container"
>
<views-canvas-tree
:views=
"views"
></views-canvas-tree>
<views-canvas-tree
:views=
"views"
></views-canvas-tree>
<div
class=
"playground-wrapper"
>
<div
class=
"playground-wrapper"
>
<runtime-layer
ref=
"runtimeLayer"
<runtime-layer
ref=
"runtimeLayer"
:design-width=
"parseInt(options.designWidth)"
:design-width=
"parseInt(options.designWidth)"
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
@
launched=
"onRuntimeLayerLaunched"
@
launched=
"onRuntimeLayerLaunched"
@
select-node=
"onSelectNode"
@
select-node=
"onSelectNode"
/>
/>
<
div
class=
"touch-layer"
@
click=
"onClickTouchLayer"
></div
>
<
!--
<div
class=
"touch-layer"
@
click=
"onClickTouchLayer"
></div>
--
>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -76,21 +76,33 @@
...
@@ -76,21 +76,33 @@
},
},
getNode
()
{
getNode
()
{
this
.
targetNode
=
this
.
$refs
.
runtimeLayer
.
getNode
(
this
.
nodePath
);
this
.
targetNode
=
this
.
$refs
.
runtimeLayer
.
getNode
(
this
.
nodePath
);
console
.
log
(
this
.
targetNode
.
name
,
this
.
targetNode
)
events
.
$emit
(
'locate-view-node-active'
,
this
.
targetNode
);
},
},
onModifyProp
(
key
,
value
)
{
onModifyProp
(
key
,
value
,
data
)
{
console
.
log
(
data
.
activeComponent
.
name
,
this
.
targetNode
.
name
,
this
.
nodePath
)
if
(
data
.
activeComponent
.
uuid
==
this
.
targetNode
.
uuid
){
console
.
log
()
this
.
$refs
.
runtimeLayer
.
modifyProps
(
this
.
nodePath
,
{
this
.
$refs
.
runtimeLayer
.
modifyProps
(
this
.
nodePath
,
{
[
key
]:
value
,
[
key
]:
value
,
},
()
=>
{
},
()
=>
{
this
.
getNode
();
this
.
getNode
();
})
})
}
},
},
onClickTouchLayer
(
e
){
onClickTouchLayer
(
e
){
const
{
x
,
y
}
=
e
;
const
{
offsetX
:
x
,
offsetY
:
y
}
=
e
;
console
.
log
(
"sdsd"
,
x
/
this
.
zoom
,
y
/
this
.
zoom
)
console
.
log
(
"sdsd"
,
x
/
this
.
zoom
,
y
/
this
.
zoom
)
this
.
nodePath
=
this
.
$refs
.
runtimeLayer
.
getNodePathWithPos
({
x
:
x
/
this
.
zoom
,
y
:
y
/
this
.
zoom
});
this
.
nodePath
=
this
.
$refs
.
runtimeLayer
.
getNodePathWithPos
({
x
:
x
/
this
.
zoom
,
y
:
y
/
this
.
zoom
});
console
.
log
(
this
.
nodePath
)
console
.
log
(
this
.
nodePath
)
console
.
log
(
this
.
targetNode
)
},
canvasKeyVupdate
(
data
){
console
.
log
(
10
,
data
)
for
(
let
item
in
data
.
props
){
console
.
log
(
item
)
this
.
onModifyProp
(
item
,
data
.
props
[
item
],
data
)
}
}
}
},
},
computed
:
{
computed
:
{
...
@@ -103,6 +115,9 @@
...
@@ -103,6 +115,9 @@
events
.
$on
(
"setPlaygroundZoom"
,
data
=>
{
events
.
$on
(
"setPlaygroundZoom"
,
data
=>
{
this
.
zoom
=
data
.
zoom
;
this
.
zoom
=
data
.
zoom
;
});
});
events
.
$on
(
"onClickTouchLayer"
,
this
.
onClickTouchLayer
);
events
.
$on
(
'canvasKeyVupdate'
,
this
.
canvasKeyVupdate
);
},
},
watch
:
{
watch
:
{
nodePath
()
{
nodePath
()
{
...
@@ -177,48 +192,9 @@
...
@@ -177,48 +192,9 @@
</
style
>
</
style
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
*
{
padding
:
0
;
margin
:
0
;
}
html
,
body
,
#app
{
width
:
100%
;
height
:
100%
;
}
input
{
width
:
100px
;
}
.operate-bar
{
padding
:
5px
;
margin-bottom
:
5px
;
.line
{
padding
:
3px
;
display
:
flex
;
flex-wrap
:
wrap
;
}
.line
+
.line
{
border-top
:
1px
solid
lightgray
;
}
}
.playground-wrapper
{
.playground-wrapper
{
position
:
relative
;
position
:
relative
;
display
:
inline-block
;
display
:
inline-block
;
margin-left
:
10px
;
}
.touch-layer
{
background-color
:
rgba
(
0
,
0
,
0
,
0
);
position
:
absolute
;
top
:
0
;
left
:
0
;
right
:
0
;
bottom
:
0
;
}
}
</
style
>
</
style
>
src/views/Editor/components/editControlView.vue
View file @
0bce7f80
...
@@ -235,6 +235,7 @@ export default {
...
@@ -235,6 +235,7 @@ export default {
}
}
},
},
modifyPropertiesCon
()
{
modifyPropertiesCon
()
{
// events.$emit('canvasKeyVupdate', {properties:this.activeComponent.properties});
if
(
this
.
editEvent
==
"bottomright"
)
{
if
(
this
.
editEvent
==
"bottomright"
)
{
this
.
$store
.
dispatch
(
"modifyProperties"
,
{
this
.
$store
.
dispatch
(
"modifyProperties"
,
{
width
:
parseInt
(
this
.
catchWidth
+
this
.
changeMoveX
*
this
.
zoom
),
width
:
parseInt
(
this
.
catchWidth
+
this
.
changeMoveX
*
this
.
zoom
),
...
@@ -322,9 +323,6 @@ export default {
...
@@ -322,9 +323,6 @@ export default {
if
(
!
this
.
activeComponent
)
{
if
(
!
this
.
activeComponent
)
{
return
{};
return
{};
}
}
console
.
log
(
this
.
styleCatch
);
let
result
=
{
let
result
=
{
width
:
`
${
this
.
styleCatch
.
width
?
this
.
styleCatch
.
width
:(
this
.
styleCatch
.
imageWidth
?
this
.
styleCatch
.
imageWidth
:
0
)}
px`
,
width
:
`
${
this
.
styleCatch
.
width
?
this
.
styleCatch
.
width
:(
this
.
styleCatch
.
imageWidth
?
this
.
styleCatch
.
imageWidth
:
0
)}
px`
,
height
:
`
${
this
.
styleCatch
.
height
?
this
.
styleCatch
.
height
:(
this
.
styleCatch
.
imageHeight
?
this
.
styleCatch
.
imageHeight
:
0
)}
px`
,
height
:
`
${
this
.
styleCatch
.
height
?
this
.
styleCatch
.
height
:(
this
.
styleCatch
.
imageHeight
?
this
.
styleCatch
.
imageHeight
:
0
)}
px`
,
...
...
src/views/Editor/components/viewsCanvasTree.vue
View file @
0bce7f80
<
template
>
<
template
>
<div
class=
"views-tree"
>
<div
class=
"views-tree"
>
<custom-node
v-for=
"view in views"
:key=
"view.uuid"
:view=
"view"
:custom-style=
"styleObject(view)"
:properties=
"view.properties"
>
<custom-node
v-for=
"view in views"
:key=
"view.uuid"
:view=
"view"
:custom-style=
"styleObject(view)"
:properties=
"view.properties"
>
<template
v-if=
"view.children"
>
<template
v-if=
"view.children"
>
<views-tree
:views=
"view.children"
></views-tree>
<views-tree
:views=
"view.children"
></views-tree>
...
@@ -33,6 +32,7 @@
...
@@ -33,6 +32,7 @@
</template>
</template>
<
script
>
<
script
>
import
events
from
"@/global-events.js"
import
{
mapState
,
mapGetters
}
from
'vuex'
;
import
{
mapState
,
mapGetters
}
from
'vuex'
;
import
{
styles
}
from
'../../../utils/common'
;
import
{
styles
}
from
'../../../utils/common'
;
import
customNode
from
'../../../components/customElement/node/index.vue'
;
import
customNode
from
'../../../components/customElement/node/index.vue'
;
...
@@ -161,4 +161,8 @@ export default {
...
@@ -161,4 +161,8 @@ export default {
</
script
>
</
script
>
<
style
>
<
style
>
.views-tree
{
position
:
absolute
;
z-index
:
99
;
}
</
style
>
</
style
>
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