Merge pull request #1320 from Mnem42/patch-6
(zoom.js) Show border to canvas
This commit is contained in:
commit
9a4c988094
17
mods/zoom.js
17
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 {
|
||||||
|
|
@ -159,7 +160,7 @@ function add_zoom_floaters(){
|
||||||
)
|
)
|
||||||
|
|
||||||
const speed = () =>
|
const speed = () =>
|
||||||
(window.zoom_level > 3 ? 5 : 10) * // More granular at higher zoom levels
|
(window.zoom_level > 3 ? 5 : 10) * // More granular at higher zoom levels
|
||||||
(pan_mode_sel.dataset.mode == "F" ? 0.25 : 1) // Increase granularity in fine mode
|
(pan_mode_sel.dataset.mode == "F" ? 0.25 : 1) // Increase granularity in fine mode
|
||||||
|
|
||||||
container.append(
|
container.append(
|
||||||
|
|
@ -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