Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X cut doesn't match what's on screen #103

Open
kmun opened this issue May 4, 2021 · 4 comments
Open

X cut doesn't match what's on screen #103

kmun opened this issue May 4, 2021 · 4 comments

Comments

@kmun
Copy link

kmun commented May 4, 2021

Describe the bug
Performing an X-Cut in a raster appears to go to the next trace instead of the current one.

To Reproduce

Steps to reproduce the behavior:

  1. Create a raster plot with 3 distinct traces. By default the Y axis should be numbered 0, .5, 1, 1.5, 2, 2.5, 3.
  2. Verify the first trace is a rectangle starting at 0 and ending at 1 on the Y axis, and the second is from 1 to 2 and third from 2 to 3.
  3. Move your mouse to below the 0.5 on the Y axis and press X to perform an X cut
  4. Verify the X-Cut matches the first trace
  5. Press X again to exit the X-Cut
  6. Move your mouse to above the 0.5 on the Y axis and press X to perform an X cut
  7. Verify the X-Cut now matches the second trace, even though the mouse was physically on the 1st trace.

Expected behavior
I would think the X-Cut should match the trace under the cursor when you press the X key, it appears to round up so at 0.5 Y index it prints trace 1 and at 1.5 Y index it prints trace 2.

jsFiddle

If possible, demonstrate the issue by forking this jsFiddle and providing a link to your jsFiddle in the bug report.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@maihde
Copy link
Contributor

maihde commented May 11, 2021

@kmun the xCut (and yCut/pCut) logic has always been hardcoded to assume one raster layer.

Gx.x_cut_data = Gx.lyr[0].buf.slice(start, finish);
.

Do you have a specific use-case for this or was it just something you found while playing around?

I think the correct behavior is that each raster layer turns into it's own line (with a different color per raster layer). That way if you had overlapping rasters you could make cuts and see each layer.

@kmun
Copy link
Author

kmun commented May 18, 2021

sorry, I should have explained better. In my case I don't have a lot of raster "lines"; as an example, in a plot there may only be 6 raster lines so each line is about 1 inch wide on my screen. If I'm at the top of the 1 inch wide line it shows the x cut properly, if I'm anywhere after 50% into the 1 inch line it shows the x cut for the NEXT raster line. I do use this a lot. Most of my plots contain less than 20 lines and since the window is about 10 inches tall on my display, that's a 1/2 inch wide line. Most of my users will put the curser in vertical and horizontal center of the line which means they will often be viewing the next line when doing an X cut. I've included a REALLY BAD powerpoint diagram trying to show the issue. I can't upload a real plot for security reasons. Sorry. BTW, thanks for the follow up.

Example of X-Cut issue

@maihde
Copy link
Contributor

maihde commented May 21, 2021 via email

@maihde
Copy link
Contributor

maihde commented May 21, 2021

@kmun I don't know what version of SigPlot you are running, but I have fixed the issue here:

spectriclabs@01b06a0

If you are able to run the master branch from spectriclabs/sigplot then it will include the fix.

The good news is, the fix is very easy, so you should be able to port it into whatever version you are running by altering these lines:

var row = Math.round((ypos - Gx.lyr[0].ystart) / Gx.lyr[0].ydelta);

var col = Math.round((xpos - Gx.lyr[0].xstart) / Gx.lyr[0].xdelta);

maihde added a commit to spectriclabs/sigplot that referenced this issue May 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants