graflowEditor console
This commit is contained in:
51
buildoz.js
51
buildoz.js
@@ -290,6 +290,8 @@ class BZslidePane extends Buildoz {
|
||||
}
|
||||
this.dragMove = this.dragMove.bind(this)
|
||||
this.dragEnd = this.dragEnd.bind(this)
|
||||
this.lastClientX = 0
|
||||
this.lastClientY = 0
|
||||
// Fill with innerHTML or other DOM manip should not allow coating to be removed
|
||||
this._observer = new MutationObserver(muts => { this.coat() })
|
||||
}
|
||||
@@ -319,37 +321,62 @@ class BZslidePane extends Buildoz {
|
||||
dragStart(evt){
|
||||
evt.target.setPointerCapture(evt.pointerId)
|
||||
this.dragStartX = evt.clientX
|
||||
this.dragStartY = evt.clientY
|
||||
this.dragStartY = evt.clientY
|
||||
this.lastClientX = evt.clientX
|
||||
this.lastClientY = evt.clientY
|
||||
this.handle.addEventListener('pointermove', this.dragMove)
|
||||
this.handle.addEventListener('pointerup', this.dragEnd)
|
||||
}
|
||||
|
||||
dragMove(evt){
|
||||
const box = this.getBoundingClientRect()
|
||||
const parentBox = this.parentElement.getBoundingClientRect()
|
||||
let width, height
|
||||
const boundaryEl = this.offsetParent || this.parentElement
|
||||
const parentBox = boundaryEl.getBoundingClientRect()
|
||||
let width, height, min, max
|
||||
switch(this.getAttribute('side')){
|
||||
case 'top':
|
||||
height = (evt.clientY > box.top) ? (evt.clientY - box.top) : 0
|
||||
if(height>(parentBox.height/2)) height = Math.floor(parentBox.height/2)
|
||||
min = parseInt(this.getBZAttribute('minheight')) || 0
|
||||
if(evt.clientY > (box.top + min)) height = (evt.clientY - box.top)
|
||||
else if(evt.clientY < this.lastClientY) height = min
|
||||
else if(evt.clientY > this.lastClientY) height = 0
|
||||
else break
|
||||
max = parseInt(this.getBZAttribute('maxheight')) || Math.floor(parentBox.height/2)
|
||||
height = Math.min(height, parentBox.height, max)
|
||||
this.style.height = height+'px'
|
||||
break
|
||||
case 'bottom':
|
||||
height = (evt.clientY < box.bottom) ? (box.bottom - evt.clientY) : 0
|
||||
if(height>(parentBox.height/2)) height = Math.floor(parentBox.height/2)
|
||||
min = parseInt(this.getBZAttribute('minheight')) || 0
|
||||
if(evt.clientY < (box.bottom - min)) height = (box.bottom - evt.clientY)
|
||||
else if(evt.clientY > this.lastClientY) height = min
|
||||
else if(evt.clientY < this.lastClientY) height = 0
|
||||
else break
|
||||
max = parseInt(this.getBZAttribute('maxheight')) || Math.floor(parentBox.height/2)
|
||||
height = Math.min(height, parentBox.height, max)
|
||||
this.style.height = height+'px'
|
||||
break
|
||||
case 'left':
|
||||
width = (evt.clientX > box.left) ? (evt.clientX - box.left) : 0
|
||||
if(width>(parentBox.width/2)) width = Math.floor(parentBox.width/2)
|
||||
min = parseInt(this.getBZAttribute('minwidth')) || 0
|
||||
if(evt.clientX < (box.left + min)) width = (evt.clientX - box.left)
|
||||
else if(evt.clientX > this.lastClientX) width = min
|
||||
else if(evt.clientX < this.lastClientX) width = 0
|
||||
else break
|
||||
max = parseInt(this.getBZAttribute('maxwidth')) || Math.floor(parentBox.width/2)
|
||||
width = Math.min(width, parentBox.width, max)
|
||||
this.style.width = width+'px'
|
||||
break
|
||||
case'right':
|
||||
width = (evt.clientX < box.right) ? (box.right - evt.clientX) : 0
|
||||
if(width>(parentBox.width/2)) width = Math.floor(parentBox.width/2)
|
||||
case 'right':
|
||||
min = parseInt(this.getBZAttribute('minwidth')) || 0
|
||||
if(evt.clientX < (box.right - min)) width = (box.right - evt.clientX)
|
||||
else if(evt.clientX < this.lastClientX) width = min
|
||||
else if(evt.clientX > this.lastClientX) width = 0
|
||||
else break
|
||||
max = parseInt(this.getBZAttribute('maxwidth')) || Math.floor(parentBox.width/2)
|
||||
width = Math.min(width, parentBox.width, max)
|
||||
this.style.width = width+'px'
|
||||
break
|
||||
}
|
||||
this.lastClientX = evt.clientX
|
||||
this.lastClientY = evt.clientY
|
||||
}
|
||||
|
||||
dragEnd(evt){
|
||||
|
||||
Reference in New Issue
Block a user