mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-170615 No scrollbars in database diagram
IDEA-90162 Unlimited re-sizing in Diagrams when scrolling with Mouse Wheel
This commit is contained in:
+41
@@ -242,6 +242,10 @@ public final class IdeMouseEventDispatcher {
|
||||
return false; // forward mouse processing to the special shortcut panel
|
||||
}
|
||||
|
||||
if (doVerticalDiagramScrolling(c, e)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isHorizontalScrolling(c, e)) {
|
||||
boolean done = doHorizontalScrolling(c, (MouseWheelEvent)e);
|
||||
if (done) return true;
|
||||
@@ -312,6 +316,43 @@ public final class IdeMouseEventDispatcher {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean doVerticalDiagramScrolling(@Nullable Component component, @NotNull MouseEvent event) {
|
||||
if (component != null && event instanceof MouseWheelEvent && isDiagramViewComponent(component.getParent())) {
|
||||
MouseWheelEvent mwe = (MouseWheelEvent)event;
|
||||
if (!mwe.isShiftDown() && mwe.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL && JBScrollPane.isScrollEvent(mwe)) {
|
||||
JScrollBar scrollBar = findVerticalScrollBar(component);
|
||||
if (scrollBar != null) {
|
||||
scrollBar.setValue(scrollBar.getValue() + getScrollAmount(mwe, scrollBar));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static JScrollBar findVerticalScrollBar(@Nullable Component component) {
|
||||
if (component == null) {
|
||||
return null;
|
||||
}
|
||||
if (component instanceof JScrollPane) {
|
||||
JScrollBar scrollBar = ((JScrollPane)component).getVerticalScrollBar();
|
||||
return scrollBar != null && scrollBar.isVisible() ? scrollBar : null;
|
||||
}
|
||||
if (isDiagramViewComponent(component)) {
|
||||
JComponent view = (JComponent)component;
|
||||
for (int i = 0; i < view.getComponentCount(); i++) {
|
||||
if (view.getComponent(i) instanceof JScrollBar) {
|
||||
JScrollBar scrollBar = (JScrollBar)view.getComponent(i);
|
||||
if (scrollBar.getOrientation() == Adjustable.VERTICAL) {
|
||||
return scrollBar.isVisible() ? scrollBar : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return findVerticalScrollBar(component.getParent());
|
||||
}
|
||||
|
||||
public void resetHorScrollingTracker() {
|
||||
myLastHorScrolledComponentHash = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user