Skip to content

Commit

Permalink
Update googlemap.js
Browse files Browse the repository at this point in the history
  • Loading branch information
fustyles authored Jan 1, 2025
1 parent 08c5ef7 commit cd2a07f
Showing 1 changed file with 29 additions and 30 deletions.
59 changes: 29 additions & 30 deletions SpBlocklyJS/googlemap_20241226/googlemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,35 @@ function updateMarkerContent(pID, newContent, type) {
}
}

function updateMapContent(pMapId, val, type) {
if (type=="zoomMap") {
pMapId.setZoom(Number(val));
}
else if (type=="headingMap") {
let povData = {
heading: Number(val),
pitch: pMapId.getPov().pitch
};
pMapId.setPov(povData);
}
else if (type === "pitchMap") {
let povData = {
heading: pMapId.getPov().heading,
pitch: Number(val)
};
pMapId.setPov(povData);
}
else if (type === "clearMap") {
for (var i=0;i<mapMarkers.length;i++) {
if (pMapId==mapMarkers[i][1]) {
mapMarkers[i][2].setMap(null);
mapMarkers.splice(i, 1);
i--;
}
}
}
}

function centerMap(pMapId, lat, lng) {
const newCenter = new google.maps.LatLng(Number(lat), Number(lng));
pMapId.setCenter(newCenter);
Expand All @@ -96,33 +125,3 @@ function positionMap(pMapId, lat, lng) {
const newCenter = new google.maps.LatLng(Number(lat), Number(lng));
pMapId.setPosition(newCenter);
}

function zoomMap(pMapId, val) {
pMapId.setZoom(Number(val));
}

function headingMap(pMapId, val) {
let povData = {
heading: Number(val),
pitch: pMapId.getPov().pitch
};
pMapId.setPov(povData);
}

function pitchMap(pMapId, val) {
let povData = {
heading: pMapId.getPov().heading,
pitch: Number(val)
};
pMapId.setPov(povData);
}

function clearMap(pMapId) {
for (var i=0;i<mapMarkers.length;i++) {
if (pMapId==mapMarkers[i][1]) {
mapMarkers[i][2].setMap(null);
mapMarkers.splice(i, 1);
i--;
}
}
}

0 comments on commit cd2a07f

Please sign in to comment.