@xulongzhe/clawbench-desktop-linux-x64-payload 0.132.0 → 0.135.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xulongzhe/clawbench-desktop-linux-x64-payload",
3
- "version": "0.132.0",
3
+ "version": "0.135.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/clawbench-dev/clawbench.git"
@@ -153,6 +153,9 @@
153
153
 
154
154
  let mode = 'pen'
155
155
  let color = '#ff3b30'
156
+ /** Stroke width in the shared 800px reference space — the number that
157
+ * travels on the wire. Viewers multiply it by their own surface size
158
+ * (see `inkScale`), so this is NOT a CSS pixel count. */
156
159
  const width = 4
157
160
  /** Finished strokes, in normalised 0..1 coordinates. */
158
161
  let strokes = []
@@ -168,10 +171,24 @@
168
171
  redraw()
169
172
  }
170
173
 
174
+ /**
175
+ * Stroke thickness relative to the picture, exactly as every viewer
176
+ * computes it (web/src/share/LiveInkLayer.vue): a width of `w` covers
177
+ * `w / 800` of the surface. Without this the overlay drew a fixed
178
+ * `width * dpr` device pixels — on a 1920-wide screen the host saw a
179
+ * 4px line while the audience, which scales, saw a 9.6px one.
180
+ *
181
+ * `canvas.width` is in DEVICE pixels and `lineWidth` is too, so dpr
182
+ * cancels out and a HiDPI screen does not get a thicker line.
183
+ */
184
+ function inkScale() {
185
+ return Math.max(1, canvas.width / 800)
186
+ }
187
+
171
188
  function drawStroke(s) {
172
189
  if (s.points.length === 0) return
173
190
  ctx.strokeStyle = s.color
174
- ctx.lineWidth = width * dpr
191
+ ctx.lineWidth = Math.max(1, width * inkScale())
175
192
  ctx.lineCap = 'round'
176
193
  ctx.lineJoin = 'round'
177
194
  ctx.beginPath()
Binary file
Binary file