Skip to content

Commit

Permalink
Fix bounding box check function and add SortWrapper interface type
Browse files Browse the repository at this point in the history
  • Loading branch information
xenown committed Oct 24, 2022
1 parent 45c8227 commit 0e510b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
5 changes: 1 addition & 4 deletions src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,11 @@ export interface IFilter {
quality: number;
}

export interface IBasicState {
export interface IState {
isEnabled: boolean;
isAutoPreAmpOn: boolean;
isGraphViewOn: boolean;
preAmp: number;
}

export interface IState extends IBasicState {
filters: IFilter[];
}

Expand Down
13 changes: 8 additions & 5 deletions src/renderer/SortWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const isBoundingBoxDifferent = (

for (let i = 0; i < keys1.length; i += 1) {
if (
keys1[i] !== keys2[i] ||
!boundMap2[keys1[i]] ||
boundMap1[keys1[i]].left !== boundMap2[keys1[i]].left
) {
return true;
Expand All @@ -71,13 +71,16 @@ const isBoundingBoxDifferent = (
return false;
};

interface ISortWrapper {
children: CustomElement[];
// This ref should refer to the parent html element that contains children
wrapperRef: RefObject<HTMLDivElement>;
}

const SortWrapper = ({
children = [],
wrapperRef,
}: {
children: CustomElement[];
wrapperRef: RefObject<HTMLDivElement>;
}): JSX.Element => {
}: ISortWrapper): JSX.Element => {
const [boundingBoxes, setBoundingBoxes] = useState<IBoundingBoxMap>({});
const prevBoundingBoxesRef = useRef<IBoundingBoxMap>({});

Expand Down

0 comments on commit 0e510b7

Please sign in to comment.