react-grid-layout / react-draggable

React draggable component
MIT License
9.04k stars 1.03k forks source link

had dragged, how to update coverd area #753

Open enoloo opened 6 months ago

enoloo commented 6 months ago

image

I use mui Unstable_Popup component that could drag on the react flow component. Its draged well, but the old area of Unstable_Popup remain coverd. How to erase this area? Thks.

return (
<>
    <BaseEdge path={edgePath} markerEnd={markerEnd} style={{stroke:color}} />
    <EdgeLabelRenderer>
        <div
        onClick={handleClick}
        style={{
            position: 'absolute',
            transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
            fontSize: 12,
            // everything inside EdgeLabelRenderer has no pointer events by default
            // if you have an interactive element, set pointer-events: all
            background: '#ffcc00',
            paddingLeft: 10,
            paddingRight:10,
            paddingTop:4,
            paddingBottom:4,
            borderRadius: 5,
            fontWeight: 700,
            pointerEvents: 'all',
        }}
        className="nopan edgeObject"
        >
            {label}
        </div>
        <Popup id={id} open={open} anchor={anchorEl}>
            <Draggable handle='.handleEdge'>
                <Paper><ForwardPanel handleClose={handleClose} pair={t} {...props} /></Paper>
            </Draggable>
        </Popup>
    </EdgeLabelRenderer>
</>
);
<Paper className='handleEdge' sx={{backgroundColor:pink[50], cursor:'pointer'}} >
    <Stack direction="row" spacing={0.6} display='flex' alignItems='center' padding='4px' borderBottom='1px solid #E8A7D5'>
        <Box whiteSpace='nowrap' overflow='hidden' textOverflow='ellipsis' maxWidth='8em'>{source}</Box> 
        <ArrowForwardIcon sx={{color:grey[400], fontSize:"1em"}}/> 
        <Box whiteSpace='nowrap' overflow='hidden' textOverflow='ellipsis' maxWidth='8em'>{target}</Box>  
        <IconButton onClick={props.handleClose} sx={{marginLeft:'auto !important', padding:"0", fontSize:'1em'}}><CloseIcon color='primary' />  </IconButton >          
    </Stack>
</Paper>