@netless/fastboard-ui 1.0.0-canary.0 → 1.0.0-canary.1

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.0.0-canary.0",
3
+ "version": "1.0.0-canary.1",
4
4
  "description": "The front-end of @netless/fastboard-core.",
5
5
  "main": "dist/index.js",
6
6
  "svelte": "dist/index.svelte.mjs",
@@ -10,14 +10,14 @@
10
10
  ],
11
11
  "repository": "netless-io/fastboard",
12
12
  "peerDependencies": {
13
- "@netless/fastboard-core": "1.0.0-canary.0"
13
+ "@netless/fastboard-core": "1.0.0-canary.1"
14
14
  },
15
15
  "dependencies": {
16
16
  "tippy.js": "^6.3.7"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@netless/esbuild-plugin-inline-sass": "0.1.0",
20
- "@netless/fastboard-core": "1.0.0-canary.0"
20
+ "@netless/fastboard-core": "1.0.0-canary.1"
21
21
  },
22
22
  "scripts": {
23
23
  "cleanup": "rimraf dist",
@@ -1,7 +1,7 @@
1
1
  import type { FastboardApp } from "@netless/fastboard-core";
2
- import code_editor_svg from "./icons/visual-studio-code.svg";
3
- import geogebra_svg from "./icons/geogebra.svg";
4
- import countdown_svg from "./icons/countdown.svg";
2
+ // import code_editor_svg from "./icons/visual-studio-code.svg";
3
+ // import geogebra_svg from "./icons/geogebra.svg";
4
+ // import countdown_svg from "./icons/countdown.svg";
5
5
 
6
6
  export interface AppInToolbar {
7
7
  kind: string;
@@ -46,38 +46,4 @@ class AppsInToolbar {
46
46
 
47
47
  export type { AppsInToolbar };
48
48
 
49
- export const apps = new AppsInToolbar([
50
- {
51
- kind: "Monaco",
52
- icon: code_editor_svg,
53
- label: "Code Editor",
54
- onClick(app) {
55
- app.manager.addApp({
56
- kind: "Monaco",
57
- options: { title: "Code Editor" },
58
- });
59
- },
60
- },
61
- {
62
- kind: "GeoGebra",
63
- icon: geogebra_svg,
64
- label: "GeoGebra",
65
- onClick(app) {
66
- app.manager.addApp({
67
- kind: "GeoGebra",
68
- options: { title: "GeoGebra" },
69
- });
70
- },
71
- },
72
- {
73
- kind: "Countdown",
74
- icon: countdown_svg,
75
- label: "Countdown",
76
- onClick(app) {
77
- app.manager.addApp({
78
- kind: "Countdown",
79
- options: { title: "Countdown" },
80
- });
81
- },
82
- },
83
- ]);
49
+ export const apps = new AppsInToolbar([]);
@@ -61,10 +61,17 @@
61
61
  };
62
62
  }
63
63
  });
64
+
65
+ function focus_me() {
66
+ tippy_hide_all();
67
+ // workaround for some devices that enabled "windows ink"
68
+ let a = document.activeElement as HTMLElement | null;
69
+ a && a.blur && a.blur();
70
+ }
64
71
  </script>
65
72
 
66
73
  <div class="{name}-root" class:loading={!app}>
67
- <div class="{name}-view" bind:this={container} on:touchstart|capture|passive={tippy_hide_all} />
74
+ <div class="{name}-view" bind:this={container} on:touchstart|capture={focus_me} />
68
75
  <div class="{name}-left" class:hidden={!(layout === "visible" || layout === "toolbar-only")}>
69
76
  {#if config.toolbar?.enable !== false}
70
77
  <Toolbar {app} {theme} {language} config={config.toolbar} />
@@ -39,10 +39,17 @@
39
39
  };
40
40
  }
41
41
  });
42
+
43
+ function focus_me() {
44
+ tippy_hide_all();
45
+ // workaround for some devices that enabled "windows ink"
46
+ let a = document.activeElement as HTMLElement | null;
47
+ a && a.blur && a.blur();
48
+ }
42
49
  </script>
43
50
 
44
51
  <div class="{name}-root" class:loading={!player}>
45
- <div class="{name}-view" bind:this={container} on:touchstart|capture|passive={tippy_hide_all} />
52
+ <div class="{name}-view" bind:this={container} on:touchstart|capture={focus_me} />
46
53
  <div class="{name}-bottom">
47
54
  <PlayerControl {player} {theme} {language} />
48
55
  </div>
@@ -57,8 +57,10 @@
57
57
 
58
58
  $: camera = app?.camera;
59
59
  $: scale = $camera?.scale ?? 1;
60
- $: plus_disabled = disabled || next_scale(scale, 1) === scale;
61
- $: minus_disabled = disabled || next_scale(scale, -1) === scale;
60
+ $: plus_disabled = disabled || next_scale(scale, 1) <= scale;
61
+ $: minus_disabled = disabled || next_scale(scale, -1) >= scale;
62
+
63
+ $: display_scale = clamp(Math.round(scale * 100), 30, 300);
62
64
 
63
65
  function plus() {
64
66
  app?.moveCamera({ scale: next_scale(scale, 1), centerX: 0, centerY: 0 });
@@ -83,7 +85,7 @@
83
85
  {#if $camera == null}
84
86
  &hellip;
85
87
  {:else}
86
- {Math.ceil(scale * 100)}%
88
+ {display_scale}%
87
89
  {/if}
88
90
  </span>
89
91
  <Button class="minus" {name} {theme} disabled={minus_disabled} on:click={minus} content={t.minus}>