Is there a way to hide (ie: don't show, because its annoying) the undo button when editing a shape on a v3 Google Map?
2 Answers
Try the undocumented suppressUndo
parameter.
It seems to work fine with google.maps.Circle
var c = new google.maps.Circle({
map: myMap,
...
suppressUndo: true
});
related issue in the issue tracker: http://code.google.com/p/gmaps-api-issues/issues/detail?id=4013
-
Works on Polygons too :-). I noticed that the
insert_at
event is not fired when a change to a midline point is undone, so I just got rid of the Undo button with this property. And, it is a little visually cluttering anyway.– nabrownCommented Mar 13, 2023 at 21:21 -
hello I know this is old thread but I am trying to add suppressUndo: true to my google.maps.Circle but it is not a known property for that object. Error suppressUndo: boolean; }' is not assignable to parameter of type 'Circle | CircleLiteral | CircleOptions | null | undefined'. Object literal may only specify known properties, and 'suppressUndo' does not exist in type 'Circle | CircleLiteral | CircleOptions'. Commented Jun 24, 2023 at 13:17
-
@kareem.khalil Is this about TypeScript? If yes, then, of course, it's a matter of typings and the official typings don't have this undocumented option in them. You can fix that by adding it via your own global typings, but that's out of scope of this answer.– bladeCommented Jun 26, 2023 at 8:01
I am using Angular Google map and when I create new object from google.maps.Circle
or google.maps.Polygon
the suppressUndo
gives me error is not assignable to parameter of type
so i fixed it as below:
const savedCircle = new google.maps.Circle({
map: map,
....
});
savedCircle.set('suppressUndo',true );
I used set('suppressUndo',true ) and now it is working