Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
marty
marty-public
Commits
656d64f3
Commit
656d64f3
authored
Sep 28, 2021
by
Grégoire Uhlrich
Browse files
GRAFED curvature adapted int -> double
parent
43530fa4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
grafed/grafed-gui/edge.cpp
grafed/grafed-gui/edge.cpp
+7
-6
No files found.
grafed/grafed-gui/edge.cpp
View file @
656d64f3
...
@@ -128,14 +128,16 @@ qreal Edge::getCurvature() const
...
@@ -128,14 +128,16 @@ qreal Edge::getCurvature() const
void
Edge
::
setCurvature
(
double
t_curvature
)
void
Edge
::
setCurvature
(
double
t_curvature
)
{
{
double
max
=
1.99
;
double
max
=
2
;
double
step
=
1
/
50.
;
bool
less
=
std
::
fabs
(
2
*
t_curvature
)
<
std
::
fabs
(
curvature
)
;
curvature
=
2
*
t_curvature
;
curvature
=
2
*
t_curvature
;
if
(
curvature
>
max
)
if
(
curvature
>
max
)
curvature
=
max
;
curvature
=
max
;
else
if
(
curvature
<
-
max
)
else
if
(
curvature
<
-
max
)
curvature
=
-
max
;
curvature
=
-
max
;
if
(
std
::
abs
(
curvature
)
<
0.33
*
step
*
max
)
if
(
less
&&
std
::
fabs
(
curvature
)
<
0.1
)
curvature
=
0
;
else
if
(
std
::
fabs
(
curvature
)
<
0.01
)
curvature
=
0
;
curvature
=
0
;
graph
->
renderer
->
modificationDone
();
graph
->
renderer
->
modificationDone
();
update
();
update
();
...
@@ -689,9 +691,8 @@ void Edge::mouseDoubleClickEvent(QGraphicsSceneMouseEvent */*event*/)
...
@@ -689,9 +691,8 @@ void Edge::mouseDoubleClickEvent(QGraphicsSceneMouseEvent */*event*/)
void
Edge
::
wheelEventCustom
(
int
delta
)
void
Edge
::
wheelEventCustom
(
int
delta
)
{
{
if
(
hasFocusInGraph
())
{
if
(
hasFocusInGraph
())
{
double
max
=
1.99
;
double
step
=
0.002
*
1
/
(
1
+
std
::
pow
(
std
::
fabs
(
curvature
),
2
));
double
step
=
0.05
;
setCurvature
((
curvature
+
delta
*
step
)
/
2
);
setCurvature
((
curvature
+
delta
/
std
::
abs
(
delta
)
*
step
*
max
)
/
2
);
if
(
label
and
label
->
data
!=
""
)
if
(
label
and
label
->
data
!=
""
)
setName
(
label
->
data
);
setName
(
label
->
data
);
scene
()
->
update
();
scene
()
->
update
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment