(zoom.js) Show border to canvas
Display borders on the canvas so the canvas bounds are more obvious.
This commit is contained in:
parent
d681c0bf69
commit
e601e24d20
13
mods/zoom.js
13
mods/zoom.js
|
|
@ -72,8 +72,9 @@ function gen_button(row, col, html, click, nopos, id){
|
||||||
|
|
||||||
function add_css(){
|
function add_css(){
|
||||||
const CSS = `
|
const CSS = `
|
||||||
#zm_data_div { margin-bottom: 10px; }
|
#zm_data_div { margin-bottom: 10px }
|
||||||
#canvasDiv { overflow: hidden }
|
#canvasDiv { overflow: hidden }
|
||||||
|
#game { border: solid white }
|
||||||
|
|
||||||
@media(pointer=coarse){
|
@media(pointer=coarse){
|
||||||
#zm_floater_container#zm_floater_container {
|
#zm_floater_container#zm_floater_container {
|
||||||
|
|
@ -199,6 +200,16 @@ function rescale(){
|
||||||
const y = zoom_panning[1] * (pixelSize * scale)
|
const y = zoom_panning[1] * (pixelSize * scale)
|
||||||
|
|
||||||
gameCanvas.style.transform = `translate(${x}px,${y}px) scale(${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(){
|
function log_info(){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue