Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some improvements to the Drag+Drop article #4399

Merged
merged 2 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const SelectionOutline: React.FC<{
outline:
hovered || isSelected ? `${scaledBorder}px solid #0B84F3` : undefined,
userSelect: 'none',
touchAction: 'none',
};
}, [hovered, item, scaledBorder, isSelected]);

Expand Down
8 changes: 7 additions & 1 deletion packages/docs/docs/player/drag-and-drop/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import {DragAndDropDemo} from './Demo';
The Remotion Player supports reacting to mouse events allowing for building interactions on the canvas.
Try to drag and resize the elements below.

<br />
<DragAndDropDemo />
<br />

## General consideration
## General considerations

Pointer events work mostly just like in regular React.

Expand Down Expand Up @@ -229,6 +230,7 @@ export const SelectionOutline: React.FC<{
outline:
hovered || isSelected ? `${scaledBorder}px solid #0B84F3` : undefined,
userSelect: 'none',
touchAction: 'none',
};
}, [hovered, item, scaledBorder, isSelected]);

Expand Down Expand Up @@ -548,6 +550,10 @@ Later, we will treat any event that bubbles up as an click on an empty space and

We also don't do any action if `e.button !== 0`. This prevents a bug where the item moves after a right click.

We add `userSelect: 'none'` to disable the native selection and drag behavior of the browser.

We also add `touchAction: 'none` to disable scrolling the page on mobile while dragging.

### <TitleStep>4</TitleStep> Sorting outlines

Let's create a component that renders all outlines.
Expand Down
Loading