mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-25 13:42:43 +00:00
Restore world-stable name scaling
This commit is contained in:
@@ -25,8 +25,8 @@ import { NameLayerAssets } from "./NameLayerAssets";
|
||||
import {
|
||||
computeNameLayerFontSize,
|
||||
computeNameLayerLayout,
|
||||
computeNameLayerScale,
|
||||
computeNameLayerVisible,
|
||||
computeNameLayerWorldScale,
|
||||
computeTraitorFlashAlpha,
|
||||
replaceUnsupportedNameGlyphs,
|
||||
} from "./NameLayerLayout";
|
||||
@@ -347,11 +347,13 @@ export class NameLayer implements Layer {
|
||||
const screenPos = this.transformHandler.worldToCanvasCoordinates(
|
||||
render.location,
|
||||
);
|
||||
render.container.position.set(
|
||||
Math.round(screenPos.x),
|
||||
Math.round(screenPos.y),
|
||||
render.container.position.set(screenPos.x, screenPos.y);
|
||||
render.container.scale.set(
|
||||
computeNameLayerWorldScale(
|
||||
render.baseSize,
|
||||
this.transformHandler.scale,
|
||||
),
|
||||
);
|
||||
render.container.scale.set(computeNameLayerScale(render.baseSize));
|
||||
this.updateTraitorAlpha(render, now);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,13 @@ export function computeNameLayerScale(baseSize: number): number {
|
||||
return Math.min(baseSize * 0.25, 3);
|
||||
}
|
||||
|
||||
export function computeNameLayerWorldScale(
|
||||
baseSize: number,
|
||||
transformScale: number,
|
||||
): number {
|
||||
return computeNameLayerScale(baseSize) * transformScale;
|
||||
}
|
||||
|
||||
export function computeNameLayerFontSize(baseSize: number): number {
|
||||
return Math.max(4, Math.floor(baseSize * 0.4));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user