Unverified Commit 5546b4d4 authored by Himanshu Garg's avatar Himanshu Garg Committed by GitHub

Fix errors of map components in the designer (#2485)

parent e870364f
......@@ -219,6 +219,10 @@ public class MockCircle extends MockMapFeatureBaseWithFill {
this.@com.google.appinventor.client.editor.simple.components.MockMapFeatureBase::setNativeTooltip(*)(
this.@com.google.appinventor.client.editor.simple.components.MockMapFeatureBase::getTooltip()()
);
var isVisible = this.@com.google.appinventor.client.editor.simple.components.MockMapFeatureBase::getVisibleProperty()();
if (!isVisible) {
map.removeLayer(circle);
}
}-*/;
}
......@@ -143,6 +143,10 @@ public class MockLineString extends MockMapFeatureBase {
this.@com.google.appinventor.client.editor.simple.components.MockMapFeatureBase::setNativeTooltip(*)(
this.@com.google.appinventor.client.editor.simple.components.MockMapFeatureBase::getTooltip()()
);
var isVisible = this.@com.google.appinventor.client.editor.simple.components.MockMapFeatureBase::getVisibleProperty()();
if (!isVisible) {
map.removeLayer(polyline);
}
}-*/;
private native void preserveLayerData()/*-{
......
......@@ -74,7 +74,12 @@ public abstract class MockMapFeatureBase extends MockVisibleComponent implements
protected void onSelectedChange(boolean selected) {
super.onSelectedChange(selected);
setSelected(selected);
setEditing(selected);
boolean isVisible = getVisibleProperty();
setEditing(isVisible && selected);
}
boolean getVisibleProperty() {
return Boolean.parseBoolean(getPropertyValue(PROPERTY_NAME_VISIBLE));
}
@Override
......
......@@ -430,6 +430,10 @@ public class MockMarker extends MockMapFeatureBaseWithFill {
marker.on('click dragstart', marker.clickHandler);
marker.on('dragend', marker.dragHandler);
}
var isVisible = this.@com.google.appinventor.client.editor.simple.components.MockMapFeatureBase::getVisibleProperty()();
if (!isVisible) {
map.removeLayer(marker);
}
}-*/;
native double getLatitude()/*-{
......
......@@ -215,6 +215,10 @@ public class MockPolygon extends MockPolygonBase {
this.@com.google.appinventor.client.editor.simple.components.MockMapFeatureBase::setNativeTooltip(*)(
this.@com.google.appinventor.client.editor.simple.components.MockPolygon::getTooltip()()
);
var isVisible = this.@com.google.appinventor.client.editor.simple.components.MockMapFeatureBase::getVisibleProperty()();
if (!isVisible) {
map.removeLayer(polygon);
}
}-*/;
private native void preserveLayerData()/*-{
......
......@@ -184,6 +184,10 @@ public class MockRectangle extends MockPolygonBase {
this.@com.google.appinventor.client.editor.simple.components.MockMapFeatureBase::setNativeTooltip(*)(
this.@com.google.appinventor.client.editor.simple.components.MockPolygon::getTooltip()()
);
var isVisible = this.@com.google.appinventor.client.editor.simple.components.MockMapFeatureBase::getVisibleProperty()();
if (!isVisible) {
map.removeLayer(rect);
}
}-*/;
private native void setBounds(double south, double west, double north, double east)/*-{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment