Skip to content

Commit

Permalink
fix(composer): click on overlay causing camera to follow mouse
Browse files Browse the repository at this point in the history
  • Loading branch information
sheilaXu committed May 18, 2023
1 parent 0c68f5e commit 6cbd5f5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { IDataOverlayComponentInternal, ISceneNodeInternal } from '../../../stor
import { Component } from '../../../models/SceneModels';
import { useStore, useViewOptionState } from '../../../store';
import { sceneComposerIdContext } from '../../../common/sceneComposerIdContext';
import useCallbackWhenNotPanning from '../../../hooks/useCallbackWhenNotPanning';

import { DataOverlayRows } from './DataOverlayRows';
import {
Expand Down Expand Up @@ -56,7 +55,7 @@ export const DataOverlayContainer = ({ component, node }: DataOverlayContainerPr
}, [componentVisible]);

// Same behavior as other components to select node when clicked on the panel
const [onPointerDown, onPointerUp] = useCallbackWhenNotPanning(
const onPointerUp = useCallback(
(e) => {
e.stopPropagation();
if (selectedSceneNodeRef !== node.ref) {
Expand All @@ -79,7 +78,7 @@ export const DataOverlayContainer = ({ component, node }: DataOverlayContainerPr
<div
ref={containerRef}
onPointerUp={onPointerUp}
onPointerDown={onPointerDown}
onPointerDown={(e) => e.stopPropagation()}
style={{ ...tmContainer, ...(isAnnotation ? tmAnnotationContainer : tmPanelContainer) }}
>
{!isAnnotation && !componentVisible && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ import { Component } from '../../../../models/SceneModels';
import { DataOverlayContainer } from '../DataOverlayContainer';
import { DataOverlayRowsProps } from '../DataOverlayRows';

jest.mock('../../../../hooks/useCallbackWhenNotPanning', () => (cb) => [
jest.fn(),
function Hack(e) {
cb(e);
},
]);

jest.mock('../DataOverlayRows', () => ({
DataOverlayRows: (...props: [DataOverlayRowsProps, object]) => <div data-testid='rows'>{JSON.stringify(props)}</div>,
}));
Expand Down
47 changes: 0 additions & 47 deletions packages/scene-composer/src/hooks/useCallbackWhenNotPanning.ts

This file was deleted.

0 comments on commit 6cbd5f5

Please sign in to comment.