awesome-timeline-react 0.9.0 → 0.10.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.
@@ -452,6 +452,8 @@ export declare type Geometry = {
452
452
  staticEventBaseHeight: number;
453
453
  /** event bar corner radius */
454
454
  barRadius: number;
455
+ /** narrowest an event's hover/click rect is (see Theme.minHitWidth) */
456
+ minHitWidth: number;
455
457
  };
456
458
 
457
459
  /** Derive the full Geometry from the resolved theme's geometry tokens. */
@@ -838,6 +840,10 @@ declare type Theme = {
838
840
  rowPaddingY?: number;
839
841
  /** event bar corner radius in px (default 5) */
840
842
  barRadius?: number;
843
+ /** narrowest an event is for hover and click, in px, centred on it (default 0): a short event
844
+ * — a milestone, a mark drawn wider than its time — stays hoverable at any zoom. Drawing is
845
+ * unaffected. */
846
+ minHitWidth?: number;
841
847
  /** faint fill laid over the child-row block of an expanded group so it reads
842
848
  * as recessed beneath its parent row (default "rgba(0,0,0,0.05)"). Also used
843
849
  * to tint child row headers. */
@@ -452,6 +452,8 @@ export declare type Geometry = {
452
452
  staticEventBaseHeight: number;
453
453
  /** event bar corner radius */
454
454
  barRadius: number;
455
+ /** narrowest an event's hover/click rect is (see Theme.minHitWidth) */
456
+ minHitWidth: number;
455
457
  };
456
458
 
457
459
  /** Derive the full Geometry from the resolved theme's geometry tokens. */
@@ -838,6 +840,10 @@ declare type Theme = {
838
840
  rowPaddingY?: number;
839
841
  /** event bar corner radius in px (default 5) */
840
842
  barRadius?: number;
843
+ /** narrowest an event is for hover and click, in px, centred on it (default 0): a short event
844
+ * — a milestone, a mark drawn wider than its time — stays hoverable at any zoom. Drawing is
845
+ * unaffected. */
846
+ minHitWidth?: number;
841
847
  /** faint fill laid over the child-row block of an expanded group so it reads
842
848
  * as recessed beneath its parent row (default "rgba(0,0,0,0.05)"). Also used
843
849
  * to tint child row headers. */
package/dist/index.js CHANGED
@@ -467,6 +467,7 @@ var DEFAULT_THEME = {
467
467
  laneGap: 2,
468
468
  rowPaddingY: 10,
469
469
  barRadius: 5,
470
+ minHitWidth: 0,
470
471
  groupChildBackground: "rgba(0,0,0,0.05)",
471
472
  groupShadowColor: "rgba(0,0,0,0.22)"
472
473
  };
@@ -692,7 +693,8 @@ var DEFAULT_GEOMETRY = {
692
693
  laneTopOffset: 10,
693
694
  rowBaseHeight: 40,
694
695
  staticEventBaseHeight: 20,
695
- barRadius: 5
696
+ barRadius: 5,
697
+ minHitWidth: 0
696
698
  };
697
699
  var geometryFromTheme = (theme) => {
698
700
  const barHeight = theme.barHeight;
@@ -703,7 +705,8 @@ var geometryFromTheme = (theme) => {
703
705
  laneTopOffset: rowPaddingY,
704
706
  rowBaseHeight: barHeight + 2 * rowPaddingY,
705
707
  staticEventBaseHeight: barHeight,
706
- barRadius: theme.barRadius
708
+ barRadius: theme.barRadius,
709
+ minHitWidth: theme.minHitWidth
707
710
  };
708
711
  };
709
712
 
@@ -1252,7 +1255,8 @@ var hitTest = (scene, view, x, y) => {
1252
1255
  width: timeToWidth(event.startTime, event.endTime, tick),
1253
1256
  height: geometry.barHeight
1254
1257
  };
1255
- if (rectContains(rect, x, y)) {
1258
+ const hit = rect.width >= geometry.minHitWidth ? rect : __spreadProps(__spreadValues({}, rect), { x: rect.x + (rect.width - geometry.minHitWidth) / 2, width: geometry.minHitWidth });
1259
+ if (rectContains(hit, x, y)) {
1256
1260
  return { kind: "event", event, rowId, rect };
1257
1261
  }
1258
1262
  }