Fix: annotation drag

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
2025-05-03 07:59:39 -07:00
parent 88cd5e4727
commit 383818b6f8

View File

@@ -93,7 +93,7 @@ isDeleting = function() {
*/
grabAnnotation = function(e) {
if (e.ctrlKey) {
grabHotspot = {x: e.x, y: e.y}
grabHotspot = {x: e.x, y: e.y, target: e.target}
const contEl = $('.glmv-container')[0]
contEl.addEventListener('mousemove', moveAnnotation)
const mvEl = $('model-viewer')[0]
@@ -110,7 +110,7 @@ grabAnnotation = function(e) {
moveAnnotation = function(e) {
if (grabHotspot) {
grabHotspot.move = true
e.target.style['transform'] = `translate(${e.x - grabHotspot.x}px, ${e.y - grabHotspot.y}px) scale(1.1,1.1)`
grabHotspot.target.style['transform'] = `translate(${e.x - grabHotspot.x}px, ${e.y - grabHotspot.y}px) scale(1.1,1.1)`
}
}