@netless/fastboard-ui 1.1.3 → 1.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/fastboard-ui",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "The front-end of @netless/fastboard-core.",
5
5
  "main": "dist/index.js",
6
6
  "svelte": "dist/index.svelte.mjs",
@@ -12,14 +12,14 @@
12
12
  ],
13
13
  "repository": "netless-io/fastboard",
14
14
  "peerDependencies": {
15
- "@netless/fastboard-core": "1.1.3"
15
+ "@netless/fastboard-core": "1.1.4"
16
16
  },
17
17
  "dependencies": {
18
18
  "tippy.js": "^6.3.7"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@netless/buildtool": "0.1.0",
22
- "@netless/fastboard-core": "1.1.3",
22
+ "@netless/fastboard-core": "1.1.4",
23
23
  "@netless/esbuild-plugin-inline-sass": "0.1.0"
24
24
  },
25
25
  "scripts": {
@@ -0,0 +1,15 @@
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
+ <g stroke-width="1" stroke-linecap="round" stroke-linejoin="round" transform="scale(1 0.85)">
10
+ <path
11
+ class="fastboard-icon-fill-color"
12
+ d="M7 16c.55 0 1 .45 1 1c0 1.1-.9 2-2 2c-.17 0-.33 0-.5-.05c.31-.55.5-1.21.5-1.95c0-.55.45-1 1-1M18.67 3c-.26 0-.51.1-.71.29L9 12.25L11.75 15l8.96-8.96c.39-.39.39-1.04 0-1.41l-1.34-1.34c-.2-.2-.45-.29-.7-.29M7 14c-1.66 0-3 1.34-3 3c0 1.31-1.16 2-2 2c.92 1.22 2.5 2 4 2c2.21 0 4-1.79 4-4c0-1.66-1.34-3-3-3"
13
+ />
14
+ </g>
15
+ </svg>
@@ -0,0 +1,15 @@
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
+ <g stroke-width="1" stroke-linecap="round" stroke-linejoin="round" transform="scale(1 0.85)">
10
+ <path
11
+ class="fastboard-icon-fill-color"
12
+ d="m20.71 4.63l-1.34-1.34c-.37-.39-1.02-.39-1.41 0L9 12.25L11.75 15l8.96-8.96c.39-.39.39-1.04 0-1.41M7 14a3 3 0 0 0-3 3c0 1.31-1.16 2-2 2c.92 1.22 2.5 2 4 2a4 4 0 0 0 4-4a3 3 0 0 0-3-3"
13
+ />
14
+ </g>
15
+ </svg>
@@ -6,7 +6,7 @@
6
6
  </script>
7
7
 
8
8
  <svg width="24" height="24" viewBox="0 0 24 24" class="fastboard-icon {theme}" class:is-active={active}>
9
- <g fill="none">
9
+ <g fill="none" transform="scale(0.8 0.8) translate(3 1)">
10
10
  <path
11
11
  fill="#5D6066"
12
12
  d="m5.505 11.41l.53.53zM3 14.952h-.75zM9.048 21v.75zM11.41 5.505l-.53-.53zm1.831 12.34a.75.75 0 0 0 1.06-1.061zM7.216 9.697a.75.75 0 1 0-1.06 1.061zm10.749 2.362l-5.905 5.905l1.06 1.06l5.905-5.904zm-11.93-.12l5.905-5.905l-1.06-1.06l-5.905 5.904zm0 6.025c-.85-.85-1.433-1.436-1.812-1.933c-.367-.481-.473-.79-.473-1.08h-1.5c0 .749.312 1.375.78 1.99c.455.596 1.125 1.263 1.945 2.083zm-1.06-7.086c-.82.82-1.49 1.488-1.945 2.084c-.468.614-.78 1.24-.78 1.99h1.5c0-.29.106-.6.473-1.08c.38-.498.962-1.083 1.812-1.933zm7.085 7.086c-.85.85-1.435 1.433-1.933 1.813c-.48.366-.79.472-1.08.472v1.5c.75 0 1.376-.312 1.99-.78c.596-.455 1.264-1.125 2.084-1.945zm-7.085 1.06c.82.82 1.487 1.49 2.084 1.945c.614.468 1.24.78 1.989.78v-1.5c-.29 0-.599-.106-1.08-.473c-.497-.38-1.083-.962-1.933-1.812zm12.99-12.99c.85.85 1.433 1.436 1.813 1.933c.366.481.472.79.472 1.08h1.5c0-.749-.312-1.375-.78-1.99c-.455-.596-1.125-1.263-1.945-2.083zm1.06 7.086c.82-.82 1.49-1.488 1.945-2.084c.468-.614.78-1.24.78-1.99h-1.5c0 .29-.106.6-.473 1.08c-.38.498-.962 1.083-1.812 1.933zm0-8.146c-.82-.82-1.487-1.49-2.084-1.945c-.614-.468-1.24-.78-1.989-.78v1.5c.29 0 .599.106 1.08.473c.497.38 1.083.962 1.933 1.812zm-7.085 1.06c.85-.85 1.435-1.433 1.933-1.812c.48-.367.79-.473 1.08-.473v-1.5c-.75 0-1.376.312-1.99.78c-.596.455-1.264 1.125-2.084 1.945zm2.362 10.749L7.216 9.698l-1.06 1.061l7.085 7.085z"
@@ -6,7 +6,7 @@
6
6
  </script>
7
7
 
8
8
  <svg width="24" height="24" viewBox="0 0 24 24" class="fastboard-icon {theme}" class:is-active={active}>
9
- <g fill="none">
9
+ <g fill="none" transform="scale(0.8 0.8) translate(3 1)">
10
10
  <path
11
11
  fill="#5D6066"
12
12
  d="m5.505 11.41l.53.53zM3 14.952h-.75zM9.048 21v.75zM11.41 5.505l-.53-.53zm1.831 12.34a.75.75 0 0 0 1.06-1.061zM7.216 9.697a.75.75 0 1 0-1.06 1.061zm10.749 2.362l-5.905 5.905l1.06 1.06l5.905-5.904zm-11.93-.12l5.905-5.905l-1.06-1.06l-5.905 5.904zm0 6.025c-.85-.85-1.433-1.436-1.812-1.933c-.367-.481-.473-.79-.473-1.08h-1.5c0 .749.312 1.375.78 1.99c.455.596 1.125 1.263 1.945 2.083zm-1.06-7.086c-.82.82-1.49 1.488-1.945 2.084c-.468.614-.78 1.24-.78 1.99h1.5c0-.29.106-.6.473-1.08c.38-.498.962-1.083 1.812-1.933zm7.085 7.086c-.85.85-1.435 1.433-1.933 1.813c-.48.366-.79.472-1.08.472v1.5c.75 0 1.376-.312 1.99-.78c.596-.455 1.264-1.125 2.084-1.945zm-7.085 1.06c.82.82 1.487 1.49 2.084 1.945c.614.468 1.24.78 1.989.78v-1.5c-.29 0-.599-.106-1.08-.473c-.497-.38-1.083-.962-1.933-1.812zm12.99-12.99c.85.85 1.433 1.436 1.813 1.933c.366.481.472.79.472 1.08h1.5c0-.749-.312-1.375-.78-1.99c-.455-.596-1.125-1.263-1.945-2.083zm1.06 7.086c.82-.82 1.49-1.488 1.945-2.084c.468-.614.78-1.24.78-1.99h-1.5c0 .29-.106.6-.473 1.08c-.38.498-.962 1.083-1.812 1.933zm0-8.146c-.82-.82-1.487-1.49-2.084-1.945c-.614-.468-1.24-.78-1.989-.78v1.5c.29 0 .599.106 1.08.473c.497.38 1.083.962 1.933 1.812zm-7.085 1.06c.85-.85 1.435-1.433 1.933-1.812c.48-.367.79-.473 1.08-.473v-1.5c-.75 0-1.376.312-1.99.78c-.596.455-1.264 1.125-2.084 1.945zm2.362 10.749L7.216 9.698l-1.06 1.061l7.085 7.085z"
@@ -6,7 +6,7 @@
6
6
  </script>
7
7
 
8
8
  <svg fill="none" viewBox="0 0 24 24" class="fastboard-icon {theme}" class:is-active={active}>
9
- <g stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" transform="rotate(0 10 10)">
9
+ <g stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" transform="rotate(0 10 10) translate(3 2)">
10
10
  <path
11
11
  class="fastboard-icon-stroke-color"
12
12
  clip-rule="evenodd"
@@ -6,7 +6,7 @@
6
6
  </script>
7
7
 
8
8
  <svg fill="none" viewBox="0 0 24 24" class="fastboard-icon {theme}" class:is-active={active}>
9
- <g stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" transform="rotate(0 10 10)">
9
+ <g stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" transform="rotate(0 10 10) translate(3 2)">
10
10
  <path
11
11
  class="fastboard-icon-fill-color"
12
12
  clip-rule="evenodd"
@@ -22,6 +22,8 @@ import LineBolded from "./LineBolded.svelte";
22
22
  import Minus from "./Minus.svelte";
23
23
  import Pencil from "./Pencil.svelte";
24
24
  import PencilFilled from "./PencilFilled.svelte";
25
+ import StrokePencil from "./BrushPen.svelte";
26
+ import StrokePencilFilled from "./BrushPenFilled.svelte";
25
27
  import Plus from "./Plus.svelte";
26
28
  import Rectangle from "./Rectangle.svelte";
27
29
  import RectangleBolded from "./RectangleBolded.svelte";
@@ -106,6 +108,8 @@ const Icons = {
106
108
  MarkPenFilled,
107
109
  EraserBitmap,
108
110
  EraserBitmapFilled,
111
+ StrokePencil,
112
+ StrokePencilFilled
109
113
  };
110
114
 
111
115
  export default Icons;
@@ -82,7 +82,9 @@
82
82
  $: hasUseLaserPen = (hasAppliancePlugin && ($memberState as ExtendMemberState)?.useLaserPen) || false;
83
83
  $: hasUseMarkPen =
84
84
  (hasAppliancePlugin && ($memberState as ExtendMemberState)?.strokeOpacity === 0.5) || false;
85
- $: pencilType = hasUseLaserPen ? "laser" : hasUseMarkPen ? "mark" : "pencil";
85
+ $: hasUseStroke =
86
+ (hasAppliancePlugin && ($memberState as ExtendMemberState)?.strokeType === "Stroke") || false;
87
+ $: pencilType = hasUseLaserPen ? "laser" : hasUseMarkPen ? "mark" : hasUseStroke ? "stroke" : "pencil";
86
88
  $: hasUseEraserBitmap = hasAppliancePlugin && ($memberState as ExtendMemberState)?.isLine === false;
87
89
  $: eraserType = hasUseEraserBitmap ? "pencilEraser" : "eraser";
88
90
 
@@ -108,12 +110,14 @@
108
110
  useMarkPen();
109
111
  } else if (pencilType === "laser") {
110
112
  useLaserPen();
113
+ } else if (pencilType === "stroke") {
114
+ useStrokePencil();
111
115
  } else {
112
- usePencil();
116
+ useNormalPencil();
113
117
  }
