【问题标题】:Google Map V3 - Undo last point while drawing with the drawing managerGoogle Map V3 - 使用绘图管理器绘图时撤消最后一点
【发布时间】:2014-03-05 09:37:51
【问题描述】:

我有一个使用 Google 绘图管理器在地图上绘制折线和多边形的应用程序。虽然这是一个优秀的库,但我从用户那里收到了一个问题,是否可以在绘制折线时撤消最后绘制的点。我已经搜索过,但我发现这只有在绘制折线之后才有可能。有没有人有办法做到这一点?

另一个不错的选择是扩展现有的折线。

【问题讨论】:

    标签: google-maps drawing extend undo polyline


    【解决方案1】:

    将此功能用于undu和redu

    function undoOverlays(){
            $( "#my_shape" ).hide('slow'); 
            bounds = mapOverlays[(mapOverlays.length)-1].getPath(); console.log(bounds);
            if(bounds.length>1){
            undo_redo.push(bounds.pop());
            }
            else { $('#message_popup').html('Everything is Cleared.');$('#message_popup').show('slow');$('#message_popup').delay(2000).fadeOut('slow'); }
        }
    
        function redoOverlays(){
            $( "#my_shape" ).hide('slow');
            bounds = mapOverlays[(mapOverlays.length)-1].getPath();
            if(undo_redo.length>0){
            for(var i=0;i<undo_redo.length;i++);
            {
            bounds.push(undo_redo.pop());
            }
            }
            else { $('#message_popup').html('Everything is Recovered.');$('#message_popup').show('slow');$('#message_popup').delay(2000).fadeOut('slow'); }
        }
    

    【讨论】:

    • 能否请您添加一些描述!
    猜你喜欢
    • 2012-11-23
    • 2014-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-20
    • 1970-01-01
    相关资源
    最近更新 更多