mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 14:40:50 +01:00
Merge pull request #31 from billsonnn/patch/object-location-offset
fix ObjectLocationView offset
This commit is contained in:
commit
0b90d779d9
@ -5,9 +5,9 @@ import { useRoomEngineEvent } from '../../../../../hooks';
|
||||
import { NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../layout';
|
||||
import { NitroLayoutBase } from '../../../../../layout/base';
|
||||
import { useRoomContext } from '../../../context/RoomContext';
|
||||
import { ContextMenuView } from '../../context-menu/ContextMenuView';
|
||||
import { ContextMenuHeaderView } from '../../context-menu/views/header/ContextMenuHeaderView';
|
||||
import { ContextMenuListView } from '../../context-menu/views/list/ContextMenuListView';
|
||||
import { ObjectLocationView } from '../../object-location/ObjectLocationView';
|
||||
|
||||
const SCORE_TYPES = ['perteam', 'mostwins', 'classic'];
|
||||
const CLEAR_TYPES = ['alltime', 'daily', 'weekly', 'monthly'];
|
||||
@ -57,7 +57,8 @@ export const FurnitureHighScoreView: FC<{}> = props =>
|
||||
if((objectId === -1) || !stuffData) return null;
|
||||
|
||||
return (
|
||||
<ContextMenuView objectId={ objectId } category={ RoomObjectCategory.FLOOR } close={ close } fades={ false } className="nitro-widget-high-score">
|
||||
<ObjectLocationView objectId={objectId} category={RoomObjectCategory.FLOOR} >
|
||||
<div className="nitro-widget-high-score nitro-context-menu">
|
||||
<ContextMenuHeaderView>
|
||||
{LocalizeText('high.score.display.caption', ['scoretype', 'cleartype'], [LocalizeText(`high.score.display.scoretype.${SCORE_TYPES[stuffData.scoreType]}`), LocalizeText(`high.score.display.cleartype.${CLEAR_TYPES[stuffData.clearType]}`)])}
|
||||
</ContextMenuHeaderView>
|
||||
@ -100,6 +101,8 @@ export const FurnitureHighScoreView: FC<{}> = props =>
|
||||
</NitroLayoutGridColumn>
|
||||
</NitroLayoutGrid>
|
||||
</ContextMenuListView>
|
||||
</ContextMenuView>
|
||||
</div>
|
||||
</ObjectLocationView>
|
||||
|
||||
);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ export const ObjectLocationView: FC<ObjectLocationViewProps> = props =>
|
||||
}, [ updatePosition, noFollow ]);
|
||||
|
||||
return (
|
||||
<div ref={ elementRef } className={ 'object-location position-absolute ' + (pos.x > -1 ? 'visible' : 'invisible') } style={ { left: pos.x, top: pos.y } }>
|
||||
<div ref={ elementRef } className={ 'object-location position-absolute ' + ( (pos.x + elementRef.current.offsetWidth )> -1 ? 'visible' : 'invisible') } style={ { left: pos.x, top: pos.y } }>
|
||||
{ children }
|
||||
</div>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user