ui: local zoom only in editor mode
This commit is contained in:
parent
fe6a8f7af2
commit
c916f5dd6a
2 changed files with 15 additions and 23 deletions
|
|
@ -30,31 +30,11 @@ document.addEventListener('wheel', function(event) {
|
|||
}
|
||||
}, {passive: false})
|
||||
|
||||
// document.addEventListener('mousemove', function(event) {
|
||||
// mousePos = [
|
||||
// event.pageX / window.innerWidth * 100,
|
||||
// event.pageY / window.innerHeight * 100
|
||||
// ]
|
||||
// if (localZoom !== 1) {
|
||||
// applylocalZoom()
|
||||
// }
|
||||
// }, {passive: false})
|
||||
|
||||
|
||||
var container = DOM.get('#osc-container')[0]
|
||||
function applylocalZoom() {
|
||||
if (localZoom === 1) {
|
||||
container.style.transformOrigin = ''
|
||||
container.parentNode.style.overflow = ''
|
||||
container.style.transform = ''
|
||||
} else {
|
||||
// container.style.transformOrigin = `${mousePos[0]}% ${mousePos[1]}%`
|
||||
container.parentNode.style.overflow = 'auto'
|
||||
container.style.transformOrigin = '0 0'
|
||||
requestAnimationFrame(()=>{
|
||||
container.style.transform = `scale(${localZoom})`
|
||||
})
|
||||
}
|
||||
requestAnimationFrame(()=>{
|
||||
container.style.setProperty('--local-zoom', localZoom)
|
||||
})
|
||||
}
|
||||
|
||||
document.addEventListener('keydown', function(event){
|
||||
|
|
|
|||
|
|
@ -733,3 +733,15 @@ osc-inspector-color {
|
|||
height: 30rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.editor-enabled {
|
||||
osc-panel-container.center {
|
||||
overflow: auto;
|
||||
background: var(--color-background);
|
||||
}
|
||||
#osc-container {
|
||||
transform-origin: 0 0;
|
||||
transform: scale(var(--local-zoom));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue