Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
purr-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Jonathan Wilkes
purr-data
Commits
6650e37a
Commit
6650e37a
authored
8 years ago
by
Albert Gräf
Browse files
Options
Downloads
Patches
Plain Diff
Make complex scalar selection rectangles work, partial fix for
#162
.
parent
da35b87a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!37
Make complex scalar selection rectangles work, partial fix for #162.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pd/src/g_scalar.c
+28
-10
28 additions, 10 deletions
pd/src/g_scalar.c
with
28 additions
and
10 deletions
pd/src/g_scalar.c
+
28
−
10
View file @
6650e37a
...
...
@@ -544,20 +544,38 @@ void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state)
scalar_getbasexy
(
x
,
&
basex
,
&
basey
);
scalar_getrect
(
&
x
->
sc_gobj
,
glist
,
&
x1
,
&
y1
,
&
x2
,
&
y2
);
x1
--
;
x2
++
;
y1
--
;
y2
++
;
if
(
glist_istoplevel
(
glist
))
{
t_float
xscale
=
glist_xtopixels
(
glist
,
1
)
-
glist_xtopixels
(
glist
,
0
);
t_float
yscale
=
glist_ytopixels
(
glist
,
1
)
-
glist_ytopixels
(
glist
,
0
);
gui_vmess
(
"gui_scalar_draw_select_rect"
,
"xsiiiiiff"
,
t_float
xorig
=
glist_xtopixels
(
glist
,
0
);
t_float
yorig
=
glist_ytopixels
(
glist
,
0
);
t_float
xscale
=
glist_xtopixels
(
glist
,
1
)
-
xorig
;
t_float
yscale
=
glist_ytopixels
(
glist
,
1
)
-
yorig
;
// the bbox is in scaled canvas coordinates, but
// gui_scalar_draw_select_rect expects them in unscaled units, so
// we undo the scaling (as well as the translation of the origin)
// here
t_float
u1
=
(
x1
-
xorig
)
/
xscale
;
t_float
v1
=
(
y1
-
yorig
)
/
yscale
;
t_float
u2
=
(
x2
-
xorig
)
/
xscale
;
t_float
v2
=
(
y2
-
yorig
)
/
yscale
;
// undoing the scaling will reverse the order of coordinates if
// the corresponding scale factor is negative, so we put them back
// into ascending order if necessary; gui_scalar_draw_select_rect
// expects them that way
if
(
u2
<
u1
)
{
t_float
u
=
u2
;
u2
=
u1
;
u1
=
u
;
}
if
(
v2
<
v1
)
{
t_float
v
=
v2
;
v2
=
v1
;
v1
=
v
;
}
gui_vmess
(
"gui_scalar_draw_select_rect"
,
"xsiffffff"
,
glist_getcanvas
(
glist
),
tagbuf
,
state
,
(
int
)(
x1
/
xscale
),
(
int
)(
y1
/
yscale
),
(
int
)(
x2
/
xscale
),
(
int
)(
y2
/
yscale
),
// the actual selection rectangle is 1 unit larger than the
// bbox at each border
u1
-
1
.
0
,
v1
-
1
.
0
,
u2
+
1
.
0
,
v2
+
1
.
0
,
basex
,
basey
);
}
...
...
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