diff --git a/src/lib/Canvas.svelte b/src/lib/Canvas.svelte new file mode 100644 index 0000000..2b9b668 --- /dev/null +++ b/src/lib/Canvas.svelte @@ -0,0 +1,89 @@ + + + + + { + const { clientX, clientY } = e.touches[0] + handleStart({ + offsetX: clientX - l, + offsetY: clientY - t + }) + }} + on:mouseup={handleEnd} + on:touchend={handleEnd} + on:mouseleave={handleEnd} + on:mousemove={handleMove} + on:touchmove={e => { + const { clientX, clientY } = e.touches[0] + handleMove({ + offsetX: clientX - l, + offsetY: clientY - t + }) + }} + /> diff --git a/src/lib/CanvasApp.svelte b/src/lib/CanvasApp.svelte new file mode 100644 index 0000000..d5c8129 --- /dev/null +++ b/src/lib/CanvasApp.svelte @@ -0,0 +1,53 @@ + + + + + + + + diff --git a/src/lib/NoteDetail.svelte b/src/lib/NoteDetail.svelte index 5eabc58..33da197 100644 --- a/src/lib/NoteDetail.svelte +++ b/src/lib/NoteDetail.svelte @@ -11,8 +11,9 @@ import { isEmptyObject } from '../utils/isEmptyObject'; import Settings from './Settings.svelte'; + import CanvasApp from './CanvasApp.svelte'; - let innerHeight; + // let innerHeight; onMount(async () => { addRxPlugin(RxDBUpdatePlugin); @@ -28,11 +29,15 @@ return data; }); }; + + let innerWidth, innerHeight; - + @@ -42,6 +47,8 @@ {:else if $selectedNote.guid === '00000000-0000-0000-0000-000000000000'} + {:else if $selectedNote.guid === '00000000-0000-0000-0000-111111111111'} + {:else} + import { createEventDispatcher } from 'svelte'; + const dispatch = createEventDispatcher(); + + export let colors = [ + '#d58141', + '#d7c44c', + '#4fa9cc', + '#3f8d27', + ] + + export let paletteColor + export let background = '#fff' + + + + + {#each colors as color} + + + Select the color {color} + + + {/each} + + + { + dispatch('color', { color: background }) + paletteColor = background + }} + style:background> + + Select the background color to clear the canvas + + + + + + + + + + + + diff --git a/src/lib/store.js b/src/lib/store.js index 7b743a0..2f8d1c1 100644 --- a/src/lib/store.js +++ b/src/lib/store.js @@ -73,8 +73,16 @@ Don't forget to follow the project on 𝕏 at @nvAuxApp and let us know what you createdAt: new Date().getTime(), updatedAt: new Date().getTime() }); + await db.notes.insert({ + guid: '00000000-0000-0000-0000-111111111111', + name: 'Sketch Pad Demo', + body: 'Use this demo note to test out the sketch pad feature.', + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() + }); }; + dbPromise = db; return db; };