fb-slides 0.4.0 → 0.4.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": "fb-slides",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "description": "Markdown-driven reveal.js decks: live demo embeds, annotation, mermaid, and a zero-config dev server",
6
6
  "keywords": [
@@ -52,7 +52,7 @@ const WIDTH = 3.4; // px, the bright core of the line
52
52
 
53
53
  // The arrow's head: how far back along the shaft the wings reach, and how far
54
54
  // they open off it. A short arrow shrinks its head rather than being all head.
55
- const HEAD_LEN = 48;
55
+ const HEAD_LEN = 56;
56
56
  const HEAD_SPREAD = 0.55; // radians
57
57
  // Under this, a press-and-release is a click placing the tail, not a whole
58
58
  // arrow: the tip then follows the pointer until the second click.
@@ -254,8 +254,9 @@ const RevealAnnotate = () => ({
254
254
 
255
255
  // The slab of canvas a stroke can reach, clamped to the viewport. Padded by
256
256
  // half the widest pass, plus a little for the curve's overshoot between
257
- // points.
258
- const boundsOf = (points) => {
257
+ // points; `extra` widens it further for shapes whose paint reaches past
258
+ // the points themselves.
259
+ const boundsOf = (points, extra = 0) => {
259
260
  let minX = Infinity;
260
261
  let minY = Infinity;
261
262
  let maxX = -Infinity;
@@ -266,7 +267,7 @@ const RevealAnnotate = () => ({
266
267
  if (x > maxX) maxX = x;
267
268
  if (y > maxY) maxY = y;
268
269
  }
269
- const pad = MAX_WIDTH / 2 + 3;
270
+ const pad = MAX_WIDTH / 2 + 3 + extra;
270
271
  const x = Math.max(0, Math.floor(minX - pad));
271
272
  const y = Math.max(0, Math.floor(minY - pad));
272
273
  return {
@@ -317,8 +318,6 @@ const RevealAnnotate = () => ({
317
318
  const { from, to } = stroke;
318
319
  const length = Math.hypot(to.x - from.x, to.y - from.y);
319
320
  if (length < 1) return true;
320
- const box = boundsOf([from, to]);
321
- if (box.w <= 0 || box.h <= 0) return true;
322
321
 
323
322
  const fade = progress === null ? 1 : 1 - progress;
324
323
  const angle = Math.atan2(to.y - from.y, to.x - from.x);
@@ -332,6 +331,13 @@ const RevealAnnotate = () => ({
332
331
  y: to.y - head * 0.75 * Math.sin(angle),
333
332
  };
334
333
 
334
+ // The wings go into the bounds along with the line's own ends: an
335
+ // axis-aligned arrow has a razor-thin from-to box, and the head reaches
336
+ // further out of it sideways than the stroke padding covers. The extra
337
+ // head-width of pad keeps the glow well clear of the clip on every side.
338
+ const box = boundsOf([from, to, ...wings], head);
339
+ if (box.w <= 0 || box.h <= 0) return true;
340
+
335
341
  for (const { ink, passes } of LAYERS) {
336
342
  onLayer(box, stroke.ink[ink], (c) => {
337
343
  c.lineCap = 'round';