@@ -93,30 +93,52 @@ export namespace SectionRenderer {
9393 }
9494
9595 export function renderBigTitle ( section : Section ) {
96- if ( Camera . currentScale < Section . bigTitleCameraScale ) {
97- const fontSizeVector = getFontSizeBySectionSize ( section ) ;
98- const fontHeight = fontSizeVector . y ;
99- ShapeRenderer . renderRect (
100- new Rectangle (
101- Renderer . transformWorld2View ( section . rectangle . location ) ,
102- section . rectangle . size . multiply ( Camera . currentScale ) ,
103- ) ,
104- section . color . a === 0
105- ? StageStyleManager . currentStyle . BackgroundColor . toNewAlpha ( 0.5 )
106- : section . color . toNewAlpha ( 0.5 ) ,
107- StageStyleManager . currentStyle . StageObjectBorderColor ,
108- 2 * Camera . currentScale ,
109- ) ;
110- // 缩放过小了,显示巨大化文字
111- TextRenderer . renderTextFromCenter (
112- section . text ,
113- Renderer . transformWorld2View ( section . rectangle . center ) ,
114- fontHeight * Camera . currentScale ,
115- section . color . a === 1
116- ? colorInvert ( section . color )
117- : colorInvert ( StageStyleManager . currentStyle . BackgroundColor ) ,
118- ) ;
96+ if ( Camera . currentScale >= Section . bigTitleCameraScale ) {
97+ return ;
11998 }
99+ const fontSizeVector = getFontSizeBySectionSize ( section ) ;
100+ const fontHeight = fontSizeVector . y ;
101+ ShapeRenderer . renderRect (
102+ new Rectangle (
103+ Renderer . transformWorld2View ( section . rectangle . location ) ,
104+ section . rectangle . size . multiply ( Camera . currentScale ) ,
105+ ) ,
106+ section . color . a === 0
107+ ? StageStyleManager . currentStyle . BackgroundColor . toNewAlpha ( 0.5 )
108+ : section . color . toNewAlpha ( 0.5 ) ,
109+ StageStyleManager . currentStyle . StageObjectBorderColor ,
110+ 2 * Camera . currentScale ,
111+ ) ;
112+ // 缩放过小了,显示巨大化文字
113+ TextRenderer . renderTextFromCenter (
114+ section . text ,
115+ Renderer . transformWorld2View ( section . rectangle . center ) ,
116+ fontHeight * Camera . currentScale ,
117+ section . color . a === 1 ? colorInvert ( section . color ) : colorInvert ( StageStyleManager . currentStyle . BackgroundColor ) ,
118+ ) ;
119+
120+ // =========== 另一种方法
121+ // const fontSize = 30 * (0.5 * Camera.currentScale + 0.5);
122+ // const leftTopLocation = section.collisionBox.getRectangle().leftTop;
123+ // const leftTopViewLocation = Renderer.transformWorld2View(leftTopLocation);
124+ // const leftTopFontViewLocation = leftTopViewLocation.subtract(new Vector(0, fontSize));
125+ // const bgColor =
126+ // section.color.a === 0
127+ // ? StageStyleManager.currentStyle.BackgroundColor.toNewAlpha(0.5)
128+ // : section.color.toNewAlpha(0.5);
129+
130+ // const textColor =
131+ // section.color.a === 1 ? colorInvert(section.color) : colorInvert(StageStyleManager.currentStyle.BackgroundColor);
132+ // const textSize = getTextSize(section.text, fontSize);
133+ // ShapeRenderer.renderRect(
134+ // new Rectangle(leftTopFontViewLocation, textSize).expandFromCenter(2),
135+ // bgColor,
136+ // StageStyleManager.currentStyle.StageObjectBorderColor,
137+ // 2 * Camera.currentScale,
138+ // 2,
139+ // );
140+
141+ // TextRenderer.renderText(section.text, leftTopFontViewLocation, fontSize, textColor);
120142 }
121143
122144 function getFontSizeBySectionSize ( section : Section ) : Vector {
0 commit comments