Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
af3
kernel
Commits
f15ecf9a
Commit
f15ecf9a
authored
10 years ago
by
Vincent Aravantinos
Browse files
Options
Downloads
Patches
Plain Diff
even better now
refs 2021
parent
f29e3c81
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/RectangleLayoutUtils.java
+15
-21
15 additions, 21 deletions
...g/fortiss/tooling/base/ui/utils/RectangleLayoutUtils.java
with
15 additions
and
21 deletions
org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/RectangleLayoutUtils.java
+
15
−
21
View file @
f15ecf9a
...
...
@@ -51,7 +51,7 @@ import org.fortiss.tooling.base.ui.dnd.gef.ElementDropContext;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash:
118735F6573C95F19DDFBB5B6CFAE4A1
* @ConQAT.Rating YELLOW Hash:
A26EFF7CA9FF0409292A918FCEED5947
*/
public
class
RectangleLayoutUtils
{
...
...
@@ -69,32 +69,26 @@ public class RectangleLayoutUtils {
*/
public
static
OffsetOrientation
calculateRectangleBorderOrientation
(
Point
source
,
Dimension
rectangleSize
,
int
inset
)
{
int
offset
=
0
;
EOrientation
orientation
=
NORTH
;
int
distToNorth
=
source
.
y
;
int
distToSouth
=
rectangleSize
.
height
-
source
.
y
-
2
*
inset
;
int
distToWest
=
source
.
x
;
int
distToEast
=
rectangleSize
.
width
-
source
.
x
-
2
*
inset
;
int
minDist
=
min
(
min
(
min
(
distToEast
,
distToNorth
),
distToWest
),
distToSouth
);
// The figure bounds
Rectangle
bounds
=
new
Rectangle
(
0
,
0
,
rectangleSize
.
width
,
rectangleSize
.
height
);
int
distanceToNorth
=
source
.
y
;
int
distanceToSouth
=
bounds
.
height
-
source
.
y
;
int
distanceToWest
=
source
.
x
;
int
distanceToEast
=
bounds
.
width
-
source
.
x
;
int
minDistance
=
min
(
min
(
min
(
distanceToEast
,
distanceToNorth
),
distanceToWest
),
distanceToSouth
);
// Determine in which sector we are and clamp the position accordingly
if
(
minDistance
==
distanceToNorth
)
{
int
offset
;
EOrientation
orientation
;
if
(
minDist
==
distToNorth
)
{
orientation
=
NORTH
;
offset
=
(
int
)(
source
.
x
*
(
1
-
(
2
*
inset
)
/
(
double
)
bounds
.
width
))
;
}
else
if
(
minDist
ance
==
dist
ance
ToWest
)
{
offset
=
source
.
x
;
}
else
if
(
minDist
==
distToWest
)
{
orientation
=
WEST
;
offset
=
(
int
)(
source
.
y
*
(
1
-
(
2
*
inset
)
/
(
double
)
bounds
.
height
))
;
}
else
if
(
minDist
ance
==
dist
ance
ToSouth
)
{
offset
=
source
.
y
;
}
else
if
(
minDist
==
distToSouth
)
{
orientation
=
SOUTH
;
offset
=
(
int
)(
source
.
x
*
(
1
-
(
2
*
inset
)
/
(
double
)
bounds
.
width
))
;
offset
=
source
.
x
;
}
else
{
orientation
=
EAST
;
offset
=
(
int
)(
source
.
y
*
(
1
-
(
2
*
inset
)
/
(
double
)
bounds
.
height
))
;
offset
=
source
.
y
;
}
return
createOffsetOrientation
(
offset
,
orientation
,
null
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment