A full-featured download manager.
refactor: drag select
Dr_rOot6d893bd1ce83
diff --git a/src/renderer/components/DragSelect/Index.vue b/src/renderer/components/DragSelect/Index.vueindex 7cc0e48b..d07e7f63 100644--- a/src/renderer/components/DragSelect/Index.vue+++ b/src/renderer/components/DragSelect/Index.vue@@ -8,6 +8,11 @@</template><script>+ const getCoords = (e, containerRect) => ({+ x: e.clientX - containerRect.left,+ y: e.clientY - containerRect.top+ })+const getDimensions = (p1, p2) => ({width: Math.abs(p1.x - p2.x),height: Math.abs(p1.y - p2.y)@@ -51,12 +56,6 @@const self = thislet containerRect = container.getBoundingClientRect()-- const getCoords = e => ({- x: e.clientX - containerRect.left,- y: e.clientY - containerRect.top- })-const box = this.createBox()let start = { x: 0, y: 0 }let end = { x: 0, y: 0 }@@ -74,7 +73,7 @@function startDrag (e) {containerRect = container.getBoundingClientRect()self.children = container.childNodes- start = getCoords(e)+ start = getCoords(e, containerRect)end = startdocument.addEventListener('mousemove', drag)document.addEventListener('touchmove', touchMove)@@ -87,7 +86,7 @@}function drag (e) {- end = getCoords(e)+ end = getCoords(e, containerRect)const dimensions = getDimensions(start, end)if (end.x < start.x) {