Merge pull request #1320 from Mnem42/patch-6

(zoom.js) Show border to canvas
This commit is contained in:
slweeb 2025-12-17 10:07:50 -05:00 committed by GitHub
commit 9a4c988094
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 3 deletions

View File

@ -72,8 +72,9 @@ function gen_button(row, col, html, click, nopos, id){
function add_css(){
const CSS = `
#zm_data_div { margin-bottom: 10px; }
#zm_data_div { margin-bottom: 10px }
#canvasDiv { overflow: hidden }
#game { border: solid white }
@media(pointer=coarse){
#zm_floater_container#zm_floater_container {
@ -199,6 +200,16 @@ function rescale(){
const y = zoom_panning[1] * (pixelSize * scale)
gameCanvas.style.transform = `translate(${x}px,${y}px) scale(${scale})`
const width = 2 / scale
gameCanvas.style.borderTopWidth =
`${zoom_panning[1] > 0 ? width : 0}px`
gameCanvas.style.borderBottomWidth =
`${zoom_panning[1] < 0 ? width : 0}px`
gameCanvas.style.borderLeftWidth =
`${zoom_panning[0] > 0 ? width : 0}px`
gameCanvas.style.borderRightWidth =
`${zoom_panning[0] < 0 ? width : 0}px`
}
function log_info(){