gpolygon disappears on zoom in/out gmap

asked 2023-10-11 01:46:28 +0800

vjain gravatar image vjain
    click on the map to draw the lines
<div apply="org.zkoss.reference.component.diagrams.DrawLineComposer">
    <button id="clear" label="Clear Lines"/>
    <gmaps id="map4draw" width="50%" height="500px" />

package org.zkoss.reference.component.diagrams;

import org.zkoss.gmaps.*;
import org.zkoss.gmaps.event.MapMouseEvent;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.select.SelectorComposer;
import org.zkoss.zk.ui.select.annotation.*;

import java.util.*;

public class DrawLineComposer extends SelectorComposer {
private Gmaps map4draw;

private List<LatLng> clickedPoints = new LinkedList();

private Gpolyline currentPolyline = new Gpolyline();

public void doAfterCompose(Component comp) throws Exception {

@Listen("onMapClick = #map4draw")
public void recordDraw(MapMouseEvent event){

@Listen("onClick = #clear")
public void clearPoints(){
    currentPolyline.setPath(new LinkedList<>(clickedPoints));

private void drawPolylines() {
    if (clickedPoints.size() > 1) {
        currentPolyline.setPath(new LinkedList<>(clickedPoints));


delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2023-10-19 16:44:06 +0800

MDuchemin gravatar image MDuchemin
2480 1 6
ZK Team

Hey there,

Running with ZK 9.6.4, ZK Gmaps 4.0.0, I've tested the sample with the following operations:

  • drawn a few lines
  • zoom out (until max)
  • drawn a few lines
  • zoom in (until max)
  • zoom out (until max again)

In all zoom levels, I haven't seen the lines disapearing.

Could you post the steps required to reproduce? Additionally, when the line disappear, do you see any console error in the client-side JS console?

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2023-10-11 01:46:28 +0800

Seen: 7 times

Last updated: Oct 19

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More