Revert "Update packages. Add quadtree (still need update for ID handling instead of index)."

This reverts commit 685bd47fc4.
This commit is contained in:
2025-01-28 10:27:34 +01:00
parent 685bd47fc4
commit 3f04bb3d0c
9 changed files with 22 additions and 3132 deletions

View File

@@ -1,12 +1,10 @@
<script lang="ts">
import type { Position } from '#shared/canvas.util';
import { Quadtree } from '#shared/physics.util';
import type CanvasNodeEditor from './canvas/CanvasNodeEditor.vue';
import type CanvasEdgeEditor from './canvas/CanvasEdgeEditor.vue';
export type Element = { type: 'node' | 'edge', id: string };
interface ActionMap
{
interface ActionMap {
remove: CanvasNode | CanvasEdge | undefined;
create: CanvasNode | CanvasEdge | undefined;
property: CanvasNode | CanvasEdge;
@@ -66,22 +64,6 @@ import { clamp } from '#shared/general.utils';
import type { CanvasContent, CanvasEdge, CanvasNode } from '~/types/canvas';
const canvas = defineModel<CanvasContent>({ required: true, });
const props = defineProps<{
path: string
}>();
const quadtree = new Quadtree({ x1: -10240, x2: 10240, y1: -10240, y2: 10240 }, canvas, 12, 6);
watch(props, () => {
quadtree.clear();
if(!canvas.value.nodes)
return;
for(const node of canvas.value.nodes)
{
quadtree.insert(node.id, { x1: node.x, x2: node.x + node.width, y1: node.y, y2: node.y + node.height });
}
}, { immediate: true, });
const dispX = ref(0), dispY = ref(0), minZoom = ref(0.1), zoom = ref(0.5);
const focusing = ref<Element>(), editing = ref<Element>();

View File

@@ -1,30 +1,3 @@
<template>
<span class="text-accent-blue inline-flex items-center" :class="class">
<HoverCard class="max-w-[600px] max-h-[600px] w-full overflow-auto z-[45]" :class="{'overflow-hidden !p-0': overview?.type === 'canvas'}" :disabled="!overview">
<template #content>
<Markdown v-if="overview?.type === 'markdown'" class="!px-6" :path="pathname" :filter="hash.substring(1)" popover />
<template v-else-if="overview?.type === 'canvas'"><div class="w-[600px] h-[600px] relative"><Canvas :path="pathname" /></div></template>
</template>
<span>
<slot v-bind="$attrs"></slot>
<Icon class="w-4 h-4 inline-block" v-if="overview && overview.type !== 'markdown'" :icon="iconByType[overview.type]" />
</span>
</HoverCard>
</span>
</template>
<script setup lang="ts">
import { parseURL } from 'ufo';
import { Icon } from '@iconify/vue/dist/iconify.js';
import { iconByType } from '#shared/general.utils';
const { href } = defineProps<{
href: string
class?: string
}>();
const { hash, pathname } = parseURL(href);
const { content } = useContent();
const overview = computed(() => content.value.find(e => e.path === pathname));
</script>
<span class="text-accent-blue inline-flex items-center cursor-pointer hover:text-opacity-85"><slot v-bind="$attrs"></slot></span>
</template>