Jump to content

YSH

Members
  • Content Count

    1
  • Joined

  • Last visited

  1. function setupBlockDrag() { let isDragging = false let data = null rect.on('pointerdown', onDragStart) rect.on('pointerup', onDragEnd) rect.on('pointermove', onDragMove) function onDragStart(event) { isDragging = true data = event.data let local = rect.toLocal(event.data.global) let anchorX = local.x / rect.width let anchorY = local.y / rect.height rect.anchor.set(anchorX, anchorY) onDragMove() } function onDragEnd(event) { isDragging = false let local = { x: rect.anchor.x * rect.width, y:
×
×
  • Create New...