-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #628 from tuanchauict/app-ui-state
Link data and shape tool part 1
- Loading branch information
Showing
22 changed files
with
814 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 27 additions & 2 deletions
29
monosketch-svelte/src/lib/ui/nav/mouseaction/MouseActionGroup.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
monosketch-svelte/src/lib/ui/pannel/shapetool/Footer.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!-- | ||
- Copyright (c) 2024, tuanchauict | ||
--> | ||
<script> | ||
</script> | ||
|
||
<div> | ||
<a href="https://github.com/tuanchauict/MonoSketch"> | ||
<svg width="16" height="16" viewBox="0 0 32 32" fill="currentColor"> | ||
<path d="M16.288 0a16.291 16.291 0 0 0-5.148 31.747c.815.149 1.112-.353 1.112-.785 0-.387-.014-1.411-.022-2.771-4.531.985-5.487-2.183-5.487-2.183a4.315 4.315 0 0 0-1.809-2.383c-1.479-1.011.112-.99.112-.99a3.42 3.42 0 0 1 2.495 1.678 3.468 3.468 0 0 0 4.741 1.354 3.482 3.482 0 0 1 1.034-2.178c-3.617-.411-7.42-1.808-7.42-8.051a6.3 6.3 0 0 1 1.677-4.371 5.852 5.852 0 0 1 .16-4.311s1.367-.438 4.479 1.67a15.448 15.448 0 0 1 8.156 0c3.11-2.108 4.475-1.67 4.475-1.67a5.854 5.854 0 0 1 .163 4.311 6.286 6.286 0 0 1 1.674 4.371c0 6.258-3.809 7.635-7.438 8.038a3.889 3.889 0 0 1 1.106 3.017c0 2.178-.02 3.935-.02 4.469 0 .435.294.942 1.12.783A16.292 16.292 0 0 0 16.288 0z"></path> | ||
</svg> | ||
<span>GitHub</span> | ||
</a> | ||
</div> | ||
|
||
<style lang="scss"> | ||
div { | ||
padding: 10px 8px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
a { | ||
line-height: 14px; | ||
font-size: 14px; | ||
text-decoration: none; | ||
color: var(--shapetool-footer-color); | ||
display: flex; | ||
align-items: center; | ||
&:hover { | ||
color: var(--shapetool-footer-hover-color); | ||
} | ||
&:active { | ||
color: var(--shapetool-footer-active-color); | ||
} | ||
span { | ||
margin-left: 6px; | ||
} | ||
} | ||
</style> |
88 changes: 44 additions & 44 deletions
88
monosketch-svelte/src/lib/ui/pannel/shapetool/ShapeTool.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,65 @@ | ||
<script lang="ts"> | ||
import ReorderTool from './reorder/ReorderTool.svelte'; | ||
import TransformTool from './transform/TransformTool.svelte'; | ||
import AppearanceTool from './appearance/AppearanceTool.svelte'; | ||
import TextTool from './text/TextTool.svelte'; | ||
import { getContext, onMount } from 'svelte'; | ||
import { AppContext } from '$app/app-context'; | ||
import { APP_CONTEXT } from '$mono/common/constant'; | ||
import { LifecycleOwner } from 'lib/libs/flow'; | ||
import { getContext, onDestroy, onMount, setContext } from 'svelte'; | ||
import { AppContext } from '$app/app-context'; | ||
import { APP_CONTEXT } from '$mono/common/constant'; | ||
import { Flow, LifecycleOwner } from 'lib/libs/flow'; | ||
import Footer from "./Footer.svelte"; | ||
import ShapeToolBody from "$ui/pannel/shapetool/ShapeToolBody.svelte"; | ||
import { ShapeToolViewModel } from "$ui/pannel/shapetool/viewmodel/shape-tool-viewmodel"; | ||
import { SHAPE_TOOL_VIEWMODEL } from "$ui/pannel/shapetool/constants.js"; | ||
const appContext = getContext<AppContext>(APP_CONTEXT); | ||
const lifecycleOwner = new LifecycleOwner(); | ||
const appContext = getContext<AppContext>(APP_CONTEXT); | ||
const lifecycleOwner = new LifecycleOwner(); | ||
let isVisible = true; | ||
setContext(SHAPE_TOOL_VIEWMODEL, new ShapeToolViewModel( | ||
new Flow(new Set()), // TODO: Replace with real flow | ||
appContext.shapeManager.versionFlow, | ||
appContext.actionManager | ||
)); | ||
onMount(() => { | ||
lifecycleOwner.onStart(); | ||
let isVisible = true; | ||
appContext.appUiStateManager.shapeFormatPanelVisibilityFlow.observe(lifecycleOwner, (value) => { | ||
isVisible = value; | ||
onMount(() => { | ||
lifecycleOwner.onStart(); | ||
appContext.appUiStateManager.shapeFormatPanelVisibilityFlow.observe(lifecycleOwner, (value) => { | ||
isVisible = value; | ||
}); | ||
}); | ||
onDestroy(() => { | ||
lifecycleOwner.onStop(); | ||
}); | ||
}); | ||
</script> | ||
|
||
{#if isVisible} | ||
<div class="container"> | ||
<div class="body"> | ||
<ReorderTool /> | ||
<TransformTool /> | ||
<AppearanceTool /> | ||
<TextTool /> | ||
<ShapeToolBody/> | ||
</div> | ||
<div class="footer">Hello</div> | ||
<Footer/> | ||
</div> | ||
{/if} | ||
|
||
<style lang="scss"> | ||
@import '$style/variables.scss'; | ||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
@import '$style/variables.scss'; | ||
border-left: 1px solid var(--shapetool-main-divider-color); | ||
background: var(--shapetool-bg-color); | ||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
font-family: $uiTextFont; | ||
font-size: 12px; | ||
} | ||
border-left: 1px solid var(--shapetool-main-divider-color); | ||
background: var(--shapetool-bg-color); | ||
.body { | ||
height: 100%; | ||
overflow-y: scroll; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
font-family: $uiTextFont; | ||
font-size: 12px; | ||
} | ||
.footer { | ||
padding: 10px 8px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
.body { | ||
height: 100%; | ||
overflow-y: scroll; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
</style> |
Oops, something went wrong.