Skip to content

Commit

Permalink
fix: ensure use same text size when grid is hidden for players
Browse files Browse the repository at this point in the history
  • Loading branch information
n1ru4l committed May 18, 2021
1 parent f16022a commit 7396338
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/dm-area/dm-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -834,12 +834,11 @@ export const DmMap = (props: {
markedAreas={props.markedAreas}
removeMarkedArea={props.removeMarkedArea}
grid={
props.map.grid &&
props.map.showGrid &&
activeTool !== ConfigureGridMapTool
props.map.grid && activeTool !== ConfigureGridMapTool
? props.map.grid
: null
}
isGridVisible={props.map.showGrid}
sharedContexts={[
MarkAreaToolContext,
BrushToolContext,
Expand Down
11 changes: 8 additions & 3 deletions src/map-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ const TokenRenderer = (props: {
[animatedProps.circleScale, animatedProps.position],
([scale], [x, y, z]) =>
query.data?.tokenImage
? [x, y - 0.03 - initialRadius * scale, z]
? [x, y - 0.04 - initialRadius * scale, z]
: [x, y, z]
)}
renderOrder={LayerRenderOrder.token}
Expand All @@ -728,7 +728,7 @@ const TokenRenderer = (props: {
text={textLabel}
position={undefined}
backgroundColor={query.data?.tokenImage ? "#ffffff" : null}
fontSize={(columnWidth * sharedMapState.ratio) / 2800}
fontSize={(columnWidth * sharedMapState.ratio) / 930}
/>
</animated.group>
) : null}
Expand Down Expand Up @@ -1092,6 +1092,7 @@ const MapRenderer: React.FC<{
markedAreas: MarkedAreaEntity[];
removeMarkedArea: (id: string) => void;
grid: MapGridEntity | null;
isGridVisible: boolean;
scale: SpringValue<[number, number, number]>;
factor: number;
dimensions: Dimensions;
Expand All @@ -1108,7 +1109,7 @@ const MapRenderer: React.FC<{
/>
<meshStandardMaterial attach="material" map={props.mapImageTexture} />
</mesh>
{props.grid ? (
{props.grid && props.isGridVisible ? (
<GridRenderer
grid={props.grid}
dimensions={props.dimensions}
Expand Down Expand Up @@ -1183,6 +1184,7 @@ const MapViewRenderer = (props: {
markedAreas: MarkedAreaEntity[];
removeMarkedArea: (id: string) => void;
grid: MapGridEntity | null;
isGridVisible: boolean;
activeTool: MapTool | null;
fogOpacity: number;
}): React.ReactElement => {
Expand Down Expand Up @@ -1480,6 +1482,7 @@ const MapViewRenderer = (props: {
markedAreas={props.markedAreas}
removeMarkedArea={props.removeMarkedArea}
grid={props.grid}
isGridVisible={props.isGridVisible}
scale={spring.scale}
dimensions={dimensions}
factor={
Expand Down Expand Up @@ -1513,6 +1516,7 @@ export const MapView = (props: {
markedAreas: MarkedAreaEntity[];
removeMarkedArea: (id: string) => void;
grid: MapGridEntity | null;
isGridVisible: boolean;
activeTool: MapTool | null;
/* List of contexts that need to be proxied into R3F */
sharedContexts: Array<React.Context<any>>;
Expand Down Expand Up @@ -1565,6 +1569,7 @@ export const MapView = (props: {
markedAreas={props.markedAreas}
removeMarkedArea={props.removeMarkedArea}
grid={props.grid}
isGridVisible={props.isGridVisible}
fogOpacity={props.fogOpacity}
/>
</ContextBridge>
Expand Down
7 changes: 2 additions & 5 deletions src/player-area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,8 @@ const PlayerMap: React.FC<{
markedAreas.filter((area) => area.id !== id)
);
}}
grid={
currentMap.grid && currentMap.showGridToPlayers
? currentMap.grid
: null
}
grid={currentMap.grid}
isGridVisible={currentMap.showGridToPlayers}
sharedContexts={[
MarkAreaToolContext,
NoteWindowActionsContext,
Expand Down

0 comments on commit 7396338

Please sign in to comment.