diff options
| author | Matthias Becker | 2021-03-25 07:51:26 +0000 |
|---|---|---|
| committer | Matthias Becker | 2021-04-12 08:42:49 +0000 |
| commit | b585373207295d55344a5f6e87a75ef2458acb67 (patch) | |
| tree | 73b0107491605f69c9c5bed913aedef4a9942a01 | |
| parent | a0b3b60c1440b7e48d8bfb4f0698b4632158a71c (diff) | |
| download | eclipse.platform.ui-b585373207295d55344a5f6e87a75ef2458acb67.tar.gz eclipse.platform.ui-b585373207295d55344a5f6e87a75ef2458acb67.tar.xz eclipse.platform.ui-b585373207295d55344a5f6e87a75ef2458acb67.zip | |
Bug 563497: Vertical menu bar handles are stretched
The handle image was stretched to the width of the toolbar if the
vertical toolbar is wider then the handle image. This can easily be seen
for the "File" toolbar. This toolbar contains an item that has
a big width (30px) as it has a drop down. The handle image is 22px
wide. This 22px was stretched to 30px.
The same is true for horizontal toolbars. If the handle icon's height is
smaller then the height of the toolbar it was stretched. We did not see
this up to now because the height of the handle was identical to the
height of the toolbar.
This change now no longer stretches the handle image and centers it
horizontally / vertical.
Change-Id: Ieb104c4b4672db2b165e6ccbfcc9cf1c766e3dca
| -rw-r--r-- | bundles/org.eclipse.e4.ui.widgets/src/org/eclipse/e4/ui/widgets/ImageBasedFrame.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/bundles/org.eclipse.e4.ui.widgets/src/org/eclipse/e4/ui/widgets/ImageBasedFrame.java b/bundles/org.eclipse.e4.ui.widgets/src/org/eclipse/e4/ui/widgets/ImageBasedFrame.java index 1529824cddc..45a3da92e5c 100644 --- a/bundles/org.eclipse.e4.ui.widgets/src/org/eclipse/e4/ui/widgets/ImageBasedFrame.java +++ b/bundles/org.eclipse.e4.ui.widgets/src/org/eclipse/e4/ui/widgets/ImageBasedFrame.java @@ -196,9 +196,16 @@ public class ImageBasedFrame extends Canvas { srcRect.y = 0; srcRect.width = handle.getBounds().width; srcRect.height = handle.getBounds().height; - dstRect.x = w1; + + // handle should not be stretched + // center the handle if width of "inner" > width of handle + if (inner.x >= srcRect.width) { + dstRect.x = (inner.x - srcRect.width) / 2; + } else { + dstRect.x = w1; + } dstRect.y = h1; - dstRect.width = inner.x; + dstRect.width = srcRect.width; dstRect.height = handleHeight; e.gc.drawImage(handle, srcRect.x, srcRect.y, srcRect.width, srcRect.height, dstRect.x, dstRect.y, dstRect.width, @@ -238,9 +245,15 @@ public class ImageBasedFrame extends Canvas { srcRect.width = handle.getBounds().width; srcRect.height = handle.getBounds().height; dstRect.x = w1; - dstRect.y = h1; + // handle should not be stretched + // center the handle if height of "inner" > height of handle + if (inner.y >= srcRect.height) { + dstRect.y = (inner.y - srcRect.height) / 2; + } else { + dstRect.y = h1; + } dstRect.width = handleWidth; - dstRect.height = inner.y; + dstRect.height = srcRect.height; e.gc.drawImage(handle, srcRect.x, srcRect.y, srcRect.width, srcRect.height, dstRect.x, dstRect.y, dstRect.width, dstRect.height); |
