| 
 
| 赞 | 3 |  
| VIP | 0 |  
| 好人卡 | 0 |  
| 积分 | 42 |  
| 经验 | 13328 |  
| 最后登录 | 2025-10-19 |  
| 在线时间 | 265 小时 |  
 Lv3.寻梦者 
	梦石0 星屑4217 在线时间265 小时注册时间2013-10-13帖子815 | 
| 
#--------------------------------------------------------------------------
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  # ● 更新光标矩形
 #--------------------------------------------------------------------------
 def update_cursor_rect
 # 光标位置不满 0 的情况下
 if @index < 0
 self.cursor_rect.empty
 return
 end
 # 获取当前的行
 row = @index / @column_max
 # 当前行被显示开头行前面的情况下
 if row < self.top_row
 # 从当前行向开头行滚动
 self.top_row = row
 end
 # 当前行被显示末尾行之后的情况下
 if row > self.top_row + (self.page_row_max - 1)
 # 从当前行向末尾滚动
 self.top_row = row - (self.page_row_max - 1)
 end
 # 计算光标的宽度
 cursor_width = self.width / @column_max - 32
 # 计算光标坐标
 x = @index % @column_max * (cursor_width + 32)
 y = @index / @column_max * 32 - self.oy
 # 更新光标矩形
 self.cursor_rect.set(x, y, cursor_width, 32)
 end
 
 请问:关于光标滚动的问题,应该怎么理解光标滚动的原理?
 
 | 
 |