From aa897bb7e2ae257c2680521e6b1c1cad1237df53 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sat, 18 Dec 2021 17:52:25 +0100 Subject: fixed parsing of tiled objects (points behave slightly differntly than I thought) --- lib/Properties.hs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib/Properties.hs') diff --git a/lib/Properties.hs b/lib/Properties.hs index c057b63..a326e30 100644 --- a/lib/Properties.hs +++ b/lib/Properties.hs @@ -211,7 +211,7 @@ checkLayer = do forM_ (getProperties layer) checkObjectGroupProperty unless (layerName layer == "floorLayer") $ - when (null publicObjects || publicObjects == Just mempty) $ + when (null (layerObjects layer) || layerObjects layer == Just mempty) $ warn "objectgroup layer (which aren't the floorLayer) \ \are useless if they are empty." @@ -234,16 +234,17 @@ checkObjectProperty obj p@(Property name _) = case name of unwrapString p $ \str -> unwrapBadgeToken str $ \token -> do case obj of - ObjectPoint {..} -> - offersBadge (Badge token (BadgePoint objectX objectY)) - ObjectRectangle {..} -> - if isJust objectEllipse - then offersBadge - $ Badge token (BadgeRect objectX objectY objectWidth objectHeight) - else complain "ellipses are not supported." ObjectPolygon {} -> complain "polygons are not supported." ObjectPolyline {} -> complain "polylines are not supported." ObjectText {} -> complain "cannot use texts to define badge areas." + ObjectRectangle {..} -> + if objectEllipse == Just True + then complain "ellipses are not supported." + else offersBadge + $ Badge token $ case (objectWidth, objectHeight) of + (Just w, Just h) | w /= 0 && h /= 0 -> + BadgeRect objectX objectY w h + _ -> BadgePoint objectX objectY _ -> warn $ "unknown object property " <> prettyprint name <> "." -- cgit v1.2.3