Fix hotspot move on preview click
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -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(/(.*?<pre>)[\S\s]*?(<\/pre>.*)/,`$1\n${JSON.stringify(metadata, null, 2)}\n$2`)
|
||||
$('#wpTextbox1').val(newText)
|
||||
}
|
||||
grabHotspotStart = null
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user