Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
rs-tiled
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
rs-tiled
Commits
26257654
Commit
26257654
authored
10 years ago
by
Matthew Hall
Browse files
Options
Downloads
Patches
Plain Diff
Allow objects to have 0 width or height
parent
f0e7e6d7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib.rs
+3
-9
3 additions, 9 deletions
src/lib.rs
with
3 additions
and
9 deletions
src/lib.rs
+
3
−
9
View file @
26257654
...
...
@@ -391,12 +391,10 @@ impl Object {
TiledError
::
MalformedAttributes
(
"objects must have an x and a y number"
.to_string
()));
let
mut
obj
=
None
;
let
v
=
v
.unwrap_or
(
true
);
let
w
=
w
.unwrap_or
(
0f32
);
let
h
=
h
.unwrap_or
(
0f32
);
parse_tag!
(
parser
,
"object"
,
"ellipse"
=>
|
_
|
{
if
w
.is_none
()
||
h
.is_none
()
{
return
Err
(
TiledError
::
MalformedAttributes
(
"An ellipse must have a width and height"
.to_string
()));
}
let
(
w
,
h
)
=
(
w
.unwrap
(),
h
.unwrap
());
obj
=
Some
(
Object
::
Ellipse
{
x
:
x
,
y
:
y
,
width
:
w
,
height
:
h
,
visible
:
v
});
...
...
@@ -412,12 +410,8 @@ impl Object {
});
if
obj
.is_some
()
{
Ok
(
obj
.unwrap
())
}
else
if
w
.is_some
()
&&
h
.is_some
()
{
let
w
=
w
.unwrap
();
let
h
=
h
.unwrap
();
Ok
(
Object
::
Rect
{
x
:
x
,
y
:
y
,
width
:
w
,
height
:
h
,
visible
:
v
})
}
else
{
Err
(
TiledError
::
MalformedAttributes
(
"A rect must have a width and a height"
.to_string
())
)
Ok
(
Object
::
Rect
{
x
:
x
,
y
:
y
,
width
:
w
,
height
:
h
,
visible
:
v
}
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment