Fix canvas control buttons being unusable on mobile
This commit is contained in:
parent
0882eb1dd0
commit
b54402fc19
|
|
@ -150,24 +150,26 @@ dark:border-dark-purple
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const dragHandler = useDrag(({ event: Event, delta: [x, y] }: { event: Event, delta: number[] }) => {
|
const pinchHandler = usePinch(({ event, offset: [z] }: { event: Event, offset: number[] }) => {
|
||||||
event?.preventDefault();
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
zoom.value = clamp(z / 2048, minZoom.value, 3);
|
||||||
|
}, {
|
||||||
|
domTarget: canvas,
|
||||||
|
eventOptions: { passive: false, }
|
||||||
|
})
|
||||||
|
const dragHandler = useDrag(({ event, delta: [x, y] }: { event: Event, delta: number[] }) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
dispX.value += x / zoom.value;
|
dispX.value += x / zoom.value;
|
||||||
dispY.value += y / zoom.value;
|
dispY.value += y / zoom.value;
|
||||||
}, {
|
}, {
|
||||||
domTarget: canvas,
|
domTarget: canvas,
|
||||||
eventOptions: { passive: false, }
|
eventOptions: { passive: false, }
|
||||||
})
|
})
|
||||||
const pinchHandler = usePinch(({ event: Event, offset: [z] }: { event: Event, offset: number[] }) => {
|
const wheelHandler = useWheel(({ event, delta: [x, y] }: { event: Event, delta: number[] }) => {
|
||||||
event?.preventDefault();
|
event.stopPropagation();
|
||||||
console.log(z);
|
event.preventDefault();
|
||||||
zoom.value = clamp(z / 2048, minZoom.value, 3);
|
|
||||||
}, {
|
|
||||||
domTarget: canvas,
|
|
||||||
eventOptions: { passive: false, }
|
|
||||||
})
|
|
||||||
const wheelHandler = useWheel(({ event: Event, delta: [x, y] }: { event: Event, delta: number[] }) => {
|
|
||||||
event?.preventDefault();
|
|
||||||
zoom.value = clamp(zoom.value + y * -0.001, minZoom.value, 3);
|
zoom.value = clamp(zoom.value + y * -0.001, minZoom.value, 3);
|
||||||
}, {
|
}, {
|
||||||
domTarget: canvas,
|
domTarget: canvas,
|
||||||
|
|
@ -180,7 +182,7 @@ const wheelHandler = useWheel(({ event: Event, delta: [x, y] }: { event: Event,
|
||||||
<template #default>
|
<template #default>
|
||||||
<div id="canvas" ref="canvas" class="absolute top-0 left-0 overflow-hidden w-full h-full touch-none"
|
<div id="canvas" ref="canvas" class="absolute top-0 left-0 overflow-hidden w-full h-full touch-none"
|
||||||
:style="{ '--zoom-multiplier': (1 / Math.pow(zoom, 0.7)) }">
|
:style="{ '--zoom-multiplier': (1 / Math.pow(zoom, 0.7)) }">
|
||||||
<div class="border border-light-35 dark:border-dark-35 bg-light-10 dark:bg-dark-10 absolute sm:top-2 top-10 left-2 z-30 overflow-hidden">
|
<div class="border border-light-35 dark:border-dark-35 bg-light-10 dark:bg-dark-10 absolute sm:top-2 top-10 left-2 z-[35] overflow-hidden">
|
||||||
<Tooltip message="Zoom avant" side="right">
|
<Tooltip message="Zoom avant" side="right">
|
||||||
<div @click="zoom = clamp(zoom * 1.1, minZoom, 3)" class="w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer">
|
<div @click="zoom = clamp(zoom * 1.1, minZoom, 3)" class="w-8 h-8 flex justify-center items-center p-2 hover:bg-light-30 dark:hover:bg-dark-30 cursor-pointer">
|
||||||
<Icon icon="radix-icons:plus" />
|
<Icon icon="radix-icons:plus" />
|
||||||
|
|
|
||||||
BIN
db.sqlite-wal
BIN
db.sqlite-wal
Binary file not shown.
|
|
@ -57,7 +57,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Icon } from '@iconify/vue/dist/iconify.js';
|
import { Icon } from '@iconify/vue/dist/iconify.js';
|
||||||
|
|
||||||
const open = ref(true);
|
const open = ref(false);
|
||||||
const { loggedIn } = useUserSession();
|
const { loggedIn } = useUserSession();
|
||||||
|
|
||||||
const { data: pages } = await useLazyFetch('/api/navigation', {
|
const { data: pages } = await useLazyFetch('/api/navigation', {
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="my-4 flex-1 w-full max-h-full flex">
|
<div class="my-4 flex-1 w-full max-h-full flex">
|
||||||
<template v-if="page.type === 'markdown'">
|
<template v-if="page.type === 'markdown'">
|
||||||
<SplitterGroup direction="horizontal" class="flex-1 w-full flex">
|
<SplitterGroup direction="horizontal" class="flex-1 w-full flex" >
|
||||||
<SplitterPanel asChild collapsible :collapsedSize="0" :minSize="20" v-slot="{ isCollapsed }">
|
<SplitterPanel asChild collapsible :collapsedSize="0" :minSize="20" v-slot="{ isCollapsed }" :defaultSize="50">
|
||||||
<textarea v-model="page.content" class="flex-1 bg-transparent appearance-none outline-none max-h-full resize-none !overflow-y-auto" :class="{ 'hidden': isCollapsed }"></textarea>
|
<textarea v-model="page.content" class="flex-1 bg-transparent appearance-none outline-none max-h-full resize-none !overflow-y-auto" :class="{ 'hidden': isCollapsed }"></textarea>
|
||||||
</SplitterPanel>
|
</SplitterPanel>
|
||||||
<SplitterResizeHandle class="bg-light-35 dark:bg-dark-35 w-px xl!mx-4 mx-2" />
|
<SplitterResizeHandle class="bg-light-35 dark:bg-dark-35 w-px xl!mx-4 mx-2" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue