| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 0 |
| 经验 | |
| 最后登录 | 2015-7-19 |
| 在线时间 | 157 小时 |
- 梦石
- 0
- 星屑
- 49
- 在线时间
- 157 小时
- 注册时间
- 2013-8-14
- 回帖
- 155
|
楼主 |
发表于 2014-8-6 12:35:11
|
显示全部楼层
九靈 发表于 2014-8-6 11:03 
打错是page_row_max
#--------------------------------------------------------------------------
# ● 更新光标
#--------------------------------------------------------------------------
def update_cursor
if @cursor_all
cursor_rect.set(0, 0, contents.width, row_max * item_height)
self.top_row = 0
elsif @index < 0
cursor_rect.empty
else
ensure_cursor_visible
cursor_rect.set(item_rect(@index))
end
end
#--------------------------------------------------------------------------
# ● 获取项目的绘制矩形
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new
rect.width = item_width
rect.height = item_height
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * item_height
rect
end
整合起来
cursor_rect.set(item_rect(@index))
相当于
cursor_rect.set(rect)
嗯...个人理解... |
|