Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
ff4aaf4f
Commit
ff4aaf4f
authored
Aug 01, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store zoom factor and lock quaternion changes
parent
12da0a83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
panel.py
printrun/gl/panel.py
+10
-1
No files found.
printrun/gl/panel.py
View file @
ff4aaf4f
...
...
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
from
threading
import
Lock
import
wx
from
wx
import
glcanvas
...
...
@@ -51,6 +53,10 @@ class wxGLPanel(wx.Panel):
self
.
sizer
.
Add
(
self
.
canvas
,
1
,
wx
.
EXPAND
)
self
.
SetSizerAndFit
(
self
.
sizer
)
self
.
rot_lock
=
Lock
()
self
.
basequat
=
[
0
,
0
,
0
,
1
]
self
.
zoom_factor
=
1.0
# bind events
self
.
canvas
.
Bind
(
wx
.
EVT_ERASE_BACKGROUND
,
self
.
processEraseBackgroundEvent
)
self
.
canvas
.
Bind
(
wx
.
EVT_SIZE
,
self
.
processSizeEvent
)
...
...
@@ -144,6 +150,7 @@ class wxGLPanel(wx.Panel):
glLoadIdentity
()
if
self
.
orthographic
:
ratio
=
factor
*
float
(
min
(
self
.
width
,
self
.
height
))
/
self
.
dist
self
.
zoom_factor
=
1.0
glScalef
(
ratio
,
ratio
,
1
)
def
OnDraw
(
self
,
*
args
,
**
kwargs
):
...
...
@@ -197,6 +204,7 @@ class wxGLPanel(wx.Panel):
delta_y
=
to
[
1
]
glTranslatef
(
delta_x
,
delta_y
,
0
)
glScalef
(
factor
,
factor
,
1
)
self
.
zoom_factor
*=
factor
if
to
:
glTranslatef
(
-
delta_x
,
-
delta_y
,
0
)
wx
.
CallAfter
(
self
.
Refresh
)
...
...
@@ -218,7 +226,8 @@ class wxGLPanel(wx.Panel):
p2x
=
float
(
p2
[
0
])
/
(
sz
[
0
]
/
2
)
-
1
p2y
=
1
-
float
(
p2
[
1
])
/
(
sz
[
1
]
/
2
)
quat
=
trackball
(
p1x
,
p1y
,
p2x
,
p2y
,
self
.
dist
/
250.0
)
self
.
basequat
=
mulquat
(
self
.
basequat
,
quat
)
with
self
.
rot_lock
:
self
.
basequat
=
mulquat
(
self
.
basequat
,
quat
)
self
.
initpos
=
p2
def
handle_translation
(
self
,
event
):
...
...
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