regl-scatterplot icon indicating copy to clipboard operation
regl-scatterplot copied to clipboard

lassoInitiator not works

Open masalinas opened this issue 1 year ago • 7 comments

I would like to active the lassoInitiator functionality to avoid to use the extra shift button to init the lasso functionality. I activated it one time from this piece of code. This code is executed inside the ngAfterViewInit() function (Angular):

    this.scatterplot = createScatterplot({
      canvas,
      width,
      height
    });

    // Activate reticle and set reticle color to red and lasso initialization functionality
    this.scatterplot.set({ lassoInitiator: true, showReticle: true, reticleColor: [0, 0, 0, 0.66] });

As you can see I have activated this param but I need to click the shift button to initialize the lasso functinality. The showReticle works ok, but the lassoInitiator not. I don't know if is an issue or exist a problem from my side.

masalinas avatar Feb 14 '24 16:02 masalinas

Apologies! I totally missed this ticket. This is a bug. Fortunately it's easy to work around it. Simply set lassoInitiator: true insight the createScatterplot as follows:

this.scatterplot = createScatterplot({
  canvas,
  width,
  height,
  lassoInitiator: true
});

flekschas avatar Mar 25 '24 13:03 flekschas

I tried to configure the scatter as you say like this a

this.scatterplot = createScatterplot({
     canvas,
     width,
     height,
     lassoInitiator: true,
     showReticle: true, 
     reticleColor: [0, 0, 0, 0.66]
   });
<div class="flex flex-row"> 
   <canvas class="canvas-points" #canvasPlot [hidden]="!hiddenSpinner"></canvas>
   ...
   
</div>   

Also as you see the reticle not apper in the canvas, only the height and width attributes works the other ones not.

Version: "regl-scatterplot": "^1.8.5",

But the functionality not works. Any suggestion?

masalinas avatar Mar 25 '24 14:03 masalinas

How exactly do you know that the functionality is not working? I just tried it today and it works as expected for me. A short screen recording would help a lot to pin point the issue.

flekschas avatar Mar 25 '24 22:03 flekschas

Actually I can't reproduce the issue. One idea I have why it might not work for you is that the lasso initiator is added to the wrong parent element. What have you set lassoInitiatorParentElement to? By default it's document.body but I suspect that you want to set it to <div class="flex flex-row">

flekschas avatar Mar 26 '24 00:03 flekschas

Also as an aside, you can also lasso elements via long press if you create the scatter plot instance as follows:

this.scatterplot = createScatterplot({
  canvas,
  width,
  height,
  lassoOnLongPress: true,
});

I personally like the long press option more as I find it less fiddly. Here's how it looks like:

lasso long press

flekschas avatar Mar 26 '24 00:03 flekschas

Great!! you were right, the atrribute to use is lassoOnLongPress: true now works ok as your video. Thanks a lot.

And taking advantage to finalize this ticket, do you now what is the configuration to show a reticle in the canvas?

regards

masalinas avatar Apr 02 '24 10:04 masalinas

what is the configuration to show a reticle in the canvas?

this.scatterplot = createScatterplot({
  canvas,
  width,
  height,
  lassoOnLongPress: true,
  showReticle: true,
});

flekschas avatar Apr 03 '24 14:04 flekschas

I'm closing this issue as the problem appears to be addressed.

flekschas avatar Jun 01 '24 16:06 flekschas