Skip to content

Draggable Scaatter, Signal, SignalXY (CoordinatedHeatmap)#1111

Closed
StendProg wants to merge 10 commits intoScottPlot:masterfrom
StendProg:DraggableSignals
Closed

Draggable Scaatter, Signal, SignalXY (CoordinatedHeatmap)#1111
StendProg wants to merge 10 commits intoScottPlot:masterfrom
StendProg:DraggableSignals

Conversation

@StendProg
Copy link
Contributor

@StendProg StendProg commented Jun 3, 2021

Work In Progress

Purpose:
Implement IDraggableModern interface for Scatter, Signal, SignalXY (CoordinatedHeatmap). #1002

Early shared, I plan to add some work, but can do it only after weekend, and there is some question i want to discuss.
Questions to discuss:

  1. IDraggableModern - is working title. We need to come up with a suitable name. On the other hand, We can absorb the existing IDraggable. Only Span for now use this old interface. With such a takeover, backward compatibility of users may be broken, or maybe not, they seem to not use DragTo() directly.
  2. Drag(double fromX, double toX, double fromY, double toY, ...) can be transformed to
    Drag(double offsetX, double offsetY). Initially, I thought that the starting point might be useful in the handler, but in fact it was never used.
  3. If plot dimensions additionaly are passed to IsUnderMouse(), then it will be possible to carry out additional optimizations by collapsing a set of points into one column for Signals, as is done during rendering. Although, oddly enough, on the test signals, I did not notice any performance problems with the current implementation.
  4. The scatter, oddly enough, has no offsets (OffsetX, OffsetY). So dragging happens through modifying the original (XS, YS) arrays. Which leads to funny effects. In the demo, many scatters have a common XS array, and when you drag one, all the others are dragged, but only in X. I think it would be a good idea to implement Offsets for the Scatter, and rewrite the drag to change offsets as it is done for signals. But this task is best solved in a separate PR.
  5. For now all signals, scatters, DragEnabled by default for test porpouse. It would be nice to make separate demos for new Plottable. Then we can turn off the default DragEnabled.
  6. For dragging, I selected the existing hand cursor. Maybe we can think of something more interesting.

What do I plan to finish in this PR:

  1. ✔️ implement the algorithm for intersection the cursor with the line for the scatter in the same way as for signals. I started with a scatter, and found a more efficient algorithm on the signals.
  2. ✔️ Do not search for intersections with lines if the display of lines is disabled.
  3. ✔️ Think about how to reduce the duplication of the intersection code for different Plottables.
  4. ✔️ Write tests for intersection algorithms.
  5. ✔️ Add xml documentation to methods and fields.
  6. Make Demo.

New Functionality:

signal = Plot.AddSignalXY(xs, ys);
signal.DragEnabled = true;

DraggableSignals

@swharden
Copy link
Member

I'm going to close this PR since it's unlikely to be merged soon, but there is active discussion about this PR in #1002 (comment)

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

Successfully merging this pull request may close these issues.

2 participants