refactor: remove mapRect usage
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import { mapRect } from "../../helpers/inputHelpers";
|
|
||||||
|
|
||||||
interface HighlighterProps {
|
interface HighlighterProps {
|
||||||
unmodifiedRect: DOMRect;
|
unmodifiedRect: DOMRect;
|
||||||
@@ -11,7 +10,7 @@ interface HighlighterProps {
|
|||||||
canvasRect: DOMRect;
|
canvasRect: DOMRect;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Highlighter = ({ unmodifiedRect, displayedSelector = '', width, height, canvasRect}: HighlighterProps) => {
|
export const Highlighter = ({ unmodifiedRect, displayedSelector = '', width, height, canvasRect }: HighlighterProps) => {
|
||||||
if (!unmodifiedRect) {
|
if (!unmodifiedRect) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
@@ -30,7 +29,7 @@ export const Highlighter = ({ unmodifiedRect, displayedSelector = '', width, hei
|
|||||||
|
|
||||||
const rect = {
|
const rect = {
|
||||||
top: unmodifiedRect.top + canvasRect.top,
|
top: unmodifiedRect.top + canvasRect.top,
|
||||||
left: unmodifiedRect.left + canvasRect.left,
|
left: unmodifiedRect.left + canvasRect.left,
|
||||||
right: unmodifiedRect.right + canvasRect.left,
|
right: unmodifiedRect.right + canvasRect.left,
|
||||||
bottom: unmodifiedRect.bottom + canvasRect.top,
|
bottom: unmodifiedRect.bottom + canvasRect.top,
|
||||||
width: unmodifiedRect.width,
|
width: unmodifiedRect.width,
|
||||||
@@ -113,7 +112,7 @@ const HighlighterLabel = styled.div<HighlighterLabelProps>`
|
|||||||
left: ${(p: HighlighterLabelProps) => p.left}px;
|
left: ${(p: HighlighterLabelProps) => p.left}px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
interface HighlighterLabelProps{
|
interface HighlighterLabelProps {
|
||||||
top: number;
|
top: number;
|
||||||
left: number;
|
left: number;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user