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
5d30bd2e
Commit
5d30bd2e
authored
Nov 14, 2019
by
张晨辰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: drawpanel 375 -> 750
parent
ef45b774
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
27 deletions
+53
-27
project.js
src/store/modules/project.js
+36
-7
playground.scss
src/themes/light/playground.scss
+8
-6
common.js
src/utils/common.js
+5
-10
properties.js
src/utils/properties.js
+4
-4
No files found.
src/store/modules/project.js
View file @
5d30bd2e
...
...
@@ -98,7 +98,7 @@ export const projectStore = {
return
;
}
let
_v
iew
=
_
.
cloneDeep
(
state
.
activeComponent
||
{});
let
oldV
iew
=
_
.
cloneDeep
(
state
.
activeComponent
||
{});
if
(
state
.
operateStack
.
length
)
{
if
(
state
.
stackIndex
!==
0
)
{
// 如果操作栈index有值,说明之前做过撤销/重做
...
...
@@ -108,19 +108,19 @@ export const projectStore = {
let
_last_operate
=
state
.
operateStack
[
0
];
// 上一次的操作和最新一次操作uuid不同,表示发生了不同视图的操作
// 需要记录当前视图的原始数据
if
(
_last_operate
.
uuid
!==
_v
iew
.
uuid
)
{
state
.
operateStack
.
unshift
(
_
.
cloneDeep
(
_v
iew
));
if
(
_last_operate
.
uuid
!==
oldV
iew
.
uuid
)
{
state
.
operateStack
.
unshift
(
_
.
cloneDeep
(
oldV
iew
));
}
}
else
{
// 如果操作栈中是空的,说明从来没有操作
// 则在开始插入数据的时候,额外插入一条最原始的数据
state
.
operateStack
.
unshift
(
_
.
cloneDeep
(
_v
iew
));
state
.
operateStack
.
unshift
(
_
.
cloneDeep
(
oldV
iew
));
}
state
.
stackIndex
=
0
;
// 开始编辑的时候,重置操作栈的下标
_view
=
_
.
merge
(
_v
iew
,
view
);
let
newView
=
_
.
merge
(
oldV
iew
,
view
);
// 在操作栈中插入最新值
state
.
operateStack
.
unshift
(
_
.
cloneDeep
(
_
.
assign
({
uuid
:
_v
iew
.
uuid
},
view
)));
state
.
operateStack
.
unshift
(
_
.
cloneDeep
(
_
.
assign
({
uuid
:
newV
iew
.
uuid
},
view
)));
// 操作栈最大200
if
(
state
.
operateStack
.
length
>
200
)
{
state
.
operateStack
.
pop
();
...
...
@@ -128,7 +128,36 @@ export const projectStore = {
// 将数据更新至当前选中的节点上
_
.
forIn
(
view
,
(
value
,
key
)
=>
{
Vue
.
set
(
state
.
activeComponent
,
key
,
_view
[
key
]);
if
(
key
===
'properties'
)
{
// horizonCenter和left\right
// verticalCenter和top\bottom
// 互斥,只要修改了一项,则把互斥项置空
if
(
value
.
horizonCenter
)
{
delete
newView
.
properties
.
left
;
delete
newView
.
properties
.
right
;
}
if
(
value
.
verticalCenter
)
{
delete
newView
.
properties
.
top
;
delete
newView
.
properties
.
bottom
;
}
if
(
value
.
left
||
value
.
right
)
{
delete
newView
.
properties
.
horizonCenter
;
}
if
(
value
.
top
||
value
.
bottom
)
{
delete
newView
.
properties
.
verticalCenter
;
}
// 如果left\right top\bottom组合同时存在
// 则根据数值,计算width height
if
(
newView
.
properties
.
left
&&
newView
.
properties
.
right
)
{
}
if
(
newView
.
properties
.
top
&&
newView
.
properties
.
bottom
)
{
}
}
Vue
.
set
(
state
.
activeComponent
,
key
,
newView
[
key
]);
})
if
(
view
.
type
)
{
...
...
src/themes/light/playground.scss
View file @
5d30bd2e
.zero-playground-body-center
{
position
:
relative
;
width
:
375
px
;
width
:
750
px
;
margin
:
10px
auto
;
height
:
1
00%
;
max-height
:
6
00px
;
height
:
1
200px
;
max-height
:
12
00px
;
background-color
:
transparent
;
box-shadow
:
0
0
10px
rgba
(
0
,
0
,
0
,
0
.4
);
overflow
:
hidden
;
transform
:
scale
(
.5
,
.5
);
transform-origin
:
50%
0%
;
}
.zero-playground-draw-panel
{
height
:
6
00px
;
height
:
12
00px
;
background
:
url(data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAiUlEQVQ4jZ1TSxLFIAhLOp7C+19NjyFvlQ7lUUvLRgXzgVGOMQyb6L3/5cwMJAEAxw6sy3FP8tw/EkhJqp7klQMBtKpWcpC1oVp7IoiqviXg4xBFRPL7EM/6WsviYDxwzrkVaBHsz5U4MlWfKxHEySpXIdk6qLRzcXBHVnKQfZRKCy1Ty979XfwApOBe0rB0KiIAAAAASUVORK5CYII=)
;
background-repeat
:
repeat
;
overflow-y
:
auto
;
...
...
@@ -18,8 +20,8 @@
.zero-draw-panel-container
{
position
:
relative
;
// border: 5px #000 solid;
width
:
375px
;
// 谨慎修改,要和drawPanel宽度保持一致
min-height
:
6
00px
;
width
:
100%
;
// 谨慎修改,要和drawPanel宽度保持一致
min-height
:
12
00px
;
}
.zero-draw-panel-container.scroll
{
height
:
1200px
;
...
...
src/utils/common.js
View file @
5d30bd2e
...
...
@@ -166,16 +166,10 @@ function completeSelfProps(component) {
// 根据组件类型,获取默认属性
let
defaultProps
=
getCmpProps
(
component
.
type
);
// omit从defaultProps中过滤出组件properties中没有的属性,格式参考properties.js
defaultProps
=
_
.
omit
(
defaultProps
,
_
.
keys
(
component
.
properties
));
// 再把这些属性格式转换成key: value
// 把这些属性格式转换成key: value
defaultProps
=
_
.
mapValues
(
defaultProps
,
o
=>
(
o
.
value
));
// 将组件properties中的属性和默认属性拼装成组件自身的属性
return
{
...
component
.
properties
,
...
defaultProps
}
return
_
.
merge
(
defaultProps
,
component
.
properties
);
}
export
const
styles
=
{
...
...
@@ -244,9 +238,10 @@ export const styles = {
// 根据uuid获取节点的所有父节点
let
propsMatrix
=
getParentCmps
(
component
.
uuid
,
componentList
);
propsMatrix
=
propsMatrix
.
map
(
completeSelfProps
);
// console.log('propsMatrix', propsMatrix);
if
(
propsMatrix
.
length
)
{
propsMatrix
.
forEach
(
prop
=>
{
// 继承每个父节点的属性
inheritProps
(
cmpSelfProps
,
prop
);
});
}
...
...
src/utils/properties.js
View file @
5d30bd2e
...
...
@@ -8,13 +8,13 @@ export default {
type
:
'inputNumber'
,
value
:
undefined
,
},
top
:
{
title
:
'
上
边距'
,
right
:
{
title
:
'
右
边距'
,
type
:
'inputNumber'
,
value
:
undefined
,
},
right
:
{
title
:
'
右
边距'
,
top
:
{
title
:
'
上
边距'
,
type
:
'inputNumber'
,
value
:
undefined
,
},
...
...
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