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
a12ad020
Commit
a12ad020
authored
Dec 02, 2019
by
张晨辰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: scale bug
parent
ee1fe7b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
15 deletions
+18
-15
index.vue
src/components/customElement/node/index.vue
+1
-0
common.js
src/utils/common.js
+17
-15
No files found.
src/components/customElement/node/index.vue
View file @
a12ad020
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
margin
:
0
;
margin
:
0
;
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
line-height
:
1
;
}
}
}
}
</
style
>
</
style
>
...
...
src/utils/common.js
View file @
a12ad020
...
@@ -66,7 +66,7 @@ const attrShortMapper = {
...
@@ -66,7 +66,7 @@ const attrShortMapper = {
// 编辑时想拖拽组件需要生成的css属性
// 编辑时想拖拽组件需要生成的css属性
// 只需要位置,不需要来源透明度等等
// 只需要位置,不需要来源透明度等等
const
operatProps
=
[
'x'
,
'y'
,
'left'
,
'top'
,
'right'
,
'bottom'
,
'width'
,
'height'
,
'rotation'
];
const
operatProps
=
[
'x'
,
'y'
,
'left'
,
'top'
,
'right'
,
'bottom'
,
'width'
,
'height'
,
'rotation'
,
'scaleX'
,
'scaleY'
];
const
ignoreProps
=
[
'left'
,
'right'
,
'top'
,
'bottom'
];
const
ignoreProps
=
[
'left'
,
'right'
,
'top'
,
'bottom'
];
// 属性单位 对照表, 如果是数值的时候需要添加单位
// 属性单位 对照表, 如果是数值的时候需要添加单位
...
@@ -207,10 +207,10 @@ export const styles = {
...
@@ -207,10 +207,10 @@ export const styles = {
return
[
'transform'
,
[
`rotate(
${
value
}
deg)`
]];
//`transform: rotate(${value}deg);`;
return
[
'transform'
,
[
`rotate(
${
value
}
deg)`
]];
//`transform: rotate(${value}deg);`;
case
'background-image'
:
case
'background-image'
:
return
[
'background-image'
,
[
`url(
${
value
}
)`
]];
//`background-image: url(${value});background-position:center;background-size:contain;`;
return
[
'background-image'
,
[
`url(
${
value
}
)`
]];
//`background-image: url(${value});background-position:center;background-size:contain;`;
//
case 'scale-x':
case
'scale-x'
:
//
return ['transform', [`scaleX(${value})`]]; //`transform: scaleX(${value});`;
return
[
'transform'
,
[
`scaleX(
${
value
}
)`
]];
//`transform: scaleX(${value});`;
//
case 'scale-y':
case
'scale-y'
:
//
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'};`;
default
:
default
:
...
@@ -272,18 +272,20 @@ export const styles = {
...
@@ -272,18 +272,20 @@ export const styles = {
delete
cmpSelfProps
[
key
];
delete
cmpSelfProps
[
key
];
}
}
});
});
// 如果节点的width/height未定义,则设置拖拽组件的width/height为0
// 如果节点的width/height未定义,则设置拖拽组件的width/height为0
cmpSelfProps
.
width
=
cmpSelfProps
.
width
||
0
;
cmpSelfProps
.
width
=
cmpSelfProps
.
width
||
0
;
cmpSelfProps
.
height
=
cmpSelfProps
.
height
||
0
;
cmpSelfProps
.
height
=
cmpSelfProps
.
height
||
0
;
}
if
(
cmpSelfProps
.
scaleX
&&
cmpSelfProps
.
width
)
{
if
(
cmpSelfProps
.
scaleX
&&
cmpSelfProps
.
width
)
{
cmpSelfProps
.
width
*=
cmpSelfProps
.
scaleX
;
cmpSelfProps
.
width
*=
cmpSelfProps
.
scaleX
;
delete
cmpSelfProps
.
scaleX
;
}
}
if
(
cmpSelfProps
.
scaleY
&&
cmpSelfProps
.
height
)
{
if
(
cmpSelfProps
.
scaleY
&&
cmpSelfProps
.
height
)
{
cmpSelfProps
.
height
*=
cmpSelfProps
.
scaleY
;
cmpSelfProps
.
height
*=
cmpSelfProps
.
scaleY
;
delete
cmpSelfProps
.
scaleY
;
}
}
}
// 把不需要参与样式计算的属性干掉
// 把不需要参与样式计算的属性干掉
...
@@ -305,7 +307,7 @@ export const styles = {
...
@@ -305,7 +307,7 @@ export const styles = {
result
+=
'border-style: solid;'
result
+=
'border-style: solid;'
}
}
});
});
result
+=
`background-position: center;background-size: 100% 100%;`
result
+=
`background-position: center;background-size: 100% 100%;
transform-origin: left top;
`
if
(
component
.
type
===
'circle'
&&
!
onlyOpera
)
{
if
(
component
.
type
===
'circle'
&&
!
onlyOpera
)
{
// 如果是circle类型,加圆角
// 如果是circle类型,加圆角
...
...
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