Commit 7a728788 by 朱哲铨

定版

parent f812aa63
...@@ -14,9 +14,9 @@ export default { ...@@ -14,9 +14,9 @@ export default {
y: 0, y: 0,
w: 0, w: 0,
h: 0, h: 0,
r: 0, r: 0
}
} }
};
}, },
props: { props: {
...@@ -28,91 +28,113 @@ export default { ...@@ -28,91 +28,113 @@ export default {
type: Object, type: Object,
default: () => { default: () => {
} }
}, }
}, },
watch: { watch: {
visible: { visible: {
handler() { handler() {
this.drawerShow = this.visible this.drawerShow = this.visible;
}, },
immediate: true immediate: true
}, },
item: { item: {
handler() { handler() {
if (this.item) { if (this.item) {
this.item.y = (this.item.y - this.item.h / 2) this.item.y = (this.item.y - this.item.h / 2);
this.item.x = (this.item.x - this.item.w / 2) this.item.x = (this.item.x - this.item.w / 2);
console.log(this.item.x, this.item.y, this.item.h) console.log(this.item.x, this.item.y, this.item.h);
let x_mm = Number((this.item.x * 0.84183).toFixed(2)) let setting = this.$dataStore.get("setting");
let w_mm = Number((this.item.w * 0.84183).toFixed(2)) let x_mm, w_mm, h_mm, y_mm;
let h_mm = Number((this.item.h * 0.84183).toFixed(2)) if (setting.unit === "mm") {
let y_mm = Number((this.item.y * 0.84183).toFixed(2)) x_mm = Number((this.item.x * 0.84183).toFixed(2));
w_mm = Number((this.item.w * 0.84183).toFixed(2));
h_mm = Number((this.item.h * 0.84183).toFixed(2));
y_mm = Number((this.item.y * 0.84183).toFixed(2));
} else if (setting.unit === "inch") {
x_mm = (Number((this.item.x * 0.84183) / 25.4).toFixed(2));
w_mm = (Number((this.item.w * 0.84183) / 25.4).toFixed(2));
h_mm = (Number((this.item.h * 0.84183) / 25.4).toFixed(2));
y_mm = (Number((this.item.y * 0.84183) / 25.4).toFixed(2));
}
// return // return
this.form.x = x_mm this.form.x = x_mm;
this.form.rate = this.item.rate this.form.rate = this.item.rate;
this.form.y = y_mm this.form.y = y_mm;
this.form.w = w_mm this.form.w = w_mm;
this.form.h = h_mm this.form.h = h_mm;
this.form.zIndex = this.item.zIndex this.form.zIndex = this.item.zIndex;
// this.form.sx = x_mm // this.form.sx = x_mm
// this.form.sy = y_mm // this.form.sy = y_mm
// this.form.sh = h_mm // this.form.sh = h_mm
// this.form.sw = w_mm // this.form.sw = w_mm
this.form.r = this.item.r this.form.r = this.item.r;
} }
}, },
immediate: true, immediate: true,
deep: true, deep: true
} }
}, },
methods: { methods: {
formChange(t) { formChange(t) {
if (t && t === 'w') { if (t && t === "w") {
this.form.h = this.form.w * this.form.rate this.form.h = this.form.w * this.form.rate;
} }
if (t && t === 'h') { if (t && t === "h") {
this.form.w = this.form.h * this.form.rate this.form.w = this.form.h * this.form.rate;
} }
let f = JSON.parse(JSON.stringify(this.form)) let f = JSON.parse(JSON.stringify(this.form));
f.y = (Number(f.y) + Number(f.h) / 2) f.y = (Number(f.y) + Number(f.h) / 2);
f.x = (Number(f.x) + Number(f.w) / 2) f.x = (Number(f.x) + Number(f.w) / 2);
f.x = Number((f.x / 0.84183).toFixed(2))
f.y = Number((f.y / 0.84183).toFixed(2))
f.w = Number((f.w / 0.84183).toFixed(2))
f.h = Number((f.h / 0.84183).toFixed(2))
f.zIndex = Number((f.zIndex))
this.$emit('change', f) let setting = this.$dataStore.get("setting");
if (setting.unit === "mm") {
f.x = Number((f.x / 0.84183).toFixed(2));
f.y = Number((f.y / 0.84183).toFixed(2));
f.w = Number((f.w / 0.84183).toFixed(2));
f.h = Number((f.h / 0.84183).toFixed(2));
} else if (setting.unit === "inch") {
f.x = (Number((f.x / 0.84183) * 25.4).toFixed(2));
f.y = (Number((f.y / 0.84183) * 25.4).toFixed(2));
f.w = (Number((f.w / 0.84183) * 25.4).toFixed(2));
f.h = (Number((f.h / 0.84183) * 25.4).toFixed(2));
}
f.zIndex = Number((f.zIndex));
for(let k in f){
f[k] = Number(f[k])
}
this.$emit("change", f);
}, },
addValue(f) { addValue(f) {
if (!this.form[f]) this.$set(this.form, f, 0) if (!this.form[f]) this.$set(this.form, f, 0);
let nw = Number(this.form[f]) + 1 let nw = Number(this.form[f]) + 1;
this.$set(this.form, f, nw) this.$set(this.form, f, nw);
if (f && f === 'w') { if (f && f === "w") {
this.form.h = this.form.w * this.form.rate this.form.h = this.form.w * this.form.rate;
} }
if (f && f === 'h') { if (f && f === "h") {
this.form.w = this.form.h * this.form.rate this.form.w = this.form.h * this.form.rate;
} }
this.formChange() this.formChange();
}, },
reduceValue(f) { reduceValue(f) {
if (!this.form[f]) this.$set(this.form, f, 0) if (!this.form[f]) this.$set(this.form, f, 0);
let nw = Number(this.form[f]) - 1 let nw = Number(this.form[f]) - 1;
this.$set(this.form, f, nw) this.$set(this.form, f, nw);
if (f && f === 'w') { if (f && f === "w") {
this.form.h = this.form.w * this.form.rate this.form.h = this.form.w * this.form.rate;
} }
if (f && f === 'h') { if (f && f === "h") {
this.form.w = this.form.h * this.form.rate this.form.w = this.form.h * this.form.rate;
} }
this.formChange() this.formChange();
},
} }
} }
};
</script> </script>
<template> <template>
......
...@@ -21,9 +21,10 @@ export default { ...@@ -21,9 +21,10 @@ export default {
computed: { computed: {
gridWH() { gridWH() {
if (!this.systemSetting || !this.grid || !this.grid[this.systemSetting.gridValue]) return { w: 0, h: 0 }; if (!this.systemSetting || !this.grid || !this.grid[this.systemSetting.gridValue]) return { w: 0, h: 0, v: 1 };
return { return {
w: this.grid[this.systemSetting.gridValue].w, w: this.grid[this.systemSetting.gridValue].w,
v: this.grid[this.systemSetting.gridValue].value,
h: this.grid[this.systemSetting.gridValue].h h: this.grid[this.systemSetting.gridValue].h
}; };
}, },
...@@ -663,7 +664,7 @@ export default { ...@@ -663,7 +664,7 @@ export default {
<img class="template-img" draggable="false" :src="img" alt=""> <img class="template-img" draggable="false" :src="img" alt="">
</div> </div>
<print-dialog :imgList="imgList" :byPlatenSize="systemSetting.gridValue" /> <print-dialog :imgList="imgList" :byPlatenSize="gridWH.v" />
</div> </div>
</div> </div>
<img-setting @ev="ev" @change="formChange" :item="returnItem" @close="close" <img-setting @ev="ev" @change="formChange" :item="returnItem" @close="close"
......
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