From 3531342d55992cfb50946781ed8ee8dcf74c4df5 Mon Sep 17 00:00:00 2001 From: TSKsmiley Date: Wed, 8 Nov 2023 10:22:39 +0100 Subject: [PATCH 1/7] Refactor SVG components and helper functions --- src/lib/components/svg-view/Component.svelte | 40 +++++++++++++++++++ src/lib/components/svg-view/Label.svelte | 2 +- src/lib/components/svg-view/Node.svelte | 2 +- src/lib/components/svg-view/SvgView.svelte | 3 ++ .../{ => helpers}/DraggableSVG.svelte | 0 5 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 src/lib/components/svg-view/Component.svelte rename src/lib/components/svg-view/{ => helpers}/DraggableSVG.svelte (100%) diff --git a/src/lib/components/svg-view/Component.svelte b/src/lib/components/svg-view/Component.svelte new file mode 100644 index 00000000..e1b56ccf --- /dev/null +++ b/src/lib/components/svg-view/Component.svelte @@ -0,0 +1,40 @@ + + + + + + + hello + + + + diff --git a/src/lib/components/svg-view/Label.svelte b/src/lib/components/svg-view/Label.svelte index de44dea7..1398c423 100644 --- a/src/lib/components/svg-view/Label.svelte +++ b/src/lib/components/svg-view/Label.svelte @@ -1,5 +1,5 @@ diff --git a/src/lib/components/svg-view/SvgView.svelte b/src/lib/components/svg-view/SvgView.svelte index 8a65b116..f0b906df 100644 --- a/src/lib/components/svg-view/SvgView.svelte +++ b/src/lib/components/svg-view/SvgView.svelte @@ -3,6 +3,14 @@ type CurrentValues, type PanzoomChangeEvent, } from "./panzoom/panzoom"; + + import { onMount } from "svelte"; + import { scale } from "$lib/globalState/scaleStore"; + import { activeView } from "$lib/globalState/activeProject"; + import { Component as automatonComponent } from "$lib/classes/automaton/component/Component"; + import Edge from "./Edge.svelte"; + import Location from "$lib/components/svg-view/Location.svelte"; + import { System } from "$lib/classes/automaton/system/System"; import Component from "./Component.svelte"; /** @@ -64,28 +72,31 @@ style:transform style:transition > - {#if $activeView instanceof Component} + {#if $activeView instanceof automatonComponent} {@const component = $activeView} - - {#each $activeView.edges as edge} - - {/each} - - {#each $activeView.locations as location} - - {/each} + + + {#each $activeView.edges as edge} + + {/each} + + + {#each $activeView.locations as location} + + {/each} + {:else if $activeView instanceof System} TODO: Not implemented yet {/if} From e30d38df22adee63598cdec2a91ce5ce117261fd Mon Sep 17 00:00:00 2001 From: TSKsmiley Date: Mon, 4 Dec 2023 12:54:57 +0100 Subject: [PATCH 4/7] added todo --- src/lib/components/svg-view/Component.svelte | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/components/svg-view/Component.svelte b/src/lib/components/svg-view/Component.svelte index c2d10efc..25d56206 100644 --- a/src/lib/components/svg-view/Component.svelte +++ b/src/lib/components/svg-view/Component.svelte @@ -3,6 +3,8 @@ import DraggableSvg from "./helpers/DraggableSVG.svelte"; export let position: iPoint = { x: 10, y: 10 }; + + // TODO: these should not be hard coded they should scale with the things inside the component let width = 800; let height = 1000; const cutOff = 100; From ea75484a236ae381dd9d8e9d7be4457e2f8489b1 Mon Sep 17 00:00:00 2001 From: TSKsmiley Date: Mon, 4 Dec 2023 12:59:06 +0100 Subject: [PATCH 5/7] lint --- src/lib/interfaces/iComponent.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/interfaces/iComponent.ts b/src/lib/interfaces/iComponent.ts index ceb067e8..5905e23f 100644 --- a/src/lib/interfaces/iComponent.ts +++ b/src/lib/interfaces/iComponent.ts @@ -1,9 +1,9 @@ -import type { iPoint } from './iPoint'; -import type { iEdge } from './iEdge'; -import type { iLocation } from './iLocation'; -import type { iDimensions } from './iDimensions'; +import type { iPoint } from "./iPoint"; +import type { iEdge } from "./iEdge"; +import type { iLocation } from "./iLocation"; +import type { iDimensions } from "./iDimensions"; -export interface iComponent{ +export interface iComponent { name: string; declarations: string; locations: iLocation[]; From 749211101c9050ca6437613bd2fdc939e1027133 Mon Sep 17 00:00:00 2001 From: TSKsmiley Date: Mon, 4 Dec 2023 13:02:15 +0100 Subject: [PATCH 6/7] removed old files --- src/lib/interfaces/iComponent.ts | 16 ---------------- src/lib/interfaces/iDimensions.ts | 4 ---- 2 files changed, 20 deletions(-) delete mode 100644 src/lib/interfaces/iComponent.ts delete mode 100644 src/lib/interfaces/iDimensions.ts diff --git a/src/lib/interfaces/iComponent.ts b/src/lib/interfaces/iComponent.ts deleted file mode 100644 index 5905e23f..00000000 --- a/src/lib/interfaces/iComponent.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { iPoint } from "./iPoint"; -import type { iEdge } from "./iEdge"; -import type { iLocation } from "./iLocation"; -import type { iDimensions } from "./iDimensions"; - -export interface iComponent { - name: string; - declarations: string; - locations: iLocation[]; - edges: iEdge[]; - description: string; - position: iPoint; - dimensions: iDimensions; - color: string; - includeInPeriodicCheck: boolean; -} diff --git a/src/lib/interfaces/iDimensions.ts b/src/lib/interfaces/iDimensions.ts deleted file mode 100644 index 1a88cbf6..00000000 --- a/src/lib/interfaces/iDimensions.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface iDimensions { - width: number; - height: number; -} From a0cbc797902fb6d1bbd0215f6d44f7b0b2d15077 Mon Sep 17 00:00:00 2001 From: TSKsmiley Date: Mon, 4 Dec 2023 15:33:42 +0100 Subject: [PATCH 7/7] fix darkmode --- src/lib/components/startScreen/StartScreen.svelte | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib/components/startScreen/StartScreen.svelte b/src/lib/components/startScreen/StartScreen.svelte index 7306817b..f36c1a51 100644 --- a/src/lib/components/startScreen/StartScreen.svelte +++ b/src/lib/components/startScreen/StartScreen.svelte @@ -31,7 +31,7 @@ click={startNewProject} icon={Add} id={`start-new-project`} - color="var(--sidebar-text-color)" + color="var(--text-color)" justifyContent="center" >

New Blank Project @@ -51,7 +51,7 @@ await projectHandler.openExampleProject( exampleLoader, ); - }}>{exampleName}

{exampleName}

{/each} @@ -64,7 +64,7 @@ }} icon={File_open} id={`open-project`} - color="var(--sidebar-text-color)" + color="var(--text-color)" justifyContent="center" >

Open A Project

@@ -76,7 +76,7 @@ { await projectHandler.openRecentProject( @@ -129,4 +129,8 @@ width: 50%; margin: 5%; } + + p { + color: var(--text-color); + }