plugin regions: fix region name sometimes being positioned outside of the actual cell when a rotated (diamond-like) cell is just off the corners of the screen
This commit is contained in:
parent
171c1830cd
commit
db42f10ceb
@ -2,7 +2,7 @@
|
|||||||
// @id iitc-plugin-regions@jonatkins
|
// @id iitc-plugin-regions@jonatkins
|
||||||
// @name IITC plugin: Show the local score regions
|
// @name IITC plugin: Show the local score regions
|
||||||
// @category Layer
|
// @category Layer
|
||||||
// @version 0.1.0.@@DATETIMEVERSION@@
|
// @version 0.1.1.@@DATETIMEVERSION@@
|
||||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||||
// @updateURL @@UPDATEURL@@
|
// @updateURL @@UPDATEURL@@
|
||||||
// @downloadURL @@DOWNLOADURL@@
|
// @downloadURL @@DOWNLOADURL@@
|
||||||
@ -205,10 +205,11 @@ window.plugin.regions.drawCell = function(cell) {
|
|||||||
|
|
||||||
var newpos = L.latLng(newlat,newlng);
|
var newpos = L.latLng(newlat,newlng);
|
||||||
|
|
||||||
// ensure the new centre point is within the corners
|
// ensure the new position is still within the same cell
|
||||||
var cornerbounds = L.latLngBounds([corners[0],corners[1]]).extend(corners[2]).extend(corners[3]);
|
var newposcell = S2.S2Cell.FromLatLng ( newpos, 6 );
|
||||||
|
if ( newposcell.toString() == cell.toString() ) {
|
||||||
if (cornerbounds.contains(newpos)) center=newpos;
|
center=newpos;
|
||||||
|
}
|
||||||
// else we leave the name where it was - offscreen
|
// else we leave the name where it was - offscreen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user