User:FlamingMojo/vector.js

From Dune: Awakening Community Wiki
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
function dropPin(event) {
  map = window.dataMaps[0];
  param = new URLSearchParams(window.location.search).get('mode');
  if (!param || param != 'multiple') {
    removePin(map);
    coords = translateCoords(event.latlng);
    marker = map.createMarker(['Custom'], coords);
    window.droppedPin = marker;
    window.names = window.names || []
    name = window.names.pop()
    if (!name) { name = window.currentLoc }
    point = { x: coords[1], y: coords[0], name: name, id: name.replaceAll(' ', '_').toLowerCase(), article: name } 
    window.points = window.points || [];
    window.points.push(point);
    console.log(point);
  } else {
    addPin(translateCoords(event.latlng));
  }
}