@netless/fastboard-ui 1.0.0-canary.3 → 1.0.0-canary.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +860 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +1913 -561
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1913 -561
- package/dist/index.mjs.map +1 -1
- package/dist/index.svelte.mjs +1906 -558
- package/dist/index.svelte.mjs.map +1 -1
- package/package.json +6 -3
- package/src/behaviors/apps.ts +1 -1
- package/src/components/Icons/Eraser.svelte +35 -1
- package/src/components/Icons/EraserFilled.svelte +2 -2
- package/src/components/Icons/PencilEraser.svelte +16 -0
- package/src/components/Icons/PencilEraserFilled.svelte +16 -0
- package/src/components/Icons/index.ts +7 -0
- package/src/components/Toolbar/Toolbar.svelte +2 -0
- package/src/components/Toolbar/Toolbar.svelte.d.ts +8 -0
- package/src/components/Toolbar/components/Contents.scss +11 -0
- package/src/components/Toolbar/components/Contents.svelte +99 -14
- package/src/components/Toolbar/components/PencilEraserSize.svelte +27 -0
- package/src/components/Toolbar/components/constants.ts +17 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/fastboard-ui",
|
|
3
|
-
"version": "1.0.0-canary.
|
|
3
|
+
"version": "1.0.0-canary.6",
|
|
4
4
|
"description": "The front-end of @netless/fastboard-core.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"svelte": "dist/index.svelte.mjs",
|
|
@@ -8,16 +8,19 @@
|
|
|
8
8
|
"src",
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"dist/index.css"
|
|
13
|
+
],
|
|
11
14
|
"repository": "netless-io/fastboard",
|
|
12
15
|
"peerDependencies": {
|
|
13
|
-
"@netless/fastboard-core": "1.0.0-canary.
|
|
16
|
+
"@netless/fastboard-core": "1.0.0-canary.6"
|
|
14
17
|
},
|
|
15
18
|
"dependencies": {
|
|
16
19
|
"tippy.js": "^6.3.7"
|
|
17
20
|
},
|
|
18
21
|
"devDependencies": {
|
|
19
22
|
"@netless/esbuild-plugin-inline-sass": "0.1.0",
|
|
20
|
-
"@netless/fastboard-core": "1.0.0-canary.
|
|
23
|
+
"@netless/fastboard-core": "1.0.0-canary.6"
|
|
21
24
|
},
|
|
22
25
|
"scripts": {
|
|
23
26
|
"cleanup": "rimraf dist",
|
package/src/behaviors/apps.ts
CHANGED
|
@@ -7,10 +7,44 @@
|
|
|
7
7
|
|
|
8
8
|
<svg fill="none" viewBox="0 0 24 24" class="fastboard-icon {theme}" class:is-active={active}>
|
|
9
9
|
<path
|
|
10
|
+
d="M16 16L20 20M20 16L16 20"
|
|
10
11
|
stroke="#5D6066"
|
|
12
|
+
class="fastboard-icon-stroke-color"
|
|
13
|
+
stroke-width="1.25"
|
|
14
|
+
/>
|
|
15
|
+
<path
|
|
16
|
+
d="M13.4139 4.92898C14.195 4.14794 15.4613 4.14794 16.2423 4.92898L19.0708 7.75741C19.8518 8.53846 19.8518 9.80479 19.0708 10.5858L11.9997 17.6569C10.4376 19.219 7.90494 19.219 6.34284 17.6569L4.92863 16.2427C4.14758 15.4616 4.14758 14.1953 4.92863 13.4143L13.4139 4.92898Z"
|
|
17
|
+
stroke="#5D6066"
|
|
18
|
+
class="fastboard-icon-stroke-color"
|
|
19
|
+
stroke-width="1.25"
|
|
11
20
|
stroke-linejoin="round"
|
|
21
|
+
/>
|
|
22
|
+
<path
|
|
23
|
+
d="M12 6.34314L17.6569 12"
|
|
24
|
+
stroke="#5D6066"
|
|
25
|
+
class="fastboard-icon-stroke-color"
|
|
12
26
|
stroke-width="1.25"
|
|
13
|
-
|
|
27
|
+
stroke-linejoin="round"
|
|
28
|
+
/>
|
|
29
|
+
<path
|
|
30
|
+
d="M16.2422 4.92896L13.4138 7.75738"
|
|
31
|
+
stroke="#5D6066"
|
|
14
32
|
class="fastboard-icon-stroke-color"
|
|
33
|
+
stroke-width="1.25"
|
|
34
|
+
stroke-linejoin="round"
|
|
35
|
+
/>
|
|
36
|
+
<path
|
|
37
|
+
d="M17.6572 6.34314L14.8288 9.17157"
|
|
38
|
+
stroke="#5D6066"
|
|
39
|
+
class="fastboard-icon-stroke-color"
|
|
40
|
+
stroke-width="1.25"
|
|
41
|
+
stroke-linejoin="round"
|
|
42
|
+
/>
|
|
43
|
+
<path
|
|
44
|
+
d="M19.0713 7.75732L16.2429 10.5858"
|
|
45
|
+
stroke="#5D6066"
|
|
46
|
+
class="fastboard-icon-stroke-color"
|
|
47
|
+
stroke-width="1.25"
|
|
48
|
+
stroke-linejoin="round"
|
|
15
49
|
/>
|
|
16
50
|
</svg>
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
<svg fill="none" viewBox="0 0 24 24" class="fastboard-icon {theme}" class:is-active={active}>
|
|
9
9
|
<path
|
|
10
|
-
fill="#5D6066"
|
|
11
10
|
fill-rule="evenodd"
|
|
12
|
-
d="M16.242 4.929a2 2 0 0 0-2.828 0L4.93 13.414a2 2 0 0 0 0 2.829l1.414 1.414a4 4 0 0 0 5.657 0l5.215-5.215-5.657-5.657.884-.884 5.657 5.657.972-.972a2 2 0 0 0 0-2.829l-2.83-2.827Z"
|
|
13
11
|
clip-rule="evenodd"
|
|
12
|
+
d="M16.2423 4.92893C15.4612 4.14788 14.1949 4.14788 13.4138 4.92893L4.92856 13.4142C4.14751 14.1953 4.14751 15.4616 4.92856 16.2426L6.34277 17.6568C7.90487 19.2189 10.4375 19.2189 11.9996 17.6568L17.2146 12.4419L11.5577 6.78508L12.4416 5.9012L18.0985 11.558L19.0707 10.5858C19.8517 9.80473 19.8517 8.5384 19.0707 7.75735L16.2423 4.92893ZM17.1161 18L15.5581 16.4419L16.4419 15.5581L18 17.1161L19.5581 15.5581L20.4419 16.4419L18.8839 18L20.4419 19.5581L19.5581 20.4419L18 18.8839L16.4419 20.4419L15.5581 19.5581L17.1161 18Z"
|
|
13
|
+
fill="#3381FF"
|
|
14
14
|
class="fastboard-icon-fill-color"
|
|
15
15
|
/>
|
|
16
16
|
</svg>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Theme } from "../../typings";
|
|
3
|
+
|
|
4
|
+
export let theme: Theme = "light";
|
|
5
|
+
export let active = false;
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<svg fill="none" viewBox="0 0 24 24" class="fastboard-icon {theme}" class:is-active={active}>
|
|
9
|
+
<path
|
|
10
|
+
stroke="#5D6066"
|
|
11
|
+
stroke-linejoin="round"
|
|
12
|
+
stroke-width="1.25"
|
|
13
|
+
d="M13.414 4.929a2 2 0 0 1 2.829 0l2.828 2.828a2 2 0 0 1 0 2.829L12 17.656a4 4 0 0 1-5.657 0L4.93 16.244a2 2 0 0 1 0-2.829l8.485-8.485ZM12 6.343 17.657 12m-1.414-7.071-2.829 2.828m4.243-1.414-2.829 2.829m4.243-1.415-2.828 2.829"
|
|
14
|
+
class="fastboard-icon-stroke-color"
|
|
15
|
+
/>
|
|
16
|
+
</svg>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Theme } from "../../typings";
|
|
3
|
+
|
|
4
|
+
export let theme: Theme = "light";
|
|
5
|
+
export let active = false;
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<svg fill="none" viewBox="0 0 24 24" class="fastboard-icon {theme}" class:is-active={active}>
|
|
9
|
+
<path
|
|
10
|
+
fill="#5D6066"
|
|
11
|
+
fill-rule="evenodd"
|
|
12
|
+
d="M16.242 4.929a2 2 0 0 0-2.828 0L4.93 13.414a2 2 0 0 0 0 2.829l1.414 1.414a4 4 0 0 0 5.657 0l5.215-5.215-5.657-5.657.884-.884 5.657 5.657.972-.972a2 2 0 0 0 0-2.829l-2.83-2.827Z"
|
|
13
|
+
clip-rule="evenodd"
|
|
14
|
+
class="fastboard-icon-fill-color"
|
|
15
|
+
/>
|
|
16
|
+
</svg>
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
1
4
|
import Apps from "./Apps.svelte";
|
|
2
5
|
import Arrow from "./Arrow.svelte";
|
|
3
6
|
import ArrowBolded from "./ArrowBolded.svelte";
|
|
@@ -18,6 +21,8 @@ import LineBolded from "./LineBolded.svelte";
|
|
|
18
21
|
import Minus from "./Minus.svelte";
|
|
19
22
|
import Pencil from "./Pencil.svelte";
|
|
20
23
|
import PencilFilled from "./PencilFilled.svelte";
|
|
24
|
+
import PencilEraser from "./PencilEraser.svelte";
|
|
25
|
+
import PencilEraserFilled from "./PencilEraserFilled.svelte";
|
|
21
26
|
import Plus from "./Plus.svelte";
|
|
22
27
|
import Rectangle from "./Rectangle.svelte";
|
|
23
28
|
import RectangleBolded from "./RectangleBolded.svelte";
|
|
@@ -63,6 +68,8 @@ const Icons = {
|
|
|
63
68
|
Minus,
|
|
64
69
|
Pencil,
|
|
65
70
|
PencilFilled,
|
|
71
|
+
PencilEraser,
|
|
72
|
+
PencilEraserFilled,
|
|
66
73
|
Plus,
|
|
67
74
|
Rectangle,
|
|
68
75
|
RectangleBolded,
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
$: scrollable = $scroll_height + extra_height > $container_height;
|
|
27
27
|
|
|
28
28
|
$: hide_apps = config.apps?.enable === false;
|
|
29
|
+
$: eraser_type = config.eraser?.behavior || "both";
|
|
29
30
|
</script>
|
|
30
31
|
|
|
31
32
|
<div class="{name} {theme}" class:collapsed use:height={container_height}>
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
{computed_height}
|
|
40
41
|
{scrollable}
|
|
41
42
|
{hide_apps}
|
|
43
|
+
{eraser_type}
|
|
42
44
|
/>
|
|
43
45
|
</div>
|
|
44
46
|
<label class="{name}-handler {theme}">
|
|
@@ -6,6 +6,14 @@ export declare interface ToolbarConfig {
|
|
|
6
6
|
apps?: {
|
|
7
7
|
enable?: boolean;
|
|
8
8
|
};
|
|
9
|
+
eraser?: {
|
|
10
|
+
/**
|
|
11
|
+
* - delete: remove shapes under eraser
|
|
12
|
+
* - pencil: wipe out part of strokes under eraser, like a real eraser
|
|
13
|
+
* - both (default): will show a panel to choose different behavior
|
|
14
|
+
*/
|
|
15
|
+
behavior?: "delete" | "pencil" | "both";
|
|
16
|
+
};
|
|
9
17
|
}
|
|
10
18
|
|
|
11
19
|
export declare interface ToolbarProps {
|
|
@@ -72,6 +72,17 @@ $name: "fastboard-toolbar";
|
|
|
72
72
|
background-color: rgba(#fff, 0.15);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
.#{$name}-slider.pencil-eraser-size {
|
|
76
|
+
width: 136px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// .#{$name}-panel-btns {
|
|
80
|
+
// // min-width: 108px;
|
|
81
|
+
|
|
82
|
+
// // .#{$name}-btn {
|
|
83
|
+
// // }
|
|
84
|
+
// }
|
|
85
|
+
|
|
75
86
|
.#{$name}-colors,
|
|
76
87
|
.#{$name}-shapes {
|
|
77
88
|
display: grid;
|
|
@@ -3,22 +3,23 @@
|
|
|
3
3
|
import type { Writable } from "svelte/store";
|
|
4
4
|
import type { Placement } from "tippy.js";
|
|
5
5
|
import type { Language, Theme } from "../../../typings";
|
|
6
|
-
import type { Shape } from "./constants";
|
|
7
|
-
import { applianceShapes, shapesIcon, shapesIconActive } from "./constants";
|
|
6
|
+
import type { Shape, Eraser } from "./constants";
|
|
7
|
+
import { eraserIcon, eraserIconActive, applianceShapes, shapesIcon, shapesIconActive } from "./constants";
|
|
8
8
|
import { writable } from "svelte/store";
|
|
9
9
|
import { scrollHeight } from "../../../actions/height";
|
|
10
10
|
import { scrollTop } from "../../../actions/scroll";
|
|
11
|
+
import { tippy_hide_all } from "../../../actions/tippy";
|
|
11
12
|
import { clamp } from "../../helpers";
|
|
12
13
|
import { i18n } from "./constants";
|
|
13
|
-
import {
|
|
14
|
+
import { stockedApps } from "../../../behaviors";
|
|
14
15
|
import { tooltip } from "./helper";
|
|
15
16
|
import Icons from "../../Icons";
|
|
16
17
|
import Button from "../../Button";
|
|
17
18
|
import StrokeWidth from "./StrokeWidth.svelte";
|
|
18
19
|
import StrokeColor from "./StrokeColor.svelte";
|
|
20
|
+
import PencilEraserSize from "./PencilEraserSize.svelte";
|
|
19
21
|
import TextColor from "./TextColor.svelte";
|
|
20
22
|
import Shapes from "./Shapes.svelte";
|
|
21
|
-
import { tippy_hide_all } from "../../../actions/tippy";
|
|
22
23
|
|
|
23
24
|
export let app: FastboardApp | null | undefined = null;
|
|
24
25
|
export let theme: Theme = "light";
|
|
@@ -28,14 +29,17 @@
|
|
|
28
29
|
export let computed_height = 0;
|
|
29
30
|
export let scrollable = false;
|
|
30
31
|
export let hide_apps = false;
|
|
32
|
+
export let eraser_type: "delete" | "pencil" | "both" = "both";
|
|
31
33
|
|
|
32
34
|
const name = "fastboard-toolbar";
|
|
33
35
|
|
|
34
36
|
let last_shape: Shape = "rectangle";
|
|
37
|
+
let last_eraser: Eraser = "pencilEraser";
|
|
35
38
|
|
|
36
39
|
let pencil_panel: HTMLDivElement;
|
|
37
40
|
let text_panel: HTMLDivElement;
|
|
38
41
|
let shapes_panel: HTMLDivElement;
|
|
42
|
+
let eraser_panel: HTMLDivElement;
|
|
39
43
|
let apps_panel: HTMLDivElement;
|
|
40
44
|
|
|
41
45
|
let btn_props: { name: string; theme: Theme; disabled: boolean; placement: Placement };
|
|
@@ -47,6 +51,9 @@
|
|
|
47
51
|
selector: tooltip(t.selector, hotkeys?.changeToSelector),
|
|
48
52
|
pencil: tooltip(t.pencil, hotkeys?.changeToPencil),
|
|
49
53
|
eraser: tooltip(t.eraser, hotkeys?.changeToEraser),
|
|
54
|
+
pencilEraser: tooltip(t.pencilEraser, hotkeys?.changeToPencilEraser),
|
|
55
|
+
eraserForPanel: tooltip(t.eraser, hotkeys?.changeToEraser),
|
|
56
|
+
pencilEraserForPanel: tooltip(t.pencilEraser, hotkeys?.changeToPencilEraser),
|
|
50
57
|
text: tooltip(t.text, hotkeys?.changeToText),
|
|
51
58
|
};
|
|
52
59
|
$: memberState = app?.memberState;
|
|
@@ -60,6 +67,10 @@
|
|
|
60
67
|
last_shape = shape;
|
|
61
68
|
}
|
|
62
69
|
|
|
70
|
+
$: if (["pencilEraser", "eraser"].includes(appliance as Appliance)) {
|
|
71
|
+
last_eraser = appliance as "pencilEraser" | "eraser";
|
|
72
|
+
}
|
|
73
|
+
|
|
63
74
|
$: max_scroll = scrollable ? $scroll_height + (32 + 8) * 2 - computed_height : 0;
|
|
64
75
|
|
|
65
76
|
let top = writable(0);
|
|
@@ -90,9 +101,15 @@
|
|
|
90
101
|
app?.setAppliance("shape", last_shape as Exclude<Shape, Appliance>);
|
|
91
102
|
}
|
|
92
103
|
}
|
|
93
|
-
function
|
|
104
|
+
function select_last_eraser() {
|
|
105
|
+
app?.setAppliance(last_eraser);
|
|
106
|
+
}
|
|
107
|
+
function select_eraser() {
|
|
94
108
|
app?.setAppliance("eraser");
|
|
95
109
|
}
|
|
110
|
+
function select_pencil_eraser() {
|
|
111
|
+
app?.setAppliance("pencilEraser");
|
|
112
|
+
}
|
|
96
113
|
function clear() {
|
|
97
114
|
app?.cleanCurrentScene();
|
|
98
115
|
}
|
|
@@ -139,13 +156,43 @@
|
|
|
139
156
|
<svelte:component this={shapesIcon[last_shape]} {theme} />
|
|
140
157
|
{/if}
|
|
141
158
|
</Button>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
159
|
+
{#if eraser_type === "delete"}
|
|
160
|
+
<Button class="eraser" {...btn_props} on:click={select_eraser} content={c.eraser}>
|
|
161
|
+
{#if appliance === "eraser"}
|
|
162
|
+
<Icons.EraserFilled {theme} active />
|
|
163
|
+
{:else}
|
|
164
|
+
<Icons.Eraser {theme} />
|
|
165
|
+
{/if}
|
|
166
|
+
</Button>
|
|
167
|
+
{:else if eraser_type === "pencil"}
|
|
168
|
+
<Button
|
|
169
|
+
class="eraser"
|
|
170
|
+
{...btn_props}
|
|
171
|
+
on:click={select_pencil_eraser}
|
|
172
|
+
content={c.pencilEraser}
|
|
173
|
+
menu={eraser_panel}
|
|
174
|
+
>
|
|
175
|
+
{#if appliance === "pencilEraser"}
|
|
176
|
+
<Icons.PencilEraserFilled {theme} active />
|
|
177
|
+
{:else}
|
|
178
|
+
<Icons.PencilEraser {theme} />
|
|
179
|
+
{/if}
|
|
180
|
+
</Button>
|
|
181
|
+
{:else}
|
|
182
|
+
<Button
|
|
183
|
+
class="eraser"
|
|
184
|
+
{...btn_props}
|
|
185
|
+
on:click={select_last_eraser}
|
|
186
|
+
content={t[last_eraser]}
|
|
187
|
+
menu={eraser_panel}
|
|
188
|
+
>
|
|
189
|
+
{#if appliance === last_eraser}
|
|
190
|
+
<svelte:component this={eraserIconActive[last_eraser]} {theme} active />
|
|
191
|
+
{:else}
|
|
192
|
+
<svelte:component this={eraserIcon[last_eraser]} {theme} />
|
|
193
|
+
{/if}
|
|
194
|
+
</Button>
|
|
195
|
+
{/if}
|
|
149
196
|
<Button class="clear" {...btn_props} on:click={clear} content={t.clear}>
|
|
150
197
|
<Icons.Clear {theme} />
|
|
151
198
|
</Button>
|
|
@@ -177,8 +224,46 @@
|
|
|
177
224
|
<div class="{name}-panel-divider" />
|
|
178
225
|
<StrokeColor {app} {theme} {disabled} />
|
|
179
226
|
</div>
|
|
180
|
-
<div class="{name}-panel
|
|
181
|
-
{#
|
|
227
|
+
<div class="{name}-panel eraser" bind:this={eraser_panel}>
|
|
228
|
+
{#if eraser_type === "both"}
|
|
229
|
+
<div class="{name}-panel-btns">
|
|
230
|
+
<Button
|
|
231
|
+
class="eraser"
|
|
232
|
+
{...btn_props}
|
|
233
|
+
on:click={select_pencil_eraser}
|
|
234
|
+
placement="top"
|
|
235
|
+
content={c.pencilEraserForPanel}
|
|
236
|
+
>
|
|
237
|
+
{#if appliance === "pencilEraser"}
|
|
238
|
+
<Icons.PencilEraserFilled {theme} active />
|
|
239
|
+
{:else}
|
|
240
|
+
<Icons.PencilEraser {theme} />
|
|
241
|
+
{/if}
|
|
242
|
+
</Button>
|
|
243
|
+
<Button
|
|
244
|
+
class="eraser"
|
|
245
|
+
{...btn_props}
|
|
246
|
+
on:click={select_eraser}
|
|
247
|
+
placement="top"
|
|
248
|
+
content={c.eraserForPanel}
|
|
249
|
+
>
|
|
250
|
+
{#if appliance === "eraser"}
|
|
251
|
+
<Icons.EraserFilled {theme} active />
|
|
252
|
+
{:else}
|
|
253
|
+
<Icons.Eraser {theme} />
|
|
254
|
+
{/if}
|
|
255
|
+
</Button>
|
|
256
|
+
</div>
|
|
257
|
+
{#if appliance === "pencilEraser"}
|
|
258
|
+
<div class="{name}-panel-divider" />
|
|
259
|
+
<PencilEraserSize {app} {theme} {disabled} />
|
|
260
|
+
{/if}
|
|
261
|
+
{:else if eraser_type === "pencil"}
|
|
262
|
+
<PencilEraserSize {app} {theme} {disabled} />
|
|
263
|
+
{/if}
|
|
264
|
+
</div>
|
|
265
|
+
<div class="{name}-panel apps" style="--n:{$stockedApps.length}" bind:this={apps_panel}>
|
|
266
|
+
{#each $stockedApps as netless_app}
|
|
182
267
|
{@const { icon, label, kind, onClick } = netless_app}
|
|
183
268
|
{@const state = $status && $status[kind]}
|
|
184
269
|
{@const on_click = () => {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { FastboardApp } from "@netless/fastboard-core";
|
|
3
|
+
import type { Theme } from "../../../typings";
|
|
4
|
+
import Slider from "./Slider.svelte";
|
|
5
|
+
|
|
6
|
+
export let app: FastboardApp | null | undefined = null;
|
|
7
|
+
export let theme: Theme = "light";
|
|
8
|
+
export let disabled = false;
|
|
9
|
+
|
|
10
|
+
$: memberState = app?.memberState;
|
|
11
|
+
$: value = $memberState?.pencilEraserSize ?? 1;
|
|
12
|
+
|
|
13
|
+
$: props = { value, theme, disabled };
|
|
14
|
+
|
|
15
|
+
function set_pencil_eraser_size({ detail: value }: CustomEvent<number>) {
|
|
16
|
+
app?.setPencilEraserSize(value);
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<Slider
|
|
21
|
+
class="fastboard-toolbar-slider pencil-eraser-size"
|
|
22
|
+
{...props}
|
|
23
|
+
min={1}
|
|
24
|
+
max={3}
|
|
25
|
+
step={1}
|
|
26
|
+
on:change={set_pencil_eraser_size}
|
|
27
|
+
/>
|
|
@@ -50,14 +50,29 @@ export const shapesIconActive: Record<Shape, any> = {
|
|
|
50
50
|
speechBalloon: Icons.BalloonBolded,
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
export const erasers = ["eraser", "pencilEraser"] as const;
|
|
54
|
+
|
|
55
|
+
export type Eraser = typeof erasers[number];
|
|
56
|
+
|
|
57
|
+
export const eraserIcon: Record<Eraser, any> = {
|
|
58
|
+
eraser: Icons.Eraser,
|
|
59
|
+
pencilEraser: Icons.PencilEraser,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const eraserIconActive: Record<Eraser, any> = {
|
|
63
|
+
eraser: Icons.EraserFilled,
|
|
64
|
+
pencilEraser: Icons.PencilEraserFilled,
|
|
65
|
+
};
|
|
66
|
+
|
|
53
67
|
export const i18n: I18nData<
|
|
54
|
-
"clicker" | "selector" | "pencil" | "text" | "shapes" | "eraser" | "clear" | "apps"
|
|
68
|
+
"clicker" | "selector" | "pencil" | "pencilEraser" | "text" | "shapes" | "eraser" | "clear" | "apps"
|
|
55
69
|
> = {
|
|
56
70
|
en: {
|
|
57
71
|
clicker: "clicker",
|
|
58
72
|
selector: "selector",
|
|
59
73
|
pencil: "pencil",
|
|
60
74
|
eraser: "eraser",
|
|
75
|
+
pencilEraser: "eraser",
|
|
61
76
|
text: "text",
|
|
62
77
|
shapes: "shapes",
|
|
63
78
|
clear: "clear",
|
|
@@ -68,6 +83,7 @@ export const i18n: I18nData<
|
|
|
68
83
|
selector: "选择",
|
|
69
84
|
pencil: "铅笔",
|
|
70
85
|
eraser: "橡皮",
|
|
86
|
+
pencilEraser: "板擦",
|
|
71
87
|
text: "文字",
|
|
72
88
|
shapes: "形状",
|
|
73
89
|
clear: "清屏",
|