mirror of
https://github.com/xodio/xod.git
synced 2026-03-18 14:46:52 +01:00
fix(xod-client): return Patch component to default mode when patch from project browser was dragged out
Fixes #944
This commit is contained in:
@@ -32,9 +32,11 @@ const dropTarget = {
|
||||
);
|
||||
component.goToDefaultMode();
|
||||
},
|
||||
hover(props, monitor, component) { // TODO: performance?
|
||||
hover(props, monitor, component) {
|
||||
if (!component.dropTargetRootRef) return;
|
||||
|
||||
if (!monitor.isOver()) return;
|
||||
|
||||
component.setModeStateThrottled(
|
||||
EDITOR_MODE.ACCEPTING_DRAGGED_PATCH,
|
||||
{ previewPosition: getDraggedPatchPosition(props, monitor, component) }
|
||||
|
||||
@@ -82,6 +82,11 @@ class Patch extends React.Component {
|
||||
) {
|
||||
this.dropTargetRootRef.firstChild.focus();
|
||||
}
|
||||
|
||||
// patch was dragged out
|
||||
if (!this.props.isPatchDraggedOver && prevProps.isPatchDraggedOver) {
|
||||
this.goToDefaultMode();
|
||||
}
|
||||
}
|
||||
|
||||
getApi(mode) {
|
||||
@@ -157,6 +162,7 @@ Patch.propTypes = {
|
||||
onDoubleClick: PropTypes.func.isRequired,
|
||||
connectDropTarget: PropTypes.func.isRequired,
|
||||
isDebugSession: PropTypes.bool,
|
||||
isPatchDraggedOver: PropTypes.bool,
|
||||
nodeValues: PropTypes.objectOf(PropTypes.string),
|
||||
/* eslint-enable react/no-unused-prop-types */
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user