From 67289cda7d22026f5fc02309c9ccf6eda34ebc17 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Wed, 20 Nov 2024 05:51:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=8D=E5=85=B8=E6=BB=9A=E5=8A=A8=E6=95=88?= =?UTF-8?q?=E6=9E=9C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/scene/dictionary.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/assets/scene/dictionary.lua b/assets/scene/dictionary.lua index b910ef54..4c642044 100644 --- a/assets/scene/dictionary.lua +++ b/assets/scene/dictionary.lua @@ -25,8 +25,12 @@ local aboveScene local searchTimer,lastSearchText local time,quiting local selected +---@class Techmino.DictContent local contents={ _width=0, + maxScroll=0, + scroll=0, + scroll1=0, title=GC.newText(FONT.get(30),''), texts={}, } @@ -70,6 +74,7 @@ local function selectItem(item) contents.title=selected.titleText contents._width,contents.texts=FONT.get(item.contentSize):getWrap(item.content,mainW-30) contents.scroll=0 + contents.scroll1=0 contents.maxScroll=126+(contents.title:getHeight()+5)-(mainH-searchH) for i=1,#contents.texts do local str=contents.texts[i] @@ -91,10 +96,10 @@ local function selectItem(item) else contents.title="x" contents.texts=NONE - contents.scroll=0 contents.maxScroll=0 end contents.scroll=0 + contents.scroll1=0 end local function openLink() if selected.link then @@ -414,6 +419,7 @@ function scene.wheelMove(_,y) end function scene.update(dt) + contents.scroll1=MATH.expApproach(contents.scroll1,contents.scroll,dt*26) if aboveScene.update then aboveScene.update(dt) end @@ -485,7 +491,7 @@ function scene.draw() gc_stc_reset() gc_stc_rect(0,-mainH/2,mainW,mainH-searchH-5,5) gc_setColor(categoryColor[selected.cat].content) - gc_translate(0,-contents.scroll) + gc_translate(0,-contents.scroll1) -- Title gc_draw(contents.title,15,-mainH/2+5,nil,math.min(1,(mainW-25)/contents.title:getWidth()),1) gc_translate(0,contents.title:getHeight())