Proposals/Hit testing

From SVG
Jump to: navigation, search

This is a proposal for an API that can help with hit testing of the different parts of an element – fill, stroke and markers – separately.

[Constructor(UIEvent event, optional Element context)]
interface SVGPoint {
  ...
};

dictionary MarkerDetails {
  long index;
  SVGMarkerElement? element;
  float position;
};

interface SVGLocatable {
  bool isPointInFill(SVGPoint point);
  bool isPointInFill(UIEvent event);

  bool isPointInStroke(SVGPoint point);
  bool isPointInStroke(UIEvent event);

  bool isPointInMarker(SVGPoint point, optional unsigned long index);
  bool isPointInMarker(UIEvent event, optional unsigned long index);

  MarkerDetails getMarkerFromPoint(SVGPoint point);
  MarkerDetails getMarkerFromPoint(UIEvent event);
  MarkerDetails getMarkerAtIndex(unsigned long index);
};

Can we make pointer-events="painted" or "all" mean markers too? Or do we need a new property for that?