You've already forked obsidian-visualiser
Add Tweening to zoom, fix saving canvas.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { CanvasContent } from '~/types/canvas';
|
||||
import type { FileType } from '~/types/content';
|
||||
import type { ContentMap, FileType } from '~/types/content';
|
||||
|
||||
export function unifySlug(slug: string | string[]): string
|
||||
{
|
||||
@@ -47,7 +47,10 @@ export function clamp(x: number, min: number, max: number): number {
|
||||
return min;
|
||||
return x;
|
||||
}
|
||||
export function convertContent(type: FileType, content: string): CanvasContent | string {
|
||||
export function lerp(a: number, b: number, t: number) {
|
||||
return a + t * (b - a);
|
||||
}
|
||||
export function convertContentFromText(type: FileType, content: string): CanvasContent | string {
|
||||
switch(type)
|
||||
{
|
||||
case 'canvas':
|
||||
@@ -61,6 +64,20 @@ export function convertContent(type: FileType, content: string): CanvasContent |
|
||||
return content;
|
||||
}
|
||||
}
|
||||
export function convertContentToText(type: FileType, content: any): string {
|
||||
switch(type)
|
||||
{
|
||||
case 'canvas':
|
||||
return JSON.stringify(content);
|
||||
case 'map':
|
||||
case 'file':
|
||||
case 'folder':
|
||||
case 'markdown':
|
||||
return content;
|
||||
default:
|
||||
return content;
|
||||
}
|
||||
}
|
||||
|
||||
export const iconByType: Record<FileType, string> = {
|
||||
'folder': 'lucide:folder',
|
||||
|
||||
Reference in New Issue
Block a user