Commit 35a664c6 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

fix svg_free_events to only free "drag" events (the others are automatically gc'd)

parent 5e6b356b
#N struct curvebbox float x float y;
#N canvas 0 19 619 300 10;
#X obj 151 34 struct curvebbox float x float y;
#X scalar curvebbox 71 53 \;;
#X text 197 181 Short demo showing that Pd should find the correct
bounding box for a transformed scalar in edit-mode.;
#X text 197 221 Unfortunately it doesn't quite get it right for curves.
You can see with rotation at some angles it doesn't include part of
the curve.;
#N canvas 433 184 450 300 (subpatch) 0;
#X floatatom 163 116 5 0 0 0 - - -, f 5;
#X obj 163 160 draw path M 20 120 C 20 30 40 50 60 70;
#X msg 163 137 transform rotate \$1;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X restore 417 94 group;
#X floatatom 408 21 5 0 0 0 - - -, f 5;
#X msg 408 42 transform translate \$1 0;
#X connect 5 0 6 0;
#X connect 6 0 4 0;
...@@ -4262,48 +4262,15 @@ t_parentwidgetbehavior draw_widgetbehavior = ...@@ -4262,48 +4262,15 @@ t_parentwidgetbehavior draw_widgetbehavior =
static void svg_free_events(t_svg *x) static void svg_free_events(t_svg *x)
{ {
/* This is pretty simplistic-- if the flag is set then we set the /* Right now all the events except for "drag" get automatically
event to zero and send the update to the GUI. */ garbage collected in the GUI.
if (x->x_events.e_focusin.a_flag == 1) The reason "drag" does not is that it's a kind of "meta-event"--
{ we keep a reference to the "draggable" object and check for it
fielddesc_setfloat_const(&x->x_events.e_focusin.a_attr, 0); on clicking the canvas. The benefit is there's a single, centralized
svg_update(x, gensym("focusin")); set of canvas events instead of event listeners for each scalar.
} Drawback is that we have to manage destroying the "drag" references
if (x->x_events.e_activate.a_flag == 1) in the GUI. But eventually all scalar events should be handled this
{ way... */
fielddesc_setfloat_const(&x->x_events.e_activate.a_attr, 0);
svg_update(x, gensym("focusout"));
}
if (x->x_events.e_click.a_flag == 1)
{
fielddesc_setfloat_const(&x->x_events.e_click.a_attr, 0);
svg_update(x, gensym("click"));
}
if (x->x_events.e_mousedown.a_flag == 1)
{
fielddesc_setfloat_const(&x->x_events.e_mousedown.a_attr, 0);
svg_update(x, gensym("mousedown"));
}
if (x->x_events.e_mouseup.a_flag == 1)
{
fielddesc_setfloat_const(&x->x_events.e_mouseup.a_attr, 0);
svg_update(x, gensym("mouseup"));
}
if (x->x_events.e_mouseover.a_flag == 1)
{
fielddesc_setfloat_const(&x->x_events.e_mouseover.a_attr, 0);
svg_update(x, gensym("mouseover"));
}
if (x->x_events.e_mousemove.a_flag == 1)
{
fielddesc_setfloat_const(&x->x_events.e_mousemove.a_attr, 0);
svg_update(x, gensym("mousemove"));
}
if (x->x_events.e_mouseout.a_flag == 1)
{
fielddesc_setfloat_const(&x->x_events.e_mouseout.a_attr, 0);
svg_update(x, gensym("mouseout"));
}
if (x->x_events.e_drag.a_flag == 1) if (x->x_events.e_drag.a_flag == 1)
{ {
fielddesc_setfloat_const(&x->x_events.e_drag.a_attr, 0); fielddesc_setfloat_const(&x->x_events.e_drag.a_attr, 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment