Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
9
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
ita1024
semantik
Commits
d1fcda86
Commit
d1fcda86
authored
Apr 15, 2020
by
ita1024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the zoom system
parent
5f61b7fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
3 deletions
+31
-3
src/canvas_view.cpp
src/canvas_view.cpp
+15
-2
src/fig/box_view.cpp
src/fig/box_view.cpp
+16
-1
No files found.
src/canvas_view.cpp
View file @
d1fcda86
...
...
@@ -584,7 +584,7 @@ void canvas_view::notify_open_map() {
return
;
}
check_canvas_size
();
fit
InView
(
scene
()
->
sceneRect
(),
Qt
::
KeepAspectRatio
);
fit
_zoom
(
);
}
void
canvas_view
::
notify_select
(
const
QList
<
int
>&
unsel
,
const
QList
<
int
>&
sel
)
{
...
...
@@ -1038,7 +1038,20 @@ void canvas_view::fit_zoom()
}
else
{
fitInView
(
scene
()
->
sceneRect
(),
Qt
::
KeepAspectRatio
);
if
(
scene
()
->
items
().
size
())
{
QRectF
l_oRect
=
scene
()
->
items
().
at
(
0
)
->
sceneBoundingRect
();
foreach
(
QGraphicsItem
*
l_o
,
scene
()
->
items
())
{
if
(
!
l_o
->
isVisible
())
{
continue
;
}
l_oRect
|=
l_o
->
sceneBoundingRect
();
}
l_oRect
=
QRectF
(
l_oRect
.
topLeft
()
-
QPointF
(
PIPAD
,
PIPAD
),
l_oRect
.
bottomRight
()
+
QPointF
(
PIPAD
,
PIPAD
));
fitInView
(
l_oRect
,
Qt
::
KeepAspectRatio
);
}
}
}
...
...
src/fig/box_view.cpp
View file @
d1fcda86
...
...
@@ -295,6 +295,8 @@ box_view::box_view(QWidget *i_oWidget, sem_mediator *i_oControl) : QGraphicsView
m_oMenu
=
NULL
;
setMouseTracking
(
true
);
setBackgroundBrush
(
Qt
::
white
);
}
void
box_view
::
init_menu
()
...
...
@@ -1462,7 +1464,20 @@ void box_view::fit_zoom()
}
else
{
fitInView
(
scene
()
->
sceneRect
(),
Qt
::
KeepAspectRatio
);
if
(
scene
()
->
items
().
size
())
{
QRectF
l_oRect
=
scene
()
->
items
().
at
(
0
)
->
sceneBoundingRect
();
foreach
(
QGraphicsItem
*
l_o
,
scene
()
->
items
())
{
if
(
!
l_o
->
isVisible
())
{
continue
;
}
l_oRect
|=
l_o
->
sceneBoundingRect
();
}
l_oRect
=
QRectF
(
l_oRect
.
topLeft
()
-
QPointF
(
PIPAD
,
PIPAD
),
l_oRect
.
bottomRight
()
+
QPointF
(
PIPAD
,
PIPAD
));
fitInView
(
l_oRect
,
Qt
::
KeepAspectRatio
);
}
}
}
...
...
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