Avoid that the copy is triggered when drag the map
This commit is contained in:
parent
40cf6d355a
commit
8065836bf6
@ -113,16 +113,20 @@ if (!window.location.href.includes('dofus-map')) {
|
|||||||
const result = document.getElementById('mapCoordinates');
|
const result = document.getElementById('mapCoordinates');
|
||||||
const mapElement = document.getElementById('mapContainer')
|
const mapElement = document.getElementById('mapContainer')
|
||||||
|
|
||||||
mapElement.addEventListener('click', event => {
|
mapElement.addEventListener('mousedown', mousedownEvent => {
|
||||||
|
let moved = false
|
||||||
|
mapElement.addEventListener('mousemove', moveEvent => moved = true)
|
||||||
|
mapElement.addEventListener('mouseup', mouseupEvent => {
|
||||||
const position = getPositionArray(result.innerHTML)
|
const position = getPositionArray(result.innerHTML)
|
||||||
console.log(position)
|
console.log(position)
|
||||||
if (position && position.length === 2) {
|
if (position && position.length === 2 && !moved) {
|
||||||
if (parameters.has('noob')) {
|
if (parameters.has('noob')) {
|
||||||
copyTextToClipboard('/p [' + position[0] + ',' + position[1] + ']')
|
copyTextToClipboard('/p [' + position[0] + ',' + position[1] + ']')
|
||||||
} else {
|
} else {
|
||||||
copyTextToClipboard(travelCommand + position[0] + ',' + position[1])
|
copyTextToClipboard(travelCommand + position[0] + ',' + position[1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
moved = false
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user