From 1d4b5380af90ef26f7b2681bff21b5c862e661f0 Mon Sep 17 00:00:00 2001 From: Fedorov Vladimir Date: Sun, 24 Sep 2023 15:09:27 +0700 Subject: [PATCH] add type selector --- package.json | 2 +- src/App.vue | 17 ++++++++++++++++- src/components/Button.vue | 7 +++++++ src/components/Canvas.vue | 2 +- src/components/Page.vue | 4 +++- yarn.lock | 8 ++++---- 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index a754609..d5af167 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "html2canvas": "^1.4.1", - "pinia": "^2.1.4", + "pinia": "^2.1.6", "vue": "3.3.4" }, "devDependencies": { diff --git a/src/App.vue b/src/App.vue index e2612aa..21a63dd 100644 --- a/src/App.vue +++ b/src/App.vue @@ -12,6 +12,7 @@ import { ButtonSize, InputType } from "./types"; import { useStore } from "./store"; import { storeToRefs } from "pinia"; import { VARIANTS_VERTICAL_ROTATION, VARIANTS_IMAGE_SIZE } from './const'; +import { ref } from "vue"; const store = useStore(); @@ -28,6 +29,8 @@ const { imageHeight, } = storeToRefs(store); +const typeSelector = ref('rus'); + const savePng = async () => { const canvas = document.getElementById("canvas") as HTMLCanvasElement; @@ -52,7 +55,7 @@ const savePng = async () => { Отступ, мм Поворот, градусы - @@ -74,6 +77,12 @@ const savePng = async () => { +
+ + +
@@ -85,6 +94,7 @@ const savePng = async () => { v-for="size in VARIANTS_IMAGE_SIZE" :key="size.name" :size="ButtonSize.Small" + :active="imageWidth == size.width && imageHeight == size.height || imageWidth == size.height && imageHeight == size.width" :click="() => store.setImageSize(size)" > {{ size.name }} @@ -102,4 +112,9 @@ const savePng = async () => { diff --git a/src/components/Button.vue b/src/components/Button.vue index 3bbe0a6..0582b9b 100644 --- a/src/components/Button.vue +++ b/src/components/Button.vue @@ -4,10 +4,12 @@ import { ButtonSize } from '../types'; interface Props { click: (payload?: MouseEvent) => void; size?: ButtonSize; + active: boolean; } withDefaults(defineProps(), { size: ButtonSize.Medium, + active: false, }) @@ -16,6 +18,7 @@ withDefaults(defineProps(), { :class="{ button: true, 'button--small': size === ButtonSize.Small, + 'active': active === true, }" @click="click" > @@ -45,4 +48,8 @@ withDefaults(defineProps(), { font-size: 10pt; width: auto; } + +.active { + background-color: #ffce99; +} diff --git a/src/components/Canvas.vue b/src/components/Canvas.vue index a813a22..77d6310 100644 --- a/src/components/Canvas.vue +++ b/src/components/Canvas.vue @@ -119,6 +119,6 @@ watch(store, () => { canvas { border: 1px solid black; margin: 20px; - height: calc(100vh - 40px); + height: calc(100vh - 100px); } diff --git a/src/components/Page.vue b/src/components/Page.vue index d258a14..82c4ab8 100644 --- a/src/components/Page.vue +++ b/src/components/Page.vue @@ -2,7 +2,9 @@