src/view.cpp in reflexion-0.1.39 vs src/view.cpp in reflexion-0.1.40
- old
+ new
@@ -214,10 +214,11 @@
: Body_create_temporary();
assert(b);
pbody.reset(b);
update_body_frame();
+ update_body_states();
}
return *pbody;
}
void update_body_frame ()
@@ -233,10 +234,16 @@
}
else
pbody->set_transform(frame.x, frame.y, angle);
}
+ void update_body_states ()
+ {
+ if (pbody && pbody->is_rotation_fixed() != has_flag(View::FLAG_FIX_ANGLE))
+ pbody->fix_rotation(has_flag(View::FLAG_FIX_ANGLE));
+ }
+
void
get_view2body_matrix (Matrix* m)
{
assert(m && *m == 1 && ppivot && *ppivot != 0);
@@ -259,11 +266,11 @@
.translate( pivot)
.rotate(-angle)
.translate(-pivot);
}
- void update_body_and_shapes ()
+ void setup_body_and_shapes ()
{
std::unique_ptr<Body> old_body;
if (pbody)
{
old_body = std::move(pbody);
@@ -716,11 +723,11 @@
view->on_detach(&e);
view->set_capture(View::CAPTURE_NONE);
}
view->self->window = window;
- view->self->update_body_and_shapes();
+ view->self->setup_body_and_shapes();
View::ChildList* children = view->self->children();
if (children)
{
for (auto& child : *children)
@@ -2362,15 +2369,19 @@
void
View::add_flag (uint flags)
{
self->add_flag(flags);
+
+ self->update_body_states();
}
void
View::remove_flag (uint flags)
{
self->remove_flag(flags);
+
+ self->update_body_states();
}
bool
View::has_flag (uint flags) const
{