Commit 7a728788 by 朱哲铨

定版

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