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

Expand zoom buttons functionality #167

Merged
merged 3 commits into from
Dec 16, 2015

Conversation

Indigo744
Copy link
Collaborator

Implements #166 and add some customization to zoom buttons !

The default options now looks like this: for each buttons, a cssClass, content and title is provided.

defaultOptions: {
    map: {
        zoom: {
            /* ... */
            /* removed zoomIncssClass & zoomOutcssClass */
            /* ... */
            buttons: {
                "reset": {
                    cssClass: "zoomButton zoomReset",
                    content: "•", // bullet sign
                    title: "Reset zoom"
                },
                "in": {
                    cssClass: "zoomButton zoomIn",
                    content: "+",
                    title: "Zoom in"
                },
                "out": {
                    cssClass: "zoomButton zoomOut",
                    content: "−", // minus sign
                    title: "Zoom out"
                }
            }
        }
    }
}

Note: at the beginning, I though about adding a complete HTML tooltip like in the map, but title attribute was quite sufficient for this task.

.html(opt.content)
.attr("title", opt.title);
// Assign click event
$button.on("click." + pluginName, fnZoomButtons[type]);
Copy link
Owner

Choose a reason for hiding this comment

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

What if a user add a button "myCustomButton" in the conf ? Maybe we should check for fnZoomButtons[type] existence

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a good idea indeed.
Moreover, should we allow the user to add custom buttons?

Copy link
Owner

Choose a reason for hiding this comment

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

I was wondering it too :) Maybe I'm wrong but I don't think it will be a common need to add custom zoom buttons. Moreover, the user will still can add custom buttons freely, without using mapael conf.

@neveldo
Copy link
Owner

neveldo commented Dec 16, 2015

Thank you for this new feature :) Maybe the UPGRADE.md should be updated regarding the replacement zoomInCssClass and zoomOutCssClass ?

@Indigo744
Copy link
Collaborator Author

Done :)

@neveldo
Copy link
Owner

neveldo commented Dec 16, 2015

Thank you :)

neveldo added a commit that referenced this pull request Dec 16, 2015
@neveldo neveldo merged commit 364698b into neveldo:master Dec 16, 2015
@Indigo744 Indigo744 deleted the expand-zoom-buttons branch December 16, 2015 11:03
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.

2 participants