drag-drop-tool
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "drag-drop-tool", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Drag and drop tool", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -1,1 +0,1 @@ | ||
# DragDropReact | ||
# Drag Drop Tool |
@@ -151,4 +151,12 @@ class DragContainerElement extends HTMLElement { | ||
this.cloneEl.style.backgroundColor = bgColor; | ||
this.cloneEl.style.border = border; | ||
for (let i = 0; i < styles.length; i++) { | ||
const styleName = styles[i]; | ||
const styleValue = styles.getPropertyValue(styleName); | ||
const stylesToIgnore = ["position", "pointerEvents", "left", "top"]; | ||
if (!stylesToIgnore.includes(styleName)) { | ||
this.cloneEl.style.setProperty(styleName, styleValue); | ||
} | ||
} | ||
this.cloneEl.style.position = "absolute"; | ||
@@ -158,4 +166,3 @@ this.cloneEl.style.pointerEvents = "none"; | ||
this.cloneEl.style.top = top + "px"; | ||
this.cloneEl.style.width = width; | ||
this.cloneEl.style.height = height; | ||
const body = document.querySelector("body"); | ||
@@ -166,3 +173,3 @@ body.appendChild(this.cloneEl); | ||
this.handleDown = (e) => { | ||
if (e.button === 0 || e.touches) { | ||
if ((e.button === 0 || e.touches) && !this.selected) { | ||
const { left, top } = this.getBoundingClientRect(); | ||
@@ -169,0 +176,0 @@ if (e.touches) { |
8073
207