Commit ba4b3b75 authored by rockyl's avatar rockyl

修复

parent c0992a69
......@@ -21,6 +21,7 @@
:propertyName="key"
:property="property"
:editable="editable"
:config ="property.input"
@input="onInput"
/>
</component>
......@@ -83,9 +84,7 @@
SampleInputWrapper,
},
data() {
return {
}
return {}
},
props: {
labelWidth: {
......@@ -112,7 +111,7 @@
},
},
watch: {
data(v){
data(v) {
}
},
......@@ -129,7 +128,7 @@
}
this.$emit('input', value, container, propName, oldValue);
},
onCmdPropChanged(value, container, propName, oldValue){
onCmdPropChanged(value, container, propName, oldValue) {
this.$emit('input', value, container, propName, oldValue);
},
}
......
<template>
<div style="flex: 1; display: flex;">
<el-input-number :disabled="!editable" :value="editValue" @change="onInput" controls-position="right"
:placeholder="defaultValue"></el-input-number>
: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>
<script>
......@@ -11,22 +16,48 @@
export default {
name: "NumberInput",
components: {LinkableInputWrapper, CmdInputWrapper},
props: ['value', 'container', 'property', 'propertyName', 'editable'],
props: ['value', 'container', 'property', 'propertyName', 'editable', 'config'],
data() {
return {
isPercent: false,
}
},
computed: {
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);
},
},
methods: {
onInput(v) {
if(v !== this.value){
if (v !== 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>
......
......@@ -899,7 +899,7 @@ export const projectStore = {
})
},
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');
const {view, assets} = await editorApi.uploadView(viewFile);
switch (action) {
......
......@@ -27,6 +27,8 @@ export const template =
overflow: hidden;
position: absolute;
background-color: white;
-webkit-touch-callout: none;
}
.game-container{
width: 100%;
......
......@@ -501,6 +501,14 @@ $dock-pin-width: 9px;
.node-select-container {
flex: 1;
}
.percent-on{
color: $--color-primary;
}
.percent-off{
color: $--color-text-placeholder;
}
}
.source-input-popover {
......
......@@ -22,26 +22,44 @@ export default {
width: {
alias: '宽度',
type: 'number',
input: {
percent: true,
},
},
height: {
alias: '高度',
type: 'number',
input: {
percent: true,
},
},
left: {
alias: '左边距',
type: 'number',
input: {
percent: true,
},
},
right: {
alias: '右边距',
type: 'number',
input: {
percent: true,
},
},
top: {
alias: '上边距',
type: 'number',
input: {
percent: true,
},
},
bottom: {
alias: '下边距',
type: 'number',
input: {
percent: true,
},
},
horizonCenter: {
alias: '水平居中偏移',
......
......@@ -54,14 +54,14 @@ export default {
return styles.getComponentStyle(this.activeComponentCopy, this.project, this.componentList, true);
},
position() {
let _props = this.activeComponentCopy.properties || {};
let {x, y, width, height} = this.activeComponentCopy.properties || {};
const props = properties.node.props;
// console.log('********', _props);
let result = {
x: _props.x || props.x.default,
y: _props.y || props.y.default,
w: _props.width || props.width.default,
h: _props.height || props.height.default,
x: x || props.x.default,
y: y || props.y.default,
w: width ? (typeof width === 'string' ? parseInt(width) : width) : props.width.default,
h: height ? (typeof height === 'string' ? parseInt(height) : height) : props.height.default,
};
// console.log('####position', result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment