diff --git a/modules/glmv.js b/modules/glmv.js index 9d49db9..f921184 100644 --- a/modules/glmv.js +++ b/modules/glmv.js @@ -1,5 +1,4 @@ let slideShowInterval = null -let grabHotspotTimer = null let grabHotspotStart = null /** @@ -199,7 +198,10 @@ grabAnnotation = function(e) { * @param {MouseEvent} event */ moveAnnotation = function(e) { - e.target.style['transform'] = `translate(${e.x - grabHotspotStart.x}px, ${e.y - grabHotspotStart.y}px) scale(1.1,1.1)` + if (grabHotspotStart) { + grabHotspotStart.move = true + e.target.style['transform'] = `translate(${e.x - grabHotspotStart.x}px, ${e.y - grabHotspotStart.y}px) scale(1.1,1.1)` + } } /** @@ -208,9 +210,8 @@ moveAnnotation = function(e) { * @param {MouseEvent} event */ releaseAnnotation = function(e) { - if (grabHotspotStart) { + if (grabHotspotStart.move) { e.target.style['transform']='' - grabHotspotStart = null const contEl = $('.glmv-container')[0] contEl.removeEventListener('mousemove', moveAnnotation) const mvEl = $('model-viewer')[0] @@ -239,6 +240,7 @@ releaseAnnotation = function(e) { const newText = currentText.replace(/(.*?
)[\S\s]*?(<\/pre>.*)/,`$1\n${JSON.stringify(metadata, null, 2)}\n$2`)
$('#wpTextbox1').val(newText)
}
+ grabHotspotStart = null
}
/**