Skip to content
This repository was archived by the owner on Jan 19, 2024. It is now read-only.
This repository was archived by the owner on Jan 19, 2024. It is now read-only.

How can i open the cluster on single click, currently cluster open on double click #144

@imran-saleem834

Description

@imran-saleem834

Here is my code

mapContainer
            .gmap3(mapOpts)
            .infowindow({
                content: '',
                maxWidth: 197
            })
            .then(function (iw) {
                infowindow = iw;
            })
            .cluster({
                size: 200,
                markers: deals,
                cb: function (markers) {
                    if (markers.length > 1) { // 1 marker stay unchanged (because cb returns nothing)
                        if (markers.length < 20) {
                            return {
                                content: "<div class='cluster cluster-1'>" + markers.length + "</div>",
                                x: -26,
                                y: -26
                            };
                        }
                        if (markers.length < 50) {
                            return {
                                content: "<div class='cluster cluster-2'>" + markers.length + "</div>",
                                x: -26,
                                y: -26
                            };
                        }
                        return {
                            content: "<div class='cluster cluster-3'>" + markers.length + "</div>",
                            x: -33,
                            y: -33
                        };
                    }
                }
            })
            .on('click', function (marker, clusterOverlay, cluster, event) {
                if (marker) {
                    infowindow.setContent(marker.info);
                    infowindow.open(marker.getMap(), marker);
                }
                console.log(marker);
                console.log(clusterOverlay);
                console.log(cluster);
                console.log(event);
            })
            .marker(deals)
            .then(function (markers) {
                markers.forEach(function (marker) {
                    marker.setVisible(false);
                })
            })
            .wait(2000) // to let you appreciate the current zoom & center
            .fit();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions