You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2021/01/23 08:55:46 UTC
[incubator-hop] branch master updated: HOP-2403 : Context dialog
has problems when using the scrollbar
This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git
The following commit(s) were added to refs/heads/master by this push:
new ff2f36e HOP-2403 : Context dialog has problems when using the scrollbar
new afa0f85 Merge pull request #577 from mattcasters/master
ff2f36e is described below
commit ff2f36e56cab334bbd55b7b34a778179387e6060
Author: Matt Casters <ma...@gmail.com>
AuthorDate: Fri Jan 22 16:29:24 2021 +0100
HOP-2403 : Context dialog has problems when using the scrollbar
---
.../apache/hop/ui/core/dialog/ContextDialog.java | 31 +++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java b/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java
index 65c12c4..38f321a 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java
@@ -36,6 +36,7 @@ import org.apache.hop.ui.core.gui.GuiResource;
import org.apache.hop.ui.core.gui.GuiToolbarWidgets;
import org.apache.hop.ui.core.gui.HopNamespace;
import org.apache.hop.ui.core.gui.WindowProperty;
+import org.apache.hop.ui.core.widget.OsHelper;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
import org.apache.hop.ui.util.EnvironmentUtils;
import org.apache.hop.ui.util.SwtSvgImageUtil;
@@ -511,6 +512,30 @@ public class ContextDialog extends Dialog {
}
wCanvas.addKeyListener(keyAdapter);
+ // If the shell is re-sized we need to recalculate things...
+ //
+ shell.addListener(
+ SWT.Resize,
+ e -> {
+ shell.layout(true, true);
+ totalContentHeight = 0;
+ previousTotalContentHeight = 0;
+ wCanvas.redraw();
+ updateVerticalBar();
+ });
+
+ // OS Specific listeners...
+ //
+ if (OsHelper.isWindows()) {
+ wScrolledComposite
+ .getVerticalBar()
+ .addListener(
+ SWT.Selection,
+ e -> {
+ wCanvas.redraw();
+ });
+ }
+
// Layout all the widgets in the shell.
//
shell.layout();
@@ -747,7 +772,11 @@ public class ContextDialog extends Dialog {
if (totalContentHeight > scrolledCompositeBounds.height) {
heightOffSet =
- totalContentHeight * verticalBar.getSelection() / (100 - verticalBar.getThumb());
+ (int)
+ Math.floor(
+ (float) totalContentHeight
+ * verticalBar.getSelection()
+ / (100 - verticalBar.getThumb()));
} else {
heightOffSet = 0;
}