@edv4h/usketch-plugin-laser 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 EdV4H
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ export { createLaserPlugin, laserPlugin } from "./plugin.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { createLaserPlugin, laserPlugin } from "./plugin.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { UsketchPlugin } from "@edv4h/usketch-shared";
2
+ import type { WsProviderHandle } from "@edv4h/usketch-sync";
3
+ /** WsProvider付きファクトリ(リアルタイム同期対応) */
4
+ export declare function createLaserPlugin(wsProvider: WsProviderHandle): UsketchPlugin;
5
+ /** ローカル専用 */
6
+ export declare const laserPlugin: UsketchPlugin;
7
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKX,aAAa,EACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAwW5D,oCAAoC;AACpC,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,gBAAgB,GAAG,aAAa,CAE7E;AAED,aAAa;AACb,eAAO,MAAM,WAAW,EAAE,aAA8B,CAAC"}
package/dist/plugin.js ADDED
@@ -0,0 +1,281 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from "react";
3
+ /** 各ポイントが生存する時間(ms) */
4
+ const POINT_LIFETIME = 2500;
5
+ /** ポイント取得の最小間隔(ms) */
6
+ const EMIT_INTERVAL = 16;
7
+ const LASER_COLORS = ["#ff0000", "#3498db", "#2ecc71", "#f39c12", "#9b59b6", "#e84393"];
8
+ function getUserLaserColor(userId) {
9
+ let hash = 0;
10
+ for (let i = 0; i < userId.length; i++) {
11
+ hash = (hash * 31 + userId.charCodeAt(i)) | 0;
12
+ }
13
+ return LASER_COLORS[Math.abs(hash) % LASER_COLORS.length];
14
+ }
15
+ /**
16
+ * 全ストロークを管理するシングルトン。
17
+ * レイヤーのrAFループからreadだけ、ロジック側からwriteする。
18
+ */
19
+ const strokeStore = {
20
+ strokes: new Map(),
21
+ /** rAFを起動するためのコールバック(LaserCanvasが設定) */
22
+ onStrokeAdded: null,
23
+ getOrCreate(key, color) {
24
+ let s = this.strokes.get(key);
25
+ if (!s) {
26
+ s = { points: [], color, finished: false };
27
+ this.strokes.set(key, s);
28
+ }
29
+ return s;
30
+ },
31
+ reset(key, color) {
32
+ const s = { points: [], color, finished: false };
33
+ this.strokes.set(key, s);
34
+ this.onStrokeAdded?.();
35
+ return s;
36
+ },
37
+ addPoint(key, point, color) {
38
+ const stroke = this.getOrCreate(key, color);
39
+ stroke.points.push({ x: point.x, y: point.y, t: Date.now() });
40
+ this.onStrokeAdded?.();
41
+ },
42
+ remove(key) {
43
+ this.strokes.delete(key);
44
+ },
45
+ };
46
+ /**
47
+ * Canvas2Dで全レーザーストロークを描画するコンポーネント。
48
+ * rAFループで毎フレーム描画するので、Reactの再レンダリングに依存しない。
49
+ */
50
+ function LaserCanvas({ ctx: renderCtx }) {
51
+ const canvasRef = useRef(null);
52
+ const rafRef = useRef(0);
53
+ const viewportRef = useRef(renderCtx.viewport);
54
+ viewportRef.current = renderCtx.viewport;
55
+ useEffect(() => {
56
+ if (!canvasRef.current)
57
+ return;
58
+ const canvas = canvasRef.current;
59
+ const c2d = canvas.getContext("2d");
60
+ if (!c2d)
61
+ return;
62
+ let running = true;
63
+ function draw() {
64
+ if (!running)
65
+ return;
66
+ const dpr = window.devicePixelRatio || 1;
67
+ const w = window.innerWidth;
68
+ const h = window.innerHeight;
69
+ if (canvas.width !== w * dpr || canvas.height !== h * dpr) {
70
+ canvas.width = w * dpr;
71
+ canvas.height = h * dpr;
72
+ canvas.style.width = `${w}px`;
73
+ canvas.style.height = `${h}px`;
74
+ }
75
+ c2d.setTransform(dpr, 0, 0, dpr, 0, 0);
76
+ c2d.clearRect(0, 0, w, h);
77
+ const { x: vx, y: vy, zoom } = viewportRef.current;
78
+ const now = Date.now();
79
+ let hasContent = false;
80
+ for (const [key, stroke] of strokeStore.strokes) {
81
+ // 期限切れポイントを除去
82
+ stroke.points = stroke.points.filter((p) => now - p.t < POINT_LIFETIME);
83
+ if (stroke.points.length === 0) {
84
+ strokeStore.strokes.delete(key);
85
+ continue;
86
+ }
87
+ hasContent = true;
88
+ const pts = stroke.points;
89
+ const color = stroke.color;
90
+ // ワールド座標→スクリーン座標
91
+ const screenPts = pts.map((p) => ({
92
+ x: p.x * zoom + vx,
93
+ y: p.y * zoom + vy,
94
+ t: p.t,
95
+ }));
96
+ if (screenPts.length < 2)
97
+ continue;
98
+ // 全ポイントの平均lifeでストローク全体のopacityを決定
99
+ // (尻尾の消滅は古いポイントのfilterで実現済み)
100
+ let totalLife = 0;
101
+ for (const p of screenPts) {
102
+ totalLife += Math.max(0, 1 - (now - p.t) / POINT_LIFETIME);
103
+ }
104
+ const avgLife = totalLife / screenPts.length;
105
+ // Catmull-Romスプラインを1つのPathとして構築
106
+ c2d.lineCap = "round";
107
+ c2d.lineJoin = "round";
108
+ c2d.beginPath();
109
+ c2d.moveTo(screenPts[0].x, screenPts[0].y);
110
+ for (let i = 0; i < screenPts.length - 1; i++) {
111
+ const p0 = screenPts[Math.max(0, i - 1)];
112
+ const p1 = screenPts[i];
113
+ const p2 = screenPts[Math.min(screenPts.length - 1, i + 1)];
114
+ const p3 = screenPts[Math.min(screenPts.length - 1, i + 2)];
115
+ const cp1x = p1.x + (p2.x - p0.x) / 6;
116
+ const cp1y = p1.y + (p2.y - p0.y) / 6;
117
+ const cp2x = p2.x - (p3.x - p1.x) / 6;
118
+ const cp2y = p2.y - (p3.y - p1.y) / 6;
119
+ c2d.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, p2.x, p2.y);
120
+ }
121
+ // グロー(1回のstroke)
122
+ c2d.globalAlpha = avgLife * 0.12;
123
+ c2d.strokeStyle = color;
124
+ c2d.lineWidth = 8;
125
+ c2d.stroke();
126
+ // メインストローク(同じpath、1回のstroke)
127
+ c2d.globalAlpha = avgLife * 0.85;
128
+ c2d.lineWidth = 3;
129
+ c2d.stroke();
130
+ // 芯線(同じpath、1回のstroke)
131
+ c2d.globalAlpha = avgLife * 0.35;
132
+ c2d.strokeStyle = "#fff";
133
+ c2d.lineWidth = 1.2;
134
+ c2d.stroke();
135
+ }
136
+ c2d.globalAlpha = 1;
137
+ if (hasContent || strokeStore.strokes.size > 0) {
138
+ rafRef.current = requestAnimationFrame(draw);
139
+ }
140
+ else {
141
+ rafRef.current = 0;
142
+ }
143
+ }
144
+ // ストローク追加時にrAFループを起動するコールバック
145
+ strokeStore.onStrokeAdded = () => {
146
+ if (rafRef.current === 0 && running) {
147
+ rafRef.current = requestAnimationFrame(draw);
148
+ }
149
+ };
150
+ // 初回起動
151
+ if (strokeStore.strokes.size > 0) {
152
+ rafRef.current = requestAnimationFrame(draw);
153
+ }
154
+ return () => {
155
+ running = false;
156
+ strokeStore.onStrokeAdded = null;
157
+ if (rafRef.current) {
158
+ cancelAnimationFrame(rafRef.current);
159
+ }
160
+ };
161
+ }, []);
162
+ return (_jsx("canvas", { ref: canvasRef, style: {
163
+ position: "absolute",
164
+ inset: 0,
165
+ pointerEvents: "none",
166
+ } }));
167
+ }
168
+ function LaserIcon() {
169
+ return (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", children: [_jsx("title", { children: "Laser" }), _jsx("line", { x1: "3", y1: "17", x2: "14", y2: "6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }), _jsx("circle", { cx: "15", cy: "5", r: "2", fill: "currentColor", opacity: "0.8" }), _jsx("line", { x1: "15", y1: "1", x2: "15", y2: "3", stroke: "currentColor", strokeWidth: "1", opacity: "0.5" }), _jsx("line", { x1: "18", y1: "5", x2: "17", y2: "5", stroke: "currentColor", strokeWidth: "1", opacity: "0.5" }), _jsx("line", { x1: "17.5", y1: "2.5", x2: "16.5", y2: "3.5", stroke: "currentColor", strokeWidth: "1", opacity: "0.5" })] }));
170
+ }
171
+ function createPlugin(wsProvider) {
172
+ let cleanup;
173
+ return {
174
+ id: "usketch-plugin-laser",
175
+ name: "レーザーポインタ",
176
+ setup(ctx) {
177
+ // fixedレイヤーとしてCanvas2Dを登録(ビューポート変換は自前で行う)
178
+ ctx.layers.register({
179
+ id: "laser",
180
+ order: 90,
181
+ fixed: true,
182
+ render: (renderCtx) => _jsx(LaserCanvas, { ctx: renderCtx }),
183
+ });
184
+ // rAFを起動するためのヘルパー — strokeStoreに書き込むだけで描画される
185
+ function startStroke(key, color) {
186
+ strokeStore.reset(key, color);
187
+ }
188
+ function addPointToStroke(key, point, color) {
189
+ strokeStore.addPoint(key, point, color);
190
+ }
191
+ function finishStroke(key) {
192
+ const stroke = strokeStore.strokes.get(key);
193
+ if (stroke)
194
+ stroke.finished = true;
195
+ }
196
+ // ── リモート ──
197
+ let unsubBroadcast;
198
+ if (wsProvider) {
199
+ unsubBroadcast = wsProvider.onBroadcast((msg) => {
200
+ if (msg.kind !== "laser-point")
201
+ return;
202
+ const position = msg.position;
203
+ const source = typeof msg.sourceUserId === "string" ? msg.sourceUserId : "remote";
204
+ const color = typeof msg.color === "string" ? msg.color : "#ff0000";
205
+ if (!position || typeof position.x !== "number" || typeof position.y !== "number") {
206
+ return;
207
+ }
208
+ if (msg.isStart === true) {
209
+ startStroke(source, color);
210
+ }
211
+ addPointToStroke(source, { x: position.x, y: position.y }, color);
212
+ if (msg.isEnd === true) {
213
+ finishStroke(source);
214
+ }
215
+ });
216
+ }
217
+ // ── ローカル ──
218
+ let lastEmitTime = 0;
219
+ let isDrawing = false;
220
+ const LOCAL_KEY = wsProvider ? String(wsProvider.awareness.doc.clientID) : "local";
221
+ const laserColor = getUserLaserColor(LOCAL_KEY);
222
+ function addPoint(point, isStart, isEnd = false) {
223
+ const now = Date.now();
224
+ if (!isStart && !isEnd && now - lastEmitTime < EMIT_INTERVAL)
225
+ return;
226
+ lastEmitTime = now;
227
+ if (isStart) {
228
+ startStroke(LOCAL_KEY, laserColor);
229
+ }
230
+ addPointToStroke(LOCAL_KEY, point, laserColor);
231
+ if (isEnd) {
232
+ finishStroke(LOCAL_KEY);
233
+ }
234
+ wsProvider?.broadcast({
235
+ kind: "laser-point",
236
+ sourceUserId: LOCAL_KEY,
237
+ position: point,
238
+ color: laserColor,
239
+ isStart,
240
+ isEnd,
241
+ });
242
+ }
243
+ ctx.tools.register("laser", {
244
+ icon: LaserIcon,
245
+ cursor: "crosshair",
246
+ shortcut: "l",
247
+ order: 60,
248
+ onPointerDown: (_tc, e) => {
249
+ isDrawing = true;
250
+ addPoint(e.worldPoint, true);
251
+ },
252
+ onPointerMove: (_tc, e) => {
253
+ if (!isDrawing)
254
+ return;
255
+ addPoint(e.worldPoint, false);
256
+ },
257
+ onPointerUp: (_tc, e) => {
258
+ if (!isDrawing)
259
+ return;
260
+ addPoint(e.worldPoint, false, true);
261
+ isDrawing = false;
262
+ },
263
+ });
264
+ cleanup = () => {
265
+ unsubBroadcast?.();
266
+ ctx.layers.unregister("laser");
267
+ strokeStore.strokes.clear();
268
+ };
269
+ },
270
+ teardown() {
271
+ cleanup?.();
272
+ },
273
+ };
274
+ }
275
+ /** WsProvider付きファクトリ(リアルタイム同期対応) */
276
+ export function createLaserPlugin(wsProvider) {
277
+ return createPlugin(wsProvider);
278
+ }
279
+ /** ローカル専用 */
280
+ export const laserPlugin = createPlugin();
281
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,uBAAuB;AACvB,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,sBAAsB;AACtB,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAExF,SAAS,iBAAiB,CAAC,MAAc;IACxC,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AAO,YAAY,CAAC,UAAU,CAAC,CAAC;AACjC,CAAC;AAED,aAAa;AACb,MAAM,CAAC,MAAM,WAAW,GAAkB,YAAY,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@edv4h/usketch-plugin-laser",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "source": "./src/index.ts",
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "dependencies": {
15
+ "@edv4h/usketch-sync": "1.0.0",
16
+ "@edv4h/usketch-shared": "1.0.0"
17
+ },
18
+ "peerDependencies": {
19
+ "react": ">=19"
20
+ },
21
+ "devDependencies": {
22
+ "@types/react": "19.2.14",
23
+ "typescript": "5.9.3",
24
+ "vitest": "3.2.4"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "README.md"
32
+ ],
33
+ "license": "MIT",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/EdV4H/usketch.git",
37
+ "directory": "plugins/usketch-plugin-laser"
38
+ },
39
+ "homepage": "https://github.com/EdV4H/usketch#readme",
40
+ "bugs": {
41
+ "url": "https://github.com/EdV4H/usketch/issues"
42
+ },
43
+ "scripts": {
44
+ "build": "tsc -p tsconfig.json",
45
+ "typecheck": "tsc --noEmit",
46
+ "test": "vitest run --passWithNoTests",
47
+ "clean": "rm -rf dist"
48
+ }
49
+ }