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
ede73eec
Commit
ede73eec
authored
May 26, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'percent-input' into dev
parents
9c8bb573
ba4b3b75
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
83 additions
and
25 deletions
+83
-25
PropsEditor.vue
src/components/PropsEditor.vue
+11
-12
NumberInput.vue
src/components/inputs/NumberInput.vue
+38
-7
project.js
src/store/modules/project.js
+1
-1
template.js
src/template.js
+2
-0
behavior.scss
src/themes/light/behavior.scss
+8
-0
properties.js
src/utils/properties.js
+18
-0
viewsTree.vue
src/views/Editor/components/viewsTree.vue
+5
-5
No files found.
src/components/PropsEditor.vue
View file @
ede73eec
...
@@ -15,13 +15,14 @@
...
@@ -15,13 +15,14 @@
@
cmd-prop-change=
"onCmdPropChanged"
@
cmd-prop-change=
"onCmdPropChanged"
>
>
<component
<component
:is=
"getInput(property)"
:is=
"getInput(property)"
:container=
"data"
:container=
"data"
:value=
"data[key]"
:value=
"data[key]"
:propertyName=
"key"
:propertyName=
"key"
:property=
"property"
:property=
"property"
:editable=
"editable"
:editable=
"editable"
@
input=
"onInput"
:config =
"property.input"
@
input=
"onInput"
/>
/>
</component>
</component>
</el-form>
</el-form>
...
@@ -83,9 +84,7 @@
...
@@ -83,9 +84,7 @@
SampleInputWrapper
,
SampleInputWrapper
,
},
},
data
()
{
data
()
{
return
{
return
{}
}
},
},
props
:
{
props
:
{
labelWidth
:
{
labelWidth
:
{
...
@@ -112,7 +111,7 @@
...
@@ -112,7 +111,7 @@
},
},
},
},
watch
:
{
watch
:
{
data
(
v
){
data
(
v
)
{
}
}
},
},
...
@@ -129,7 +128,7 @@
...
@@ -129,7 +128,7 @@
}
}
this
.
$emit
(
'input'
,
value
,
container
,
propName
,
oldValue
);
this
.
$emit
(
'input'
,
value
,
container
,
propName
,
oldValue
);
},
},
onCmdPropChanged
(
value
,
container
,
propName
,
oldValue
){
onCmdPropChanged
(
value
,
container
,
propName
,
oldValue
)
{
this
.
$emit
(
'input'
,
value
,
container
,
propName
,
oldValue
);
this
.
$emit
(
'input'
,
value
,
container
,
propName
,
oldValue
);
},
},
}
}
...
...
src/components/inputs/NumberInput.vue
View file @
ede73eec
<
template
>
<
template
>
<el-input-number
:disabled=
"!editable"
:value=
"editValue"
@
change=
"onInput"
controls-position=
"right"
<div
style=
"flex: 1; display: flex;"
>
:placeholder=
"defaultValue"
></el-input-number>
<el-input-number
:disabled=
"!editable"
:value=
"editValue"
@
change=
"onInput"
controls-position=
"right"
:placeholder=
"defaultValue"
>
</el-input-number>
<span
@
click=
"onClickPercent"
v-if=
"config && config.percent"
style=
"position: absolute; right: 42px; cursor: pointer"
:class=
"
{'percent-on': isPercent, 'percent-off': !isPercent}">%
</span>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
...
@@ -11,21 +16,47 @@
...
@@ -11,21 +16,47 @@
export
default
{
export
default
{
name
:
"NumberInput"
,
name
:
"NumberInput"
,
components
:
{
LinkableInputWrapper
,
CmdInputWrapper
},
components
:
{
LinkableInputWrapper
,
CmdInputWrapper
},
props
:
[
'value'
,
'container'
,
'property'
,
'propertyName'
,
'editable'
],
props
:
[
'value'
,
'container'
,
'property'
,
'propertyName'
,
'editable'
,
'config'
],
data
()
{
return
{
isPercent
:
false
,
}
},
computed
:
{
computed
:
{
editValue
()
{
editValue
()
{
return
this
.
value
===
undefined
?
this
.
property
.
default
:
this
.
value
;
let
v
=
this
.
value
;
if
(
v
===
undefined
)
{
this
.
isPercent
=
false
;
return
this
.
property
.
default
;
}
else
{
this
.
isPercent
=
typeof
v
===
'string'
;
if
(
typeof
v
===
'string'
){
v
=
parseInt
(
v
);
}
return
v
;
}
},
},
defaultValue
(){
defaultValue
()
{
return
getInputDefaultValue
(
this
.
property
);
return
getInputDefaultValue
(
this
.
property
);
},
},
},
},
methods
:
{
methods
:
{
onInput
(
v
)
{
onInput
(
v
)
{
if
(
v
!==
this
.
value
)
{
if
(
v
!==
this
.
value
)
{
this
.
$emit
(
'input'
,
v
,
this
.
container
,
this
.
propertyName
,
this
.
value
);
this
.
$emit
(
'input'
,
v
,
this
.
container
,
this
.
propertyName
,
this
.
value
);
}
}
}
},
onClickPercent
()
{
if
(
this
.
isPercent
){
//设置非百分比
this
.
onInput
(
parseInt
(
this
.
value
))
}
else
{
//设置成百分比
if
(
!
this
.
value
&&
this
.
value
!==
0
){
this
.
onInput
(
undefined
)
}
else
{
this
.
onInput
(
this
.
value
+
'%'
)
}
}
},
},
},
}
}
</
script
>
</
script
>
...
...
src/store/modules/project.js
View file @
ede73eec
...
@@ -899,7 +899,7 @@ export const projectStore = {
...
@@ -899,7 +899,7 @@ export const projectStore = {
})
})
},
},
async
importPsd
({
commit
},
{
file
,
action
})
{
async
importPsd
({
commit
},
{
file
,
action
})
{
const
result
=
await
toZeroing
(
file
);
const
result
=
await
toZeroing
(
file
,
{
offset
:
{
y
:
172
}}
);
let
viewFile
=
new
File
([
result
],
'view.json'
);
let
viewFile
=
new
File
([
result
],
'view.json'
);
const
{
view
,
assets
}
=
await
editorApi
.
uploadView
(
viewFile
);
const
{
view
,
assets
}
=
await
editorApi
.
uploadView
(
viewFile
);
switch
(
action
)
{
switch
(
action
)
{
...
...
src/template.js
View file @
ede73eec
...
@@ -27,6 +27,8 @@ export const template =
...
@@ -27,6 +27,8 @@ export const template =
overflow: hidden;
overflow: hidden;
position: absolute;
position: absolute;
background-color: white;
background-color: white;
-webkit-touch-callout: none;
}
}
.game-container{
.game-container{
width: 100%;
width: 100%;
...
...
src/themes/light/behavior.scss
View file @
ede73eec
...
@@ -501,6 +501,14 @@ $dock-pin-width: 9px;
...
@@ -501,6 +501,14 @@ $dock-pin-width: 9px;
.node-select-container
{
.node-select-container
{
flex
:
1
;
flex
:
1
;
}
}
.percent-on
{
color
:
$--color-primary
;
}
.percent-off
{
color
:
$--color-text-placeholder
;
}
}
}
.source-input-popover
{
.source-input-popover
{
...
...
src/utils/properties.js
View file @
ede73eec
...
@@ -22,26 +22,44 @@ export default {
...
@@ -22,26 +22,44 @@ export default {
width
:
{
width
:
{
alias
:
'宽度'
,
alias
:
'宽度'
,
type
:
'number'
,
type
:
'number'
,
input
:
{
percent
:
true
,
},
},
},
height
:
{
height
:
{
alias
:
'高度'
,
alias
:
'高度'
,
type
:
'number'
,
type
:
'number'
,
input
:
{
percent
:
true
,
},
},
},
left
:
{
left
:
{
alias
:
'左边距'
,
alias
:
'左边距'
,
type
:
'number'
,
type
:
'number'
,
input
:
{
percent
:
true
,
},
},
},
right
:
{
right
:
{
alias
:
'右边距'
,
alias
:
'右边距'
,
type
:
'number'
,
type
:
'number'
,
input
:
{
percent
:
true
,
},
},
},
top
:
{
top
:
{
alias
:
'上边距'
,
alias
:
'上边距'
,
type
:
'number'
,
type
:
'number'
,
input
:
{
percent
:
true
,
},
},
},
bottom
:
{
bottom
:
{
alias
:
'下边距'
,
alias
:
'下边距'
,
type
:
'number'
,
type
:
'number'
,
input
:
{
percent
:
true
,
},
},
},
horizonCenter
:
{
horizonCenter
:
{
alias
:
'水平居中偏移'
,
alias
:
'水平居中偏移'
,
...
...
src/views/Editor/components/viewsTree.vue
View file @
ede73eec
...
@@ -54,14 +54,14 @@ export default {
...
@@ -54,14 +54,14 @@ export default {
return
styles
.
getComponentStyle
(
this
.
activeComponentCopy
,
this
.
project
,
this
.
componentList
,
true
);
return
styles
.
getComponentStyle
(
this
.
activeComponentCopy
,
this
.
project
,
this
.
componentList
,
true
);
},
},
position
()
{
position
()
{
let
_props
=
this
.
activeComponentCopy
.
properties
||
{};
let
{
x
,
y
,
width
,
height
}
=
this
.
activeComponentCopy
.
properties
||
{};
const
props
=
properties
.
node
.
props
;
const
props
=
properties
.
node
.
props
;
// console.log('********', _props);
// console.log('********', _props);
let
result
=
{
let
result
=
{
x
:
_props
.
x
||
props
.
x
.
default
,
x
:
x
||
props
.
x
.
default
,
y
:
_props
.
y
||
props
.
y
.
default
,
y
:
y
||
props
.
y
.
default
,
w
:
_props
.
width
||
props
.
width
.
default
,
w
:
width
?
(
typeof
width
===
'string'
?
parseInt
(
width
)
:
width
)
:
props
.
width
.
default
,
h
:
_props
.
height
||
props
.
height
.
default
,
h
:
height
?
(
typeof
height
===
'string'
?
parseInt
(
height
)
:
height
)
:
props
.
height
.
default
,
};
};
// console.log('####position', result);
// console.log('####position', result);
...
...
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