fix(camera): prevent dock position change on click
This commit is contained in:
parent
7d7f7e88fe
commit
db5a788719
@ -23,6 +23,7 @@ const WebcamComponent = ({
|
||||
const [isFullscreen, setIsFullScreen] = useState(false);
|
||||
const [resizeStart, setResizeStart] = useState({ width: 0, height: 0 });
|
||||
const [cameraMaxWidth, setCameraMaxWidth] = useState(0);
|
||||
const [draggedAtLeastOneTime, setDraggedAtLeastOneTime] = useState(false);
|
||||
|
||||
const lastSize = Storage.getItem('webcamSize') || { width: 0, height: 0 };
|
||||
const { width: lastWidth, height: lastHeight } = lastSize;
|
||||
@ -140,9 +141,10 @@ const WebcamComponent = ({
|
||||
|
||||
const handleWebcamDragStop = (e) => {
|
||||
setIsDragging(false);
|
||||
setDraggedAtLeastOneTime(false);
|
||||
document.body.style.overflow = 'auto';
|
||||
|
||||
if (Object.values(CAMERADOCK_POSITION).includes(e.target.id)) {
|
||||
if (Object.values(CAMERADOCK_POSITION).includes(e.target.id) && draggedAtLeastOneTime) {
|
||||
layoutContextDispatch({
|
||||
type: ACTIONS.SET_CAMERA_DOCK_POSITION,
|
||||
value: e.target.id,
|
||||
@ -181,6 +183,11 @@ const WebcamComponent = ({
|
||||
handle="video"
|
||||
bounds="html"
|
||||
onStart={handleWebcamDragStart}
|
||||
onDrag={() => {
|
||||
if (!draggedAtLeastOneTime) {
|
||||
setDraggedAtLeastOneTime(true);
|
||||
}
|
||||
}}
|
||||
onStop={handleWebcamDragStop}
|
||||
onMouseDown={
|
||||
cameraDock.isDraggable ? (e) => e.preventDefault() : undefined
|
||||
|
Loading…
Reference in New Issue
Block a user