fix webGL issue that wasn't webGL issue

chromium bug causing random js variables to become NaN
but only as viewed by a certain js source file, not globally
not sure how to even report this bug upstream
This commit is contained in:
Matthias Wirth
2025-03-08 08:35:37 +00:00
parent 01af74d8b7
commit 5d4e2cb307
2 changed files with 7 additions and 5 deletions

View File

@@ -1760,7 +1760,7 @@ PlaneObject.prototype.updateMarker = function(moved) {
this.setMarkerRgb();
const iconRotation = this.shape.noRotate ? 0 : this.rotation;
this.glMarker.set('rotation', iconRotation * Math.PI / 180.0 + mapOrientation);
this.glMarker.set('rotation', iconRotation * Math.PI / 180.0 + g.mapOrientation);
this.glMarker.set('scale', this.scale * Math.max(this.shape.w, this.shape.h) / glIconSize);
this.glMarker.set('sx', getSpriteX(this.shape) * glIconSize);
this.glMarker.set('sy', getSpriteY(this.shape) * glIconSize);

View File

@@ -12,6 +12,8 @@ g.route_check_array = [];
g.route_check_in_flight = false;
g.route_cache_timer = new Date().getTime() / 1000 + 1; // one second from now
g.mapOrientation = mapOrientation;
// Define our global variables
let tabHidden = false;
let webgl = false;
@@ -1065,9 +1067,9 @@ function earlyInitPage() {
if (value = usp.getFloat('mapOrientation')) {
mapOrientation = value;
g.mapOrientation = value;
}
mapOrientation *= (Math.PI/180); // adjust to radians
g.mapOrientation *= (Math.PI/180); // adjust to radians
if (usp.has('r') || usp.has('replay')) {
let numbers = (usp.get('r') || usp.get('replay') || "").split(/(?:-|:)/);
@@ -2551,7 +2553,7 @@ function ol_map_init() {
OLProj = OLMap.getView().getProjection();
OLProjExtent = OLProj.getExtent();
OLMap.getView().setRotation(mapOrientation); // adjust orientation
OLMap.getView().setRotation(g.mapOrientation); // adjust orientation
OLMap.addControl(new ol.control.LayerSwitcher({
groupSelectStyle: 'none',
@@ -4613,7 +4615,7 @@ function resetMap() {
//console.log('resetMap setting center ' + [CenterLat, CenterLon]);
OLMap.getView().setCenter(ol.proj.fromLonLat([CenterLon, CenterLat]));
OLMap.getView().setRotation(mapOrientation);
OLMap.getView().setRotation(g.mapOrientation);
//selectPlaneByHex(null,false);
jQuery("#update_error").css('display','none');