Skip to content

Commit

Permalink
DragPreview: fixed text (#311)
Browse files Browse the repository at this point in the history
Sometimes, selecting two or more files & started dragging would
incorrectly use the row under the mouse as ghost element.

This should always show "Copy x elements" instead. Current row is used as ghost element only when a single file is being dragged.
  • Loading branch information
warpdesign authored Nov 21, 2022
1 parent 06a5e78 commit 5e137e5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 37 deletions.
60 changes: 30 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@
"mobx": "^6.6.2",
"mobx-react": "^7.5.3",
"react": "^16.9.0",
"react-dnd": "^13.1.1",
"react-dnd-html5-backend": "^12.1.1",
"react-dnd": "^14.0.5",
"react-dnd-html5-backend": "^14.1.0",
"react-dnd-text-dragpreview": "^0.2.3",
"react-dom": "^16.9.0",
"react-i18next": "^12.0.0",
Expand Down
7 changes: 3 additions & 4 deletions src/components/RowRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,9 @@ export function RowRendererFn({
}

if (fileCache.isVisible) {
if (selectedCount > 1) {
connectDragPreview(createPreview(selectedCount, isDarkModeActive))
} else {
connectDragPreview(undefined)
const img = selectedCount > 1 ? createPreview(selectedCount, isDarkModeActive) : undefined
if (img) {
img.onload = () => connectDragPreview(img)
}
}

Expand Down
1 change: 0 additions & 1 deletion src/components/menus/FileContextMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react'
import { Menu, MenuItem, MenuDivider, Intent } from '@blueprintjs/core'
import { AppState } from '$src/state/appState'
import { useStores } from '$src/hooks/useStores'
import { File, sameID } from '$src/services/Fs'
import { useTranslation } from 'react-i18next'
Expand Down

0 comments on commit 5e137e5

Please sign in to comment.