Makes it possible to jump up and down 1 colomn lists with the left and right arrows

This commit is contained in:
infinitefusion
2023-07-16 09:31:00 -04:00
parent ba6b1b47d4
commit 17a2d9b97a

View File

@@ -848,63 +848,89 @@ class SpriteWindow_Selectable < SpriteWindow_Base
super super
if self.active && @item_max > 0 && @index >= 0 && !@ignore_input if self.active && @item_max > 0 && @index >= 0 && !@ignore_input
if Input.repeat?(Input::UP) if Input.repeat?(Input::UP)
if @index >= @column_max || scroll_up()
(Input.trigger?(Input::UP) && (@item_max % @column_max)==0)
oldindex = @index
@index = (@index - @column_max + @item_max) % @item_max
if @index!=oldindex
pbPlayCursorSE()
update_cursor_rect
end
end
elsif Input.repeat?(Input::DOWN) elsif Input.repeat?(Input::DOWN)
if @index < @item_max - @column_max || scroll_down()
(Input.trigger?(Input::DOWN) && (@item_max % @column_max)==0) elsif Input.repeat?(Input::LEFT) && @column_max > 1
oldindex = @index scroll_left()
@index = (@index + @column_max) % @item_max elsif Input.repeat?(Input::RIGHT) && @column_max > 1
if @index!=oldindex scroll_right()
pbPlayCursorSE() elsif Input.repeat?(Input::JUMPUP) || Input.repeat?(Input::LEFT)
update_cursor_rect jump_up()
end elsif Input.repeat?(Input::JUMPDOWN) || Input.repeat?(Input::RIGHT)
end jump_down()
elsif Input.repeat?(Input::LEFT) end
if @column_max >= 2 && @index > 0 end
oldindex = @index end
@index -= 1
if @index!=oldindex def scroll_up()
pbPlayCursorSE() if @index >= @column_max ||
update_cursor_rect (Input.trigger?(Input::UP) && (@item_max % @column_max)==0)
end oldindex = @index
end @index = (@index - @column_max + @item_max) % @item_max
elsif Input.repeat?(Input::RIGHT) if @index!=oldindex
if @column_max >= 2 && @index < @item_max - 1 pbPlayCursorSE()
oldindex = @index update_cursor_rect
@index += 1 end
if @index!=oldindex end
pbPlayCursorSE() end
update_cursor_rect
end def scroll_down()
end if @index < @item_max - @column_max ||
elsif Input.repeat?(Input::JUMPUP) (Input.trigger?(Input::DOWN) && (@item_max % @column_max)==0)
if @index > 0 oldindex = @index
oldindex = @index @index = (@index + @column_max) % @item_max
@index = [self.index-self.page_item_max, 0].max if @index!=oldindex
if @index!=oldindex pbPlayCursorSE()
pbPlayCursorSE() update_cursor_rect
self.top_row -= self.page_row_max end
update_cursor_rect end
end end
end
elsif Input.repeat?(Input::JUMPDOWN) def scroll_left()
if @index < @item_max-1 if @column_max >= 2 && @index < @item_max - 1
oldindex = @index oldindex = @index
@index = [self.index+self.page_item_max, @item_max-1].min @index += 1
if @index!=oldindex if @index!=oldindex
pbPlayCursorSE() pbPlayCursorSE()
self.top_row += self.page_row_max update_cursor_rect
update_cursor_rect end
end end
end end
def scroll_right()
if @column_max >= 2 && @index > 0
oldindex = @index
@index -= 1
if @index!=oldindex
pbPlayCursorSE()
update_cursor_rect
end
end
end
def jump_up()
if @index > 0
oldindex = @index
@index = [self.index-self.page_item_max, 0].max
if @index!=oldindex
pbPlayCursorSE()
self.top_row -= self.page_row_max
update_cursor_rect
end
end
end
def jump_down()
if @index < @item_max-1
oldindex = @index
@index = [self.index+self.page_item_max, @item_max-1].min
if @index!=oldindex
pbPlayCursorSE()
self.top_row += self.page_row_max
update_cursor_rect
end end
end end
end end