Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 168984 Details for
Bug 313144
ViewportAwareConnectionLayerClippingStrategy: connection not rendered if anchor on right/bottom border
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch to fix both reported problems within ViewportAwareConnectionLayerClippingStrategy
313144.txt (text/plain), 5.89 KB, created by
Alexander Nyßen
on 2010-05-18 13:58:14 EDT
(
hide
)
Description:
Patch to fix both reported problems within ViewportAwareConnectionLayerClippingStrategy
Filename:
MIME Type:
Creator:
Alexander Nyßen
Created:
2010-05-18 13:58:14 EDT
Size:
5.89 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.draw2d >Index: src/org/eclipse/draw2d/ViewportAwareConnectionLayerClippingStrategy.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.draw2d/src/org/eclipse/draw2d/ViewportAwareConnectionLayerClippingStrategy.java,v >retrieving revision 1.1 >diff -u -r1.1 ViewportAwareConnectionLayerClippingStrategy.java >--- src/org/eclipse/draw2d/ViewportAwareConnectionLayerClippingStrategy.java 17 May 2010 15:35:39 -0000 1.1 >+++ src/org/eclipse/draw2d/ViewportAwareConnectionLayerClippingStrategy.java 18 May 2010 17:56:56 -0000 >@@ -3,13 +3,14 @@ > import java.util.Iterator; > import java.util.List; > >+import org.eclipse.draw2d.geometry.Insets; > import org.eclipse.draw2d.geometry.PointList; > import org.eclipse.draw2d.geometry.Rectangle; > > /** >- * Clipping strategy for connection layer, which takes into account nested >- * view ports and truncates those parts of connections which reach outside >- * and are thus not visible. >+ * Clipping strategy for connection layer, which takes into account nested view >+ * ports and truncates those parts of connections which reach outside and are >+ * thus not visible. > * > * @author Alexander Nyssen > * @author Philip Ritzkopf >@@ -19,6 +20,8 @@ > public class ViewportAwareConnectionLayerClippingStrategy implements > IClippingStrategy { > >+ private static final Insets PRIVATE_INSETS = new Insets(0, 0, 1, 1); >+ > private ConnectionLayer connectionLayer = null; > > public ViewportAwareConnectionLayerClippingStrategy( >@@ -46,8 +49,8 @@ > } > > /** >- * Computes clipping rectangle(s) for a given connection. Will consider >- * all enclosing viewports, excluding the root viewport. >+ * Computes clipping rectangle(s) for a given connection. Will consider all >+ * enclosing viewports, excluding the root viewport. > */ > protected Rectangle[] getEdgeClippingRectangle(Connection connection) { > // start with clipping the connection at its original bounds >@@ -80,7 +83,8 @@ > .getParent())); > } > >- // if the nearest common viewport of source and target is not simultaneously >+ // if the nearest common viewport of source and target is not >+ // simultaneously > // the nearest enclosing viewport of source and target respectively, the > // connection has to be further clipped (the connection may even not be > // visible at all) >@@ -94,21 +98,25 @@ > // itself be nested in other viewports). > Rectangle sourceClipRect = getAbsoluteBoundsAsCopy(sourceFigure); > if (nearestEnclosingSourceViewport != nearestEnclosingCommonViewport) { >- clipAtViewports(sourceClipRect, ViewportUtilities >- .getViewportsPath(nearestEnclosingSourceViewport, >+ clipAtViewports(sourceClipRect, >+ ViewportUtilities.getViewportsPath( >+ nearestEnclosingSourceViewport, > nearestEnclosingCommonViewport, false)); > } > Rectangle targetClipRect = getAbsoluteBoundsAsCopy(targetFigure); > if (nearestEnclosingTargetViewport != nearestEnclosingCommonViewport) { >- clipAtViewports(targetClipRect, ViewportUtilities >- .getViewportsPath(nearestEnclosingTargetViewport, >+ clipAtViewports(targetClipRect, >+ ViewportUtilities.getViewportsPath( >+ nearestEnclosingTargetViewport, > nearestEnclosingCommonViewport, false)); > } > PointList absolutePointsAsCopy = getAbsolutePointsAsCopy(connection); >- boolean sourceAnchorVisible = sourceClipRect >- .contains(absolutePointsAsCopy.getFirstPoint()); >- boolean targetAnchorVisible = targetClipRect >- .contains(absolutePointsAsCopy.getLastPoint()); >+ boolean sourceAnchorVisible = sourceClipRect.getExpanded( >+ PRIVATE_INSETS).contains( >+ absolutePointsAsCopy.getFirstPoint()); >+ boolean targetAnchorVisible = targetClipRect.getExpanded( >+ PRIVATE_INSETS).contains( >+ absolutePointsAsCopy.getLastPoint()); > > if (!sourceAnchorVisible || !targetAnchorVisible) { > // one (or both) of source or target anchor is invisible >@@ -136,8 +144,8 @@ > } > > /** >- * Computes clipping rectangle for a given (node) figure. Will consider >- * all enclosing viewports, excluding the root viewport. >+ * Computes clipping rectangle for a given (node) figure. Will consider all >+ * enclosing viewports, excluding the root viewport. > */ > protected Rectangle getNodeClippingRectangle(IFigure figure) { > // start with the bounds of the edit part's figure >@@ -160,8 +168,8 @@ > List enclosingViewportsPath) { > for (Iterator iterator = enclosingViewportsPath.iterator(); iterator > .hasNext();) { >- clipRect.intersect(getAbsoluteViewportClientAreaAsCopy((Viewport) iterator >- .next())); >+ Viewport viewport = (Viewport) iterator.next(); >+ clipRect.intersect(getAbsoluteViewportAreaAsCopy(viewport)); > } > } > >@@ -171,8 +179,7 @@ > * viewport of primary and connection layer. > */ > protected Viewport getRootViewport() { >- return ViewportUtilities >- .getNearestEnclosingViewport(connectionLayer); >+ return ViewportUtilities.getNearestEnclosingViewport(connectionLayer); > } > > /** >@@ -185,10 +192,23 @@ > } > > /** >+ * Returns the area covered by the viewport in absolute coordinates. >+ */ >+ protected Rectangle getAbsoluteViewportAreaAsCopy(Viewport viewport) { >+ Rectangle absoluteViewportArea = null; >+ if (viewport.getParent().getBorder() != null >+ && viewport.getParent().getBorder().isOpaque()) { >+ absoluteViewportArea = getAbsoluteViewportClientAreaAsCopy(viewport); >+ } else { >+ absoluteViewportArea = getAbsoluteBoundsAsCopy(viewport.getParent()); >+ } >+ return absoluteViewportArea; >+ } >+ >+ /** > * Returns the viewport's client area in absolute coordinates. > */ >- protected Rectangle getAbsoluteViewportClientAreaAsCopy( >- Viewport viewport) { >+ protected Rectangle getAbsoluteViewportClientAreaAsCopy(Viewport viewport) { > Rectangle absoluteClientArea = viewport.getClientArea(); > viewport.translateToParent(absoluteClientArea); > viewport.translateToAbsolute(absoluteClientArea);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 313144
: 168984