Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icon size x can now be initialised with a number #4608

Merged
merged 4 commits into from
Jun 1, 2016
Merged

Icon size x can now be initialised with a number #4608

merged 4 commits into from
Jun 1, 2016

Conversation

rheh
Copy link
Contributor

@rheh rheh commented May 30, 2016

Icon size can now be passed as a single numeric as well as the [x, y]. Additional tests added to cover new parameter option.

Fixes #3185

var sizeOption = options[name + 'Size'];

if (!L.Util.isArray(sizeOption)) {
options[name + 'Size'] = [options[name + 'Size'], options[name + 'Size']];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use sizeOption here twice for shorter code, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, you're overwriting the original options object, which is undesirable. Instead you could redefine sizeOption.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - both of your comments have been implemented in the latest commit.

@IvanSanchez
Copy link
Member

Not sure about this. I'd rather extend the L.point factory method to allow single-parameter instantiation everywhere if we're gonna allow this.

@mourner
Copy link
Member

mourner commented May 31, 2016

@IvanSanchez I'm not in favor of L.point accepting a single number because it can be a source of subtle, hard to track bugs.

expect(beforeIcon).to.be(afterIcon);
expect(afterIcon.src).to.contain(icon2._getIconUrl('icon'));
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not looking at the whole file, but it looks like line 61 to 74 was accidentally duplicated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right. I'll update the pull request to correct this tomorrow. Thanks.

@mourner mourner merged commit 72c4f98 into Leaflet:master Jun 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants