From 85269e0a4d35da1d34eb8fb04e6c6fa53970f5b0 Mon Sep 17 00:00:00 2001
From: tatref <tatref@github.com>
Date: Thu, 21 May 2020 01:03:29 +0200
Subject: [PATCH] add point datatype for object layer

---
 src/lib.rs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/lib.rs b/src/lib.rs
index cd20136..4014ac9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -829,6 +829,7 @@ pub enum ObjectShape {
     Ellipse { width: f32, height: f32 },
     Polyline { points: Vec<(f32, f32)> },
     Polygon { points: Vec<(f32, f32)> },
+    Point(f32, f32),
 }
 
 #[derive(Debug, PartialEq, Clone)]
@@ -897,6 +898,10 @@ impl Object {
                 shape = Some(Object::new_polygon(attrs)?);
                 Ok(())
             },
+            "point" => |_| {
+                shape = Some(Object::new_point(x, y)?);
+                Ok(())
+            },
             "properties" => |_| {
                 properties = parse_properties(parser)?;
                 Ok(())
@@ -950,6 +955,10 @@ impl Object {
         Ok(ObjectShape::Polygon { points: points })
     }
 
+    fn new_point(x: f32, y: f32) -> Result<ObjectShape, TiledError> {
+        Ok(ObjectShape::Point(x, y))
+    }
+
     fn parse_points(s: String) -> Result<Vec<(f32, f32)>, TiledError> {
         let pairs = s.split(' ');
         let mut points = Vec::new();
-- 
GitLab