Aligned button slider to pixels
This commit is contained in:
@@ -72,7 +72,7 @@ function debugPrint(title, value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleGrid() {
|
function toggleGrid(offX = 0, offY = 0) {
|
||||||
if (gridVisible) {
|
if (gridVisible) {
|
||||||
document.getElementById("gridCanvas").remove()
|
document.getElementById("gridCanvas").remove()
|
||||||
gridVisible = false
|
gridVisible = false
|
||||||
@@ -84,8 +84,8 @@ function toggleGrid() {
|
|||||||
canvasEl.width = window.innerWidth
|
canvasEl.width = window.innerWidth
|
||||||
canvasEl.height = window.innerHeight
|
canvasEl.height = window.innerHeight
|
||||||
canvasEl.style.position = "absolute"
|
canvasEl.style.position = "absolute"
|
||||||
canvasEl.style.top = "0%"
|
canvasEl.style.top = `${offY * pxDensity}px`
|
||||||
canvasEl.style.left = "0%"
|
canvasEl.style.left = `${offX * pxDensity}px`
|
||||||
canvasEl.style.pointerEvents = "none"
|
canvasEl.style.pointerEvents = "none"
|
||||||
|
|
||||||
let ctx = canvasEl.getContext("2d")
|
let ctx = canvasEl.getContext("2d")
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ canvas {
|
|||||||
.switch {
|
.switch {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 60px;
|
width: calc(8px * var(--pxDensity));
|
||||||
height: 34px;
|
height: calc(4px * var(--pxDensity));
|
||||||
}
|
}
|
||||||
.switch input {
|
.switch input {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -87,10 +87,10 @@ canvas {
|
|||||||
.switchDecor:before {
|
.switchDecor:before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: "";
|
content: "";
|
||||||
height: 26px;
|
height: calc(2px * var(--pxDensity));
|
||||||
width: 26px;
|
width: calc(2px * var(--pxDensity));
|
||||||
left: 4px;
|
left: calc(1px * var(--pxDensity));
|
||||||
bottom: 4px;
|
bottom: calc(1px * var(--pxDensity));
|
||||||
background-color: var(--navBarBtn_Inner);
|
background-color: var(--navBarBtn_Inner);
|
||||||
transition: 0.2s steps(2, end);
|
transition: 0.2s steps(2, end);
|
||||||
}
|
}
|
||||||
@@ -98,5 +98,5 @@ canvas {
|
|||||||
background-color: var(--brightBlue);
|
background-color: var(--brightBlue);
|
||||||
}
|
}
|
||||||
.switch input:checked + .switchDecor:before {
|
.switch input:checked + .switchDecor:before {
|
||||||
transform: translateX(26px);
|
transform: translateX(calc(4px * var(--pxDensity)));
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,6 @@
|
|||||||
height: calc(3px * var(--pxDensity));
|
height: calc(3px * var(--pxDensity));
|
||||||
}
|
}
|
||||||
.sliderDiv {
|
.sliderDiv {
|
||||||
display: inline-block;
|
|
||||||
background-color: var(--navBarBtn_Inner);
|
background-color: var(--navBarBtn_Inner);
|
||||||
box-shadow: calc(1px * var(--pxDensity)) 0px var(--navBarBtn_Border),
|
box-shadow: calc(1px * var(--pxDensity)) 0px var(--navBarBtn_Border),
|
||||||
calc(-1px * var(--pxDensity)) 0px var(--navBarBtn_Border),
|
calc(-1px * var(--pxDensity)) 0px var(--navBarBtn_Border),
|
||||||
|
|||||||
Reference in New Issue
Block a user