reflexion 0.1.48 → 0.1.49

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +5 -0
  3. data/VERSION +1 -1
  4. data/src/shape.cpp +18 -19
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3d0609202b8620c5b7e5390dab43005bd7638529aaf8ea0b70e59f89590776e
4
- data.tar.gz: 90739081a2547266e5393593524655eca4964e6d6c038655df675eac812a2622
3
+ metadata.gz: e490c3d3e75c2e07cd82f02772eb87b45729bd4dbf7444a01e82e631e2673a33
4
+ data.tar.gz: e52a6698bcc86a4509799637efc4019e76c39eecc5122a9a565455f18b7691e9
5
5
  SHA512:
6
- metadata.gz: 58cc9b938687a48640c9874ac9267fa9937012656350d378c55175a3b6cb229562535e48ffb4136c81927c32aca913c9c2ab55bc300e8ab11a78d7cb2d2dad44
7
- data.tar.gz: 3fe06d4cbfcecd5c61caa472d6ab8598335cb78dcb19ae8a3b16f84c2392bd341313ba6ae67dbd0196804668e532a13f0a3d75ab657030d2be528efab2c773b5
6
+ metadata.gz: 761419026cc6c7f939d714d67ee47c3d3798a7128666deb6100e470e5e80b0a17ead5747270ca33125bbf0338a39e27c9fa1810e13bde7182cc69e6d3bb12ef7
7
+ data.tar.gz: 4f6900e7f5279eceb728e4e003eae016e68af385bc9a6e9c88ca02d67ab22fe538ad2dd5565e4b177689b1392f01c928bff101d22322bd275446a74f31d9d1e0
data/ChangeLog.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # reflex ChangeLog
2
2
 
3
3
 
4
+ ## [v0.1.49] - 2023-07-11
5
+
6
+ - Fix assertion fail if the view size is 0
7
+
8
+
4
9
  ## [v0.1.48] - 2023-07-10
5
10
 
6
11
  - Fix a problem that a rectangle shape would be split into 2 triangles for physics
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.48
1
+ 0.1.49
data/src/shape.cpp CHANGED
@@ -795,28 +795,28 @@ namespace Reflex
795
795
 
796
796
  Fixture* create_fixtures (Shape* shape) override
797
797
  {
798
- if (!has_rounds())
799
- return create_rect_fixture(shape);
800
- else if (nsegment <= 1)
801
- return create_rect_fixture_without_division(shape);
798
+ Bounds frame = get_frame();
799
+ bool rect = frame.size() != 0;
800
+ if (rect && !has_rounds())
801
+ return create_rect_fixture(shape, frame);
802
+ else if (rect && nsegment <= 1)
803
+ return create_rect_fixture_without_division(shape, frame);
802
804
  else
803
805
  return Super::create_fixtures(shape);
804
806
  }
805
807
 
806
- Fixture* create_rect_fixture (Shape* shape)
808
+ Fixture* create_rect_fixture (Shape* shape, const Bounds& frame)
807
809
  {
808
810
  assert(shape);
809
811
 
810
812
  if (!owner)
811
813
  invalid_state_error(__FILE__, __LINE__);
812
814
 
813
- Bounds f = get_frame();
814
815
  float ppm = owner->meter2pixel();
815
-
816
- coord l = to_b2coord(f.x, ppm);
817
- coord t = to_b2coord(f.y, ppm);
818
- coord r = to_b2coord(f.x + f.w, ppm);
819
- coord b = to_b2coord(f.x + f.h, ppm);
816
+ coord l = to_b2coord(frame.x, ppm);
817
+ coord t = to_b2coord(frame.y, ppm);
818
+ coord r = to_b2coord(frame.x + frame.w, ppm);
819
+ coord b = to_b2coord(frame.x + frame.h, ppm);
820
820
  b2Vec2 b2points[] = {{l, t}, {l, b}, {r, b}, {r, t}};
821
821
 
822
822
  b2PolygonShape b2shape;
@@ -825,23 +825,22 @@ namespace Reflex
825
825
  return FixtureBuilder(shape, &b2shape).fixtures();
826
826
  }
827
827
 
828
- Fixture* create_rect_fixture_without_division (Shape* shape)
828
+ Fixture* create_rect_fixture_without_division (
829
+ Shape* shape, const Bounds& frame)
829
830
  {
830
831
  assert(shape);
831
832
 
832
833
  if (!owner)
833
834
  invalid_state_error(__FILE__, __LINE__);
834
835
 
835
- Bounds f = get_frame();
836
- float ppm = owner->meter2pixel();
837
-
838
836
  Polygon polygon = Rays::create_rect(
839
- f.x, f.y, f.width, f.height,
837
+ frame.x, frame.y, frame.width, frame.height,
840
838
  round_left_top, round_right_top,
841
839
  round_left_bottom, round_right_bottom,
842
840
  1);
843
841
  assert(polygon.size() == 1);
844
842
 
843
+ float ppm = owner->meter2pixel();
845
844
  const Polyline& polyline = polygon[0];
846
845
  assert(polyline[0].size() <= 8);
847
846
 
@@ -1030,10 +1029,10 @@ namespace Reflex
1030
1029
 
1031
1030
  Fixture* create_fixtures (Shape* shape) override
1032
1031
  {
1033
- Bounds f = get_frame();
1034
- bool circle = f.size() != 0 && f.width == f.height;
1032
+ Bounds frame = get_frame();
1033
+ bool circle = frame.size() != 0 && frame.width == frame.height;
1035
1034
  if (circle && !has_angle() && !has_hole() && has_fill(shape))
1036
- return create_circle_fixture(shape, f);
1035
+ return create_circle_fixture(shape, frame);
1037
1036
  else
1038
1037
  return Super::create_fixtures(shape);
1039
1038
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reflexion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.48
4
+ version: 0.1.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog