Cannot go out of vewport

This commit is contained in:
Luis Fernando Molina committed 2019-05-08 12:34:28 +02:00
1 parent 5af73fd9b8
commit 70cd66f7be
1 file changed
+13 -11
+13 -11
View File
@@ -87,26 +87,28 @@ function newCodeEditor () {
}
function activate (payload) {
thisObject.visible = true
thisObject.payload = payload
thisObject.rawRadius = 8
thisObject.targetRadius = thisObject.container.frame.radius
thisObject.currentRadius = 0
const WIDTH = thisObject.container.frame.radius * 2.2
const HEIGHT = thisObject.container.frame.radius * 1
let textArea = document.getElementById('textArea')
textArea.value = payload.node.code
textArea.style = 'resize: none; border: none; outline: none; box-shadow: none; overflow:hidden; font-family: Saira; font-size: 12px; background-color: rgb(204, 88, 53);color:rgb(255, 255, 255); width: ' + WIDTH + 'px; height: ' + HEIGHT + 'px'
textArea.style.display = 'block'
let textAreaPosition = {
x: 0 - WIDTH / 2,
y: 0
}
textAreaPosition = thisObject.container.frame.frameThisPoint(textAreaPosition)
if (textAreaPosition.y < window.canvasApp.topMargin) { return }
thisObject.visible = true
thisObject.payload = payload
thisObject.rawRadius = 8
thisObject.targetRadius = thisObject.container.frame.radius
thisObject.currentRadius = 0
let textArea = document.getElementById('textArea')
textArea.value = payload.node.code
textArea.style = 'resize: none; border: none; outline: none; box-shadow: none; overflow:hidden; font-family: Saira; font-size: 12px; background-color: rgb(204, 88, 53);color:rgb(255, 255, 255); width: ' + WIDTH + 'px; height: ' + HEIGHT + 'px'
textArea.style.display = 'block'
textArea.focus()
let textAreaDiv = document.getElementById('textAreaDiv')
textAreaDiv.style = 'position:absolute; top:' + textAreaPosition.y + 'px; left:' + textAreaPosition.x + 'px; z-index:1; '