Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/interactions/brush.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class Brush extends Mark {
if (type === "start" && !snapping) {
target = event.sourceEvent?.currentTarget ?? this;
currentNode = _brushNodes.indexOf(target);
if (event.sourceEvent) context.ownerSVGElement.classList.add("no-tip");
if (!sync) {
syncing = true;
selectAll(_brushNodes.filter((_, i) => i !== currentNode)).call(_brush.move, null);
Expand All @@ -69,6 +70,7 @@ export class Brush extends Mark {

if (selection === null) {
if (type === "end") {
context.ownerSVGElement.classList.remove("no-tip");
if (sync) {
syncing = true;
selectAll(_brushNodes.filter((_, i) => i !== currentNode)).call(_brush.move, null);
Expand Down
4 changes: 3 additions & 1 deletion src/interactions/pointer.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op
// squashed, selecting primarily on the dominant dimension. Across facets,
// use unsquashed distance to determine the winner.
function pointermove(event) {
if (state.sticky || (event.pointerType === "mouse" && event.buttons === 1)) return; // dragging
if (state.sticky) return;
if (event.pointerType === "mouse" && event.buttons === 1) return void update(null); // hide tip during drag
let [xp, yp] = pointof(event);
(xp -= tx), (yp -= ty); // correct for facets and band scales
const kpx = xp < dimensions.marginLeft || xp > dimensions.width - dimensions.marginRight ? 1 : kx;
Expand All @@ -166,6 +167,7 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op
if (i == null) return; // not pointing
if (state.sticky && state.roots.some((r) => r?.contains(event.target))) return; // stay sticky
if (state.sticky) (state.sticky = false), state.renders.forEach((r) => r(null)); // clear all pointers
else if (svg.classList.contains("no-tip")) return void update(null); // cancel tip on brush start
else (state.sticky = true), render(i);
event.stopImmediatePropagation(); // suppress other pointers
}
Expand Down
Loading