@@ -70,11 +70,6 @@ interface ReactGrabState {
7070 labelInstances : LabelInstanceInfo [ ] ;
7171}
7272
73- interface CrosshairInfo {
74- isVisible : boolean ;
75- position : { x : number ; y : number } | null ;
76- }
77-
7873interface GrabbedBoxInfo {
7974 count : number ;
8075 boxes : Array < {
@@ -184,8 +179,6 @@ export interface ReactGrabPageObject {
184179 waitForSelectionLabel : ( ) => Promise < void > ;
185180 getLabelStatusText : ( ) => Promise < string | null > ;
186181
187- getCrosshairInfo : ( ) => Promise < CrosshairInfo > ;
188- isCrosshairVisible : ( ) => Promise < boolean > ;
189182 getGrabbedBoxInfo : ( ) => Promise < GrabbedBoxInfo > ;
190183 getLabelInstancesInfo : ( ) => Promise < LabelInstanceInfo [ ] > ;
191184 isGrabbedBoxVisible : ( ) => Promise < boolean > ;
@@ -1531,57 +1524,6 @@ const createReactGrabPageObject = (page: Page): ReactGrabPageObject => {
15311524 } , ATTRIBUTE_NAME ) ;
15321525 } ;
15331526
1534- const getCrosshairInfo = async ( ) : Promise < CrosshairInfo > => {
1535- return page . evaluate ( ( attrName ) => {
1536- const host = document . querySelector ( `[${ attrName } ]` ) ;
1537- const shadowRoot = host ?. shadowRoot ;
1538- if ( ! shadowRoot ) return { isVisible : false , position : null } ;
1539- const root = shadowRoot . querySelector ( `[${ attrName } ]` ) ;
1540- if ( ! root ) return { isVisible : false , position : null } ;
1541-
1542- const crosshairElements = Array . from (
1543- root . querySelectorAll ( "div[style*='pointer-events: none']" ) ,
1544- ) ;
1545- for ( let i = 0 ; i < crosshairElements . length ; i ++ ) {
1546- const element = crosshairElements [ i ] as HTMLElement ;
1547- const style = element . style ;
1548- if (
1549- style . position === "fixed" &&
1550- ( style . width === "1px" ||
1551- style . height === "1px" ||
1552- style . width === "100%" ||
1553- style . height === "100%" )
1554- ) {
1555- const transform = style . transform ;
1556- const match = transform ?. match ( / t r a n s l a t e \( ( [ ^ , ] + ) p x , \s * ( [ ^ ) ] + ) p x \) / ) ;
1557- if ( match ) {
1558- return {
1559- isVisible : true ,
1560- position : { x : parseFloat ( match [ 1 ] ) , y : parseFloat ( match [ 2 ] ) } ,
1561- } ;
1562- }
1563- }
1564- }
1565- return { isVisible : false , position : null } ;
1566- } , ATTRIBUTE_NAME ) ;
1567- } ;
1568-
1569- const isCrosshairVisible = async ( ) : Promise < boolean > => {
1570- return page . evaluate ( ( ) => {
1571- const api = (
1572- window as {
1573- __REACT_GRAB__ ?: {
1574- getState : ( ) => {
1575- isCrosshairVisible : boolean ;
1576- } ;
1577- } ;
1578- }
1579- ) . __REACT_GRAB__ ;
1580-
1581- return api ?. getState ( ) ?. isCrosshairVisible ?? false ;
1582- } ) ;
1583- } ;
1584-
15851527 const getGrabbedBoxInfo = async ( ) : Promise < GrabbedBoxInfo > => {
15861528 return page . evaluate ( ( ) => {
15871529 const api = (
@@ -1826,7 +1768,6 @@ const createReactGrabPageObject = (page: Page): ReactGrabPageObject => {
18261768 "onPromptModeChange" ,
18271769 "onSelectionBox" ,
18281770 "onDragBox" ,
1829- "onCrosshair" ,
18301771 "onGrabbedBox" ,
18311772 "onContextMenu" ,
18321773 "onOpenFile" ,
@@ -2353,7 +2294,6 @@ const createReactGrabPageObject = (page: Page): ReactGrabPageObject => {
23532294 onPromptModeChange : trackCallback ( "onPromptModeChange" ) ,
23542295 onSelectionBox : trackCallback ( "onSelectionBox" ) ,
23552296 onDragBox : trackCallback ( "onDragBox" ) ,
2356- onCrosshair : trackCallback ( "onCrosshair" ) ,
23572297 onGrabbedBox : trackCallback ( "onGrabbedBox" ) ,
23582298 onContextMenu : trackCallback ( "onContextMenu" ) ,
23592299 onOpenFile : trackCallback ( "onOpenFile" ) ,
@@ -2496,8 +2436,6 @@ const createReactGrabPageObject = (page: Page): ReactGrabPageObject => {
24962436 waitForSelectionLabel,
24972437 getLabelStatusText,
24982438
2499- getCrosshairInfo,
2500- isCrosshairVisible,
25012439 getGrabbedBoxInfo,
25022440 getLabelInstancesInfo,
25032441 isGrabbedBoxVisible,
0 commit comments