fix: 🐛 Fix drag-n-drop of local files into OHIF (#1319)

* fix: 🐛 Fix drag-n-drop of local files into OHIF

Closes: #1307

* CR Update: Centralize dialogs
This commit is contained in:
Gustavo André Lelis 2019-12-19 12:14:05 -03:00 committed by Danny Brown
parent 36a741f0bc
commit 23305cec9c
3 changed files with 28 additions and 19 deletions

View File

@ -152,6 +152,7 @@ const DialogProvider = ({ children, service }) => {
onStart, onStart,
onStop, onStop,
onDrag, onDrag,
showOverlay,
} = dialog; } = dialog;
let position = let position =
@ -160,7 +161,7 @@ const DialogProvider = ({ children, service }) => {
position = centerPositions.find(position => position.id === id); position = centerPositions.find(position => position.id === id);
} }
return ( const dragableItem = () => (
<Draggable <Draggable
key={id} key={id}
disabled={!isDraggable} disabled={!isDraggable}
@ -217,6 +218,16 @@ const DialogProvider = ({ children, service }) => {
</div> </div>
</Draggable> </Draggable>
); );
return (
showOverlay ? (
<div className="Overlay" key={id}>
{dragableItem()}
</div>
) : (
dragableItem()
)
);
}); });
/** /**
@ -238,13 +249,11 @@ const DialogProvider = ({ children, service }) => {
return ( return (
<DialogContext.Provider value={{ create, dismiss, dismissAll, isEmpty }}> <DialogContext.Provider value={{ create, dismiss, dismissAll, isEmpty }}>
{!isEmpty() &&
<div className="DraggableArea"> <div className="DraggableArea">
{dialogs.some(dialog => dialog.showOverlay) ? ( {renderDialogs()}
<div className="Overlay active">{renderDialogs()}</div>
) : (
renderDialogs()
)}
</div> </div>
}
{children} {children}
</DialogContext.Provider> </DialogContext.Provider>
); );

View File

@ -6,12 +6,11 @@
div div
cursor: grabbing !important cursor: grabbing !important
.DraggableArea, .Overlay .DraggableArea
width: 100% width: 100%
height: 100% height: 100%
position: absolute position: absolute
.Overlay
.Overlay.active
position: fixed position: fixed
z-index: 999 z-index: 999
left: 0 left: 0

View File

@ -80,6 +80,7 @@ export default function init({
id: 'labelling', id: 'labelling',
isDraggable: false, isDraggable: false,
showOverlay: true, showOverlay: true,
centralize: true,
content: LabellingFlow, content: LabellingFlow,
contentProps: { contentProps: {
measurementData, measurementData,