D'n'd Element Blocks MouseMove Event on It.
See original GitHub issueI have 4 blocks above d’n’d element. When I do “mousedown” event to any one of this blocks turning off dragging I want to do some “mousemove” event for making connecting line from this element and etc.
I’ve alredy read the similar issue. But unfortunately I don’t understand how to let pass over “mousemove” event above d’n’d element.
Also I know that drag event forbid “mousemove” by default.
Who knows how does it work?
I’ll be glad for any information.
constructor(props: ElementProps & DiagramInjectStore) {
super(props);
this.handleFlowCursorSnapping = this.handleFlowCursorSnapping.bind(this) as (event: MouseEvent) => void;
this.handleFlowCursorFinalSnapping = this.handleFlowCursorFinalSnapping.bind(this) as (event: MouseEvent) => void;
}
public render(): JSX.Element {
const { coord, size } = this.element.properties;
const { diagramId } = this.props;
const { connectors } = this.element;
return (
<Select
coord={ coord }
size={ size }
stage={ this.selectStage }
canResizing={ false }
onDragStart={ () => this.handleDragStart() }
onDrag={ e => this.handleDrag(e) }
onDragEnd={ e => this.handleDragEnd(e) }
>
<StyledGlyphElement>
<Connectors
diagramId={ diagramId }
type={ ConnectorTypeKind.Element }
connectors={ connectors }
onMouseDown={ event => this.handleCreateFlow(event) }
onMouseOver={ event => this.handleBlur(event) }
/>
</StyledGlyphElement>
</Select>
);
}
public componentDidMount(): void {
document.body.addEventListener('mousemove', this.handleFlowCursorSnapping, false);
document.body.addEventListener('mouseup', this.handleFlowCursorFinalSnapping, false);
}
public componentWillUnmount(): void {
document.body.removeEventListener('mousemove', this.handleFlowCursorSnapping, false);
document.body.removeEventListener('mouseup', this.handleFlowCursorFinalSnapping, false);
}
private handleFlowCursorSnapping(event: MouseEvent): void {
document.body.addEventListener('mousemove', this.handleFlowCursorFinalSnapping, false);
}
private handleFlowCursorFinalSnapping(event: MouseEvent): void {
document.body.removeEventListener('mousemove', this.handleFlowCursorSnapping, false);
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
Element: mousemove event - Web APIs | MDN
The mousemove event is fired at an element when a pointing device (usually a mouse) is moved while the cursor's hotspot is inside...
Read more >Drag'n'Drop with mouse events - The Modern JavaScript Tutorial
So here we'll see how to implement Drag'n'Drop using mouse events. ... On mousedown – prepare the element for moving, if needed (maybe ......
Read more >Mousemove delays firing mouseleave event - Stack Overflow
This CSS property, when set to "none" allows elements to not receive hover/click events, instead the event will occur on anything behind it....
Read more >DnD mousemove events do not appear during drag. Why?
The original * dragstart event will be provided in the local event variable. * - dnd-moved Callback that is invoked when the element...
Read more >7.7 Drag and drop — HTML5 - W3C
setData(internalDNDType, event.target.dataset.value); event. ... function dragEndHandler(event) { // remove the dragged element event.target.parentNode.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for delay.
Eventually we solved our problem with help by changing structure of DOM selectors. Before that we dragged wrapped element instead of single element without wrapping. This implementation didn’t pass clicks and any mouse events to appropriate inner elements but did dragging events for wrapper.
Before that we used another method. We blocked dragging from wrapper by using
I hope it will help.
Thank you a lot 😃