114
118
  }
115
119
  } else {
116
- usePencil();
120
+ useNormalPencil();
117
121
  }
118
122
  }
119
123
  function text() {
@@ -141,11 +145,11 @@
141
145
  function clear() {
142
146
  app?.cleanCurrentScene();
143
147
  }
144
- function usePencil() {
148
+ function useNormalPencil() {
145
149
  if (hasAppliancePlugin) {
146
150
  app?.appliancePlugin?.setMemberState({
147
151
  currentApplianceName: "pencil",
148
- strokeType: "Stroke",
152
+ strokeType: "Normal",
149
153
  useLaserPen: false,
150
154
  strokeOpacity: 1,
151
155
  } as ExtendMemberState);
@@ -153,6 +157,14 @@
153
157
  app?.setAppliance("pencil");
154
158
  }
155
159
  }
160
+ function useStrokePencil() {
161
+ app?.appliancePlugin?.setMemberState({
162
+ currentApplianceName: "pencil",
163
+ strokeType: "Stroke",
164
+ useLaserPen: false,
165
+ strokeOpacity: 1,
166
+ } as ExtendMemberState);
167
+ }
156
168
  function useLaserPen() {
157
169
  app?.appliancePlugin?.setMemberState({
158
170
  currentApplianceName: "laserPen",
@@ -251,7 +263,7 @@
251
263
  <div class="{name}-panel-switch-pencil">
252
264
  {#if !!app?.appliancePlugin}
253
265
  {#if pencilType !== "pencil"}
254
- <Button class="{name}-panel-switch-btn" {...btn_props} on:click={usePencil}>
266
+ <Button class="{name}-panel-switch-btn" {...btn_props} on:click={useNormalPencil}>
255
267
  <Icons.Pencil {theme} />
256
268
  </Button>
257
269
  {:else if pencilType === "pencil"}
@@ -260,6 +272,16 @@
260
272
  </Button>
261
273
  {/if}
262
274
 
275
+ {#if pencilType === "stroke"}
276
+ <Button class="{name}-panel-switch-btn" {...btn_props}>
277
+ <Icons.StrokePencilFilled {theme} active />
278
+ </Button>
279
+ {:else if pencilType !== "stroke"}
280
+ <Button class="{name}-panel-switch-btn" {...btn_props} on:click={useStrokePencil}>
281
+ <Icons.StrokePencil {theme} />
282
+ </Button>
283
+ {/if}
284
+
263
285
  {#if showLaserPen && pencilType === "laser"}
264
286
  <Button class="{name}-panel-switch-btn" {...btn_props}>
265
287
  <Icons.LaserPenFilled {theme} active />
@@ -281,6 +303,7 @@
281
303
  {/if}
282
304
  {/if}
283
305
  </div>
306
+ <div class="{name}-panel-divider" />
284
307
  <StrokeWidth {app} {theme} {disabled} />
285
308
  <div class="{name}-panel-divider" />
286
309
  <StrokeColor {app} {theme} {disabled} {colors} />
@@ -25,6 +25,12 @@
25
25
  {:else}
26
26
  <Icons.LaserPen {theme} />
27
27
  {/if}
28
+ {:else if pencilType === "stroke"}
29
+ {#if appliance === "pencil"}
30
+ <Icons.StrokePencilFilled {theme} active />
31
+ {:else}
32
+ <Icons.StrokePencil {theme} />
33
+ {/if}
28
34
  {:else if pencilType === "pencil"}
29
35
  {#if appliance === "pencil"}
30
36
  <Icons.PencilFilled {theme} active />