Skip to content

Commit

Permalink
Minor bug-fixes
Browse files Browse the repository at this point in the history
 - Fix zoom out bug on NPX 2.0 4-shank
 - Fix zoomed electrodes not lining up with the selected region
 - Add support for scrolling in zoomed view
  • Loading branch information
anjaldoshi committed Nov 19, 2022
1 parent aba402e commit 0e6b9c1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
28 changes: 22 additions & 6 deletions Source/UI/ProbeBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ ProbeBrowser::ProbeBrowser(NeuropixInterface* parent_) : parent(parent_)

if (parent->probeMetadata.shank_count == 4)
{
maxZoomHeight = 250;
minZoomHeight = 40;
defaultZoomHeight = 100;
pixelHeight = 1;
defaultZoomHeight = 80;
}

// ALSO CONFIGURE CHANNEL JUMP
Expand Down Expand Up @@ -581,6 +578,26 @@ void ProbeBrowser::mouseDrag(const MouseEvent& event)
}


void ProbeBrowser::mouseWheelMove(const MouseEvent &event, const MouseWheelDetails& wheel)
{
if (event.x > 100 && event.x < 450)
{

if (wheel.deltaY > 0)
zoomOffset += 2;
else
zoomOffset -= 2;

if (zoomOffset > lowerBound - zoomHeight - 15)
zoomOffset = lowerBound - zoomHeight - 15;
else if (zoomOffset < 0)
zoomOffset = 0;

repaint();
}
}


MouseCursor ProbeBrowser::getMouseCursor()
{
MouseCursor c = MouseCursor(cursorType);
Expand Down Expand Up @@ -672,8 +689,7 @@ void ProbeBrowser::paint(Graphics& g)

zoomAreaMinRow = int(lowestRow);

float totalHeight = float(lowerBound + 100);
electrodeHeight = totalHeight / (highestRow - lowestRow);
electrodeHeight = lowerBound / (highestRow - lowestRow);

//std::cout << "Lowest row: " << lowestRow << ", highest row: " << highestRow << std::endl;
//std::cout << "Zoom offset: " << zoomOffset << ", Zoom height: " << zoomHeight << std::endl;
Expand Down
2 changes: 2 additions & 0 deletions Source/UI/ProbeBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class ProbeBrowser : public Component,
void mouseDown(const MouseEvent& event);
void mouseDrag(const MouseEvent& event);
void mouseUp(const MouseEvent& event);
void mouseWheelMove(const MouseEvent& event, const MouseWheelDetails& wheel);

MouseCursor getMouseCursor();

void timerCallback();
Expand Down

0 comments on commit 0e6b9c1

Please sign in to comment.