Apply higher z-index for selected component (#1474)

This commit is contained in:
Sherfin Shamsudeen 2021-11-30 19:48:12 +05:30 committed by GitHub
parent 3f477fd6df
commit 9326120b5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,18 +45,13 @@ function computeWidth(currentLayoutOptions) {
return `${currentLayoutOptions?.width}%`;
}
function getStyles(left, top, isDragging, component, isSelectedComponent, currentLayoutOptions) {
// const transform = `translate3d(${left}px, ${top}px, 0)`;
function getStyles(isDragging, isSelectedComponent) {
return {
position: 'absolute',
// transform,
// WebkitTransform: transform,
zIndex: isSelectedComponent ? 2 : 1,
// IE fallback: hide the real node using CSS when dragging
// because IE will ignore our custom "empty image" drag preview.
opacity: isDragging ? 0 : 1,
height: isDragging ? 0 : '100%',
width: computeWidth(currentLayoutOptions),
};
}
@ -179,6 +174,7 @@ export const DraggableBox = function DraggableBox({
className="draggable-box "
onMouseOver={() => setMouseOver(true)}
onMouseLeave={() => setMouseOver(false)}
style={getStyles(isDragging, isSelectedComponent)}
>
<Rnd
style={{ ...style }}