-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Allow controlling pan/zoom range entry. #1389
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,36 +153,39 @@ fx.init = function(gd) { | |
}; | ||
|
||
// corner draggers | ||
dragBox(gd, plotinfo, -DRAGGERSIZE, -DRAGGERSIZE, | ||
DRAGGERSIZE, DRAGGERSIZE, 'n', 'w'); | ||
dragBox(gd, plotinfo, xa._length, -DRAGGERSIZE, | ||
DRAGGERSIZE, DRAGGERSIZE, 'n', 'e'); | ||
dragBox(gd, plotinfo, -DRAGGERSIZE, ya._length, | ||
DRAGGERSIZE, DRAGGERSIZE, 's', 'w'); | ||
dragBox(gd, plotinfo, xa._length, ya._length, | ||
DRAGGERSIZE, DRAGGERSIZE, 's', 'e'); | ||
} | ||
|
||
// x axis draggers - if you have overlaid plots, | ||
// these drag each axis separately | ||
if(isNumeric(y0)) { | ||
if(xa.anchor === 'free') y0 -= fullLayout._size.h * (1 - ya.domain[1]); | ||
dragBox(gd, plotinfo, xa._length * 0.1, y0, | ||
xa._length * 0.8, DRAGGERSIZE, '', 'ew'); | ||
dragBox(gd, plotinfo, 0, y0, | ||
xa._length * 0.1, DRAGGERSIZE, '', 'w'); | ||
dragBox(gd, plotinfo, xa._length * 0.9, y0, | ||
xa._length * 0.1, DRAGGERSIZE, '', 'e'); | ||
if(gd._context.showAxisDragHandles) { | ||
dragBox(gd, plotinfo, -DRAGGERSIZE, -DRAGGERSIZE, | ||
DRAGGERSIZE, DRAGGERSIZE, 'n', 'w'); | ||
dragBox(gd, plotinfo, xa._length, -DRAGGERSIZE, | ||
DRAGGERSIZE, DRAGGERSIZE, 'n', 'e'); | ||
dragBox(gd, plotinfo, -DRAGGERSIZE, ya._length, | ||
DRAGGERSIZE, DRAGGERSIZE, 's', 'w'); | ||
dragBox(gd, plotinfo, xa._length, ya._length, | ||
DRAGGERSIZE, DRAGGERSIZE, 's', 'e'); | ||
} | ||
} | ||
// y axis draggers | ||
if(isNumeric(x0)) { | ||
if(ya.anchor === 'free') x0 -= fullLayout._size.w * xa.domain[0]; | ||
dragBox(gd, plotinfo, x0, ya._length * 0.1, | ||
DRAGGERSIZE, ya._length * 0.8, 'ns', ''); | ||
dragBox(gd, plotinfo, x0, ya._length * 0.9, | ||
DRAGGERSIZE, ya._length * 0.1, 's', ''); | ||
dragBox(gd, plotinfo, x0, 0, | ||
DRAGGERSIZE, ya._length * 0.1, 'n', ''); | ||
if(gd._context.showAxisDragHandles) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great! Before merging, we'll need to add a few test cases to 🔒 this down. In Let me know if you have any questions! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got some tests added. |
||
// x axis draggers - if you have overlaid plots, | ||
// these drag each axis separately | ||
if(isNumeric(y0)) { | ||
if(xa.anchor === 'free') y0 -= fullLayout._size.h * (1 - ya.domain[1]); | ||
dragBox(gd, plotinfo, xa._length * 0.1, y0, | ||
xa._length * 0.8, DRAGGERSIZE, '', 'ew'); | ||
dragBox(gd, plotinfo, 0, y0, | ||
xa._length * 0.1, DRAGGERSIZE, '', 'w'); | ||
dragBox(gd, plotinfo, xa._length * 0.9, y0, | ||
xa._length * 0.1, DRAGGERSIZE, '', 'e'); | ||
} | ||
// y axis draggers | ||
if(isNumeric(x0)) { | ||
if(ya.anchor === 'free') x0 -= fullLayout._size.w * xa.domain[0]; | ||
dragBox(gd, plotinfo, x0, ya._length * 0.1, | ||
DRAGGERSIZE, ya._length * 0.8, 'ns', ''); | ||
dragBox(gd, plotinfo, x0, ya._length * 0.9, | ||
DRAGGERSIZE, ya._length * 0.1, 's', ''); | ||
dragBox(gd, plotinfo, x0, 0, | ||
DRAGGERSIZE, ya._length * 0.1, 'n', ''); | ||
} | ||
} | ||
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A straight-up boolean is fine for now.
I'm thinking down the road, we could allow users to specify which drag handles to show for example:
would only show the north (or top) and south (or bottom) dragger.
But that's for another day. 👍