@rbuljan/zoompan
Version:
Zoomable and pannable area with scrollbars. Inspired by graphical editors like Photoshop.
55 lines (48 loc) • 1.15 kB
CSS
/*
* ZoomPan
*
* Basic template styles:
*/
.zoompan-viewport {
position: relative;
display: flex;
overflow: hidden;
width: calc(100% - var(--scrollbarsWidth) * 1px);
height: calc(100% - var(--scrollbarsWidth) * 1px);
align-items: center;
justify-content: center;
touch-action: none;
}
.zoompan-canvas {
flex: none;
transform-origin: center;
backface-visibility: hidden;
}
.zoompan-track-x {
position: absolute;
bottom: 0;
left: 0;
right: calc(var(--scrollbarsWidth) * 1px);
height: calc(var(--scrollbarsWidth) * 1px);
background: rgba(0, 0, 0, 0.3);
touch-action: none;
}
.zoompan-track-y {
position: absolute;
top: 0;
right: 0;
width: calc(var(--scrollbarsWidth) * 1px);
bottom: calc(var(--scrollbarsWidth) * 1px);
background: rgba(0, 0, 0, 0.3);
touch-action: none;
}
.zoompan-thumb-x {
position: absolute;
height: inherit;
background: rgba(255, 255, 255, 0.5);
}
.zoompan-thumb-y {
position: absolute;
width: inherit;
background: rgba(255, 255, 255, 0.5);
}