henrichen / zkgmapsz

Automatically exported from code.google.com/p/zkgmapsz
0 stars 0 forks source link

Gmarker supports popup as tooltip #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Please refer to the code below:

<zk>
    <popup id="pp">
        <button label="button in popup" />
    </popup>
    <gmaps id="map" lat="22" lng="22" width="500px" height="500px"
        style="position: absolute; left: 50px; top: 50px;">
        <!-- popup pp should be displayed while mouseover the
            marker below but it won't -->
        <gmarker lat="22" lng="22"
            tooltip="pp"></gmarker>
    </gmaps>
</zk>

Original issue reported on code.google.com by benbai...@gmail.com on 16 Sep 2013 at 2:28

GoogleCodeExporter commented 9 years ago
To support popup-tooltip, need to listen mouseover event of gmarker as below:

<zk xmlns:w="client">
    <popup id="pp">
        <button label="button in popup" />
    </popup>
    <gmaps id="map" lat="22" lng="22" width="500px" height="500px"
        style="position: absolute; left: 50px; top: 50px;">
        <gmarker lat="22" lng="22"
            tooltip="pp">
            <attribute w:name="_initListeners"><![CDATA[
                function() {
                    this.$_initListeners();
                    var gmarker = this.mapitem_
                        gmarkerwgt = this;
                    this._mouseover = google.maps.event.addListener(
                            gmarker,
                            "mouseover",
                            function() {
                                var params = gmarkerwgt._tooltip ? gmarkerwgt._parsePopParams(gmarkerwgt._tooltip) : {},
                                    tip = gmarkerwgt._smartFellow(params.id),
                                    map = gmarkerwgt.parent,
                                    xy = gmaps.Gmaps.latlngToXY(map, gmarker.getPosition()),
                                    pageXY,
                                    pp = zk.Widget.$('$pp');
                                xy.x = Math.floor(xy.x);
                                xy.y = Math.floor(xy.y);
                                pageXY = gmaps.Gmaps.xyToPageXY(map, xy.x, xy.y)

                                tip.open(gmarkerwgt, pageXY, null, {sendOnOpen:true});
                        });
                }
            ]]></attribute>
            <attribute w:name="_clearListeners"><![CDATA[
                function() {
                    this.$_clearListeners();
                    if (this._mouseover) {
                        google.maps.event.removeListener(this._mouseover);
                        this._mouseover = null;
                    }
                }
            ]]></attribute>
        </gmarker>
    </gmaps>
</zk>

Original comment by benbai...@gmail.com on 16 Sep 2013 at 2:32

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r54.

Original comment by raymondchao@potix.com on 18 Sep 2013 at 7:54