Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
2f5103bc
Commit
2f5103bc
authored
May 13, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed jumpy zoom when hotkeys and scroll wheel were used alternatively.
parent
50193f17
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
22 deletions
+12
-22
wx_view_controls.cpp
common/view/wx_view_controls.cpp
+2
-2
pcbnew_control.cpp
pcbnew/tools/pcbnew_control.cpp
+10
-20
No files found.
common/view/wx_view_controls.cpp
View file @
2f5103bc
...
@@ -160,12 +160,12 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
...
@@ -160,12 +160,12 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
// Set scaling speed depending on scroll wheel event interval
// Set scaling speed depending on scroll wheel event interval
if
(
timeDiff
<
500
&&
timeDiff
>
0
)
if
(
timeDiff
<
500
&&
timeDiff
>
0
)
{
{
zoomScale
=
(
aEvent
.
GetWheelRotation
()
>
0
.0
)
?
2.05
-
timeDiff
/
500
:
zoomScale
=
(
aEvent
.
GetWheelRotation
()
>
0
)
?
2.05
-
timeDiff
/
500
:
1.0
/
(
2.05
-
timeDiff
/
500
);
1.0
/
(
2.05
-
timeDiff
/
500
);
}
}
else
else
{
{
zoomScale
=
(
aEvent
.
GetWheelRotation
()
>
0
.0
)
?
1.05
:
0.95
;
zoomScale
=
(
aEvent
.
GetWheelRotation
()
>
0
)
?
1.05
:
0.95
;
}
}
VECTOR2D
anchor
=
m_view
->
ToWorld
(
VECTOR2D
(
aEvent
.
GetX
(),
aEvent
.
GetY
()
)
);
VECTOR2D
anchor
=
m_view
->
ToWorld
(
VECTOR2D
(
aEvent
.
GetX
(),
aEvent
.
GetY
()
)
);
...
...
pcbnew/tools/pcbnew_control.cpp
View file @
2f5103bc
...
@@ -61,17 +61,14 @@ bool PCBNEW_CONTROL::Init()
...
@@ -61,17 +61,14 @@ bool PCBNEW_CONTROL::Init()
int
PCBNEW_CONTROL
::
ZoomInOut
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
ZoomInOut
(
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
KIGFX
::
GAL
*
gal
=
m_frame
->
GetGalCanvas
()
->
GetGAL
()
;
double
zoomScale
=
1.0
;
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
zoomIn
)
)
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
zoomIn
)
)
m_frame
->
SetPrevZoom
()
;
zoomScale
=
1.3
;
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
zoomOut
)
)
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
zoomOut
)
)
m_frame
->
SetNextZoom
();
zoomScale
=
0.7
;
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
double
zoom
=
1.0
/
(
zoomFactor
*
m_frame
->
GetZoom
()
);
view
->
SetScale
(
zoom
,
getViewControls
()
->
GetCursorPosition
()
);
view
->
SetScale
(
view
->
GetScale
()
*
zoomScale
,
getViewControls
()
->
GetCursorPosition
()
);
setTransitions
();
setTransitions
();
return
0
;
return
0
;
...
@@ -81,17 +78,14 @@ int PCBNEW_CONTROL::ZoomInOut( TOOL_EVENT& aEvent )
...
@@ -81,17 +78,14 @@ int PCBNEW_CONTROL::ZoomInOut( TOOL_EVENT& aEvent )
int
PCBNEW_CONTROL
::
ZoomInOutCenter
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
ZoomInOutCenter
(
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
KIGFX
::
GAL
*
gal
=
m_frame
->
GetGalCanvas
()
->
GetGAL
();
double
zoomScale
=
1.0
;
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
zoomInCenter
)
)
m_frame
->
SetPrevZoom
();
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
zoomOutCenter
)
)
m_frame
->
SetNextZoom
();
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
zoomIn
)
)
double
zoom
=
1.0
/
(
zoomFactor
*
m_frame
->
GetZoom
()
);
zoomScale
=
1.3
;
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
zoomOut
)
)
zoomScale
=
0.7
;
view
->
SetScale
(
zoom
);
view
->
SetScale
(
view
->
GetScale
()
*
zoomScale
);
setTransitions
();
setTransitions
();
return
0
;
return
0
;
...
@@ -119,10 +113,6 @@ int PCBNEW_CONTROL::ZoomFitScreen( TOOL_EVENT& aEvent )
...
@@ -119,10 +113,6 @@ int PCBNEW_CONTROL::ZoomFitScreen( TOOL_EVENT& aEvent )
double
iuPerY
=
screenSize
.
y
?
boardBBox
.
GetHeight
()
/
screenSize
.
y
:
1.0
;
double
iuPerY
=
screenSize
.
y
?
boardBBox
.
GetHeight
()
/
screenSize
.
y
:
1.0
;
double
bestZoom
=
std
::
max
(
iuPerX
,
iuPerY
);
double
bestZoom
=
std
::
max
(
iuPerX
,
iuPerY
);
// This is needed to avoid "jumpy" zooms if first hot key was used and then mouse scroll
// (or other way round).
m_frame
->
GetScreen
()
->
SetZoom
(
bestZoom
);
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
double
zoom
=
1.0
/
(
zoomFactor
*
bestZoom
);
double
zoom
=
1.0
/
(
zoomFactor
*
bestZoom
);
...
...
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