mirror of
https://github.com/vector-im/element-call.git
synced 2026-10-16 23:45:50 +00:00
Make drag & drop of floating tiles less janky
This fixes an issue where upon dragging a floating tile to a different corner of the interface, it would briefly move toward its original position before jerking back in the intended direction.
This commit is contained in:
+5
-1
@@ -198,6 +198,10 @@ interface Drag {
|
|||||||
* The Y coordinate of the dragged tile, as a scalar of the grid height.
|
* The Y coordinate of the dragged tile, as a scalar of the grid height.
|
||||||
*/
|
*/
|
||||||
yRatio: number;
|
yRatio: number;
|
||||||
|
/**
|
||||||
|
* Whether this event ends the drag gesture.
|
||||||
|
*/
|
||||||
|
endOfGesture: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type DragCallback = (drag: Drag) => void;
|
export type DragCallback = (drag: Drag) => void;
|
||||||
@@ -464,12 +468,12 @@ export function Grid<
|
|||||||
)
|
)
|
||||||
.catch(logger.error);
|
.catch(logger.error);
|
||||||
|
|
||||||
if (endOfGesture)
|
|
||||||
callback({
|
callback({
|
||||||
x: tileX,
|
x: tileX,
|
||||||
y: tileY,
|
y: tileY,
|
||||||
xRatio: tileX / (gridBounds.width - tile.width),
|
xRatio: tileX / (gridBounds.width - tile.width),
|
||||||
yRatio: tileY / (gridBounds.height - tile.height),
|
yRatio: tileY / (gridBounds.height - tile.height),
|
||||||
|
endOfGesture,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user