add text
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
e9512d2529
commit
8cf01c14dd
|
@ -27,6 +27,7 @@ const {
|
||||||
marginLeftMargin,
|
marginLeftMargin,
|
||||||
imageWidth,
|
imageWidth,
|
||||||
imageHeight,
|
imageHeight,
|
||||||
|
textPropisi,
|
||||||
} = storeToRefs(store);
|
} = storeToRefs(store);
|
||||||
|
|
||||||
const typeSelector = ref('rus');
|
const typeSelector = ref('rus');
|
||||||
|
@ -77,12 +78,16 @@ const savePng = async () => {
|
||||||
<Input v-model="marginLeftMargin" :min="1">Отступ слева, мм</Input>
|
<Input v-model="marginLeftMargin" :min="1">Отступ слева, мм</Input>
|
||||||
</div>
|
</div>
|
||||||
</SidebarBlock>
|
</SidebarBlock>
|
||||||
|
|
||||||
|
<SidebarBlock title="Текст">
|
||||||
|
<textarea v-model="textPropisi"></textarea>
|
||||||
|
</SidebarBlock>
|
||||||
</div>
|
</div>
|
||||||
</Sidebar>
|
</Sidebar>
|
||||||
<Page>
|
<Page>
|
||||||
<div id="typeSelector">
|
<div id="typeSelector">
|
||||||
<Button :size="ButtonSize.Small"
|
<Button :size="ButtonSize.Small"
|
||||||
:active="typeSelector == 'rus' && vRotation == 65 && vMargin == 3 && hMargin == 8 && hMargin2 == 4 && imageWidth == 148 && imageHeight == 210 && marginEnable == true"
|
:active="typeSelector == 'rus' && vRotation == 65 && vMargin == 3 && hMargin == 8 && hMargin2 == 4 && imageWidth == 148 && imageHeight == 210 && marginEnable == true && marginLeftMargin == 20"
|
||||||
:click="() => {
|
:click="() => {
|
||||||
typeSelector = 'rus';
|
typeSelector = 'rus';
|
||||||
vRotation = 65;
|
vRotation = 65;
|
||||||
|
@ -92,6 +97,7 @@ const savePng = async () => {
|
||||||
imageWidth = 148;
|
imageWidth = 148;
|
||||||
imageHeight = 210;
|
imageHeight = 210;
|
||||||
marginEnable = true;
|
marginEnable = true;
|
||||||
|
marginLeftMargin = 20;
|
||||||
}">Тетрадь в линию</Button>
|
}">Тетрадь в линию</Button>
|
||||||
<Button :size="ButtonSize.Small"
|
<Button :size="ButtonSize.Small"
|
||||||
:active="typeSelector == 'rus' && vRotation == 90 && vMargin == 30 && hMargin == 30 && hMargin2 == 30 && imageWidth == 210 && imageHeight == 297"
|
:active="typeSelector == 'rus' && vRotation == 90 && vMargin == 30 && hMargin == 30 && hMargin2 == 30 && imageWidth == 210 && imageHeight == 297"
|
||||||
|
|
|
@ -20,6 +20,8 @@ const {
|
||||||
|
|
||||||
imageHeight,
|
imageHeight,
|
||||||
imageWidth,
|
imageWidth,
|
||||||
|
|
||||||
|
textPropisi,
|
||||||
} = storeToRefs(store);
|
} = storeToRefs(store);
|
||||||
|
|
||||||
const ctx = ref<null | CanvasRenderingContext2D>(null);
|
const ctx = ref<null | CanvasRenderingContext2D>(null);
|
||||||
|
@ -94,9 +96,14 @@ const render = () => {
|
||||||
ctx.value.stroke();
|
ctx.value.stroke();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ctx.value.font = hMargins[1] * 3 * ONE_MM + "px propisi"; // todo хз почему тут x3
|
ctx.value.font = hMargins[1] * 3 * ONE_MM + "px propisi"; // todo хз почему тут x3
|
||||||
// ctx.value.fillStyle = "#cccccc";
|
ctx.value.fillStyle = "#cccccc";
|
||||||
// ctx.value.fillText("Привет мир", 100, (hMargins[0] + hMargins[1]) * ONE_MM);
|
let lines = textPropisi.value.split('\n')
|
||||||
|
i = 0;
|
||||||
|
while (i < lines.length) {
|
||||||
|
ctx.value.fillText(lines[i], (marginLeftMargin.value + 10) * ONE_MM, (hMargins[0] + hMargins[1]) * ONE_MM + (hMargins[0] + hMargins[1]) * ONE_MM * i);
|
||||||
|
i++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,8 @@ export const useStore = defineStore("store", () => {
|
||||||
imageWidth.value = tmp;
|
imageWidth.value = tmp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const textPropisi = ref("Текст...");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
imageBackgroundColor,
|
imageBackgroundColor,
|
||||||
|
|
||||||
|
@ -57,5 +59,7 @@ export const useStore = defineStore("store", () => {
|
||||||
imageHeight,
|
imageHeight,
|
||||||
setImageSize,
|
setImageSize,
|
||||||
rotateImage,
|
rotateImage,
|
||||||
|
|
||||||
|
textPropisi,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue