Skip to content

Commit

Permalink
QoL - Move drawings under fog overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
WillBrook29 committed Feb 21, 2025
1 parent 2b8442a commit b68d11a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Fog.js
Original file line number Diff line number Diff line change
Expand Up @@ -1172,14 +1172,16 @@ function draw_wizarding_box() {
}

}
function ctxScale(canvasid){
function ctxScale(canvasid, transform){
let canvas = document.getElementById(canvasid);
canvas.width = $("#scene_map").width();
canvas.height = $("#scene_map").height();
$(canvas).css({
'transform-origin': 'top left',
'transform': 'scale(var(--scene-scale))'
});
if(transform){
$(canvas).css({
'transform-origin': 'top left',
'transform': 'scale(var(--scene-scale))'
});
}
}

function reset_canvas(apply_zoom=true) {
Expand All @@ -1189,13 +1191,13 @@ function reset_canvas(apply_zoom=true) {
$('#darkness_layer').css({"width": sceneMapWidth, "height": sceneMapHeight});
$("#scene_map_container").css({"width": sceneMapWidth, "height": sceneMapHeight});

ctxScale('peer_overlay');
ctxScale('temp_overlay');
ctxScale('fog_overlay');
ctxScale('grid_overlay');
ctxScale('draw_overlay');
ctxScale('walls_layer');
ctxScale('elev_overlay');
ctxScale('peer_overlay', true);
ctxScale('temp_overlay', true);
ctxScale('fog_overlay', true);
ctxScale('grid_overlay', true);
ctxScale('draw_overlay', false);
ctxScale('walls_layer', true);
ctxScale('elev_overlay', true);

let canvas = document.getElementById('raycastingCanvas');
canvas.width = $("#scene_map").width();
Expand Down
2 changes: 2 additions & 0 deletions Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ async function load_scenemap(url, is_video = false, width = null, height = null,
newmap.on("load", callback);
}
$("#map_items").append(newmap);
document.getElementById('map_items').appendChild( document.getElementById('draw_overlay') )


}
Expand Down Expand Up @@ -589,6 +590,7 @@ async function load_scenemap(url, is_video = false, width = null, height = null,
$("#scene_map_container").toggleClass('map-loading', false);
}
$("#map_items").append(newmap);
document.getElementById('map_items').appendChild( document.getElementById('draw_overlay') )

}

Expand Down

0 comments on commit b68d11a

Please sign in to comment.