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,6 +848,22 @@ class SpriteWindow_Selectable < SpriteWindow_Base
super
if self.active && @item_max > 0 && @index >= 0 && !@ignore_input
if Input.repeat?(Input::UP)
scroll_up()
elsif Input.repeat?(Input::DOWN)
scroll_down()
elsif Input.repeat?(Input::LEFT) && @column_max > 1
scroll_left()
elsif Input.repeat?(Input::RIGHT) && @column_max > 1
scroll_right()
elsif Input.repeat?(Input::JUMPUP) || Input.repeat?(Input::LEFT)
jump_up()
elsif Input.repeat?(Input::JUMPDOWN) || Input.repeat?(Input::RIGHT)
jump_down()
end
end
end
def scroll_up()
if @index >= @column_max ||
(Input.trigger?(Input::UP) && (@item_max % @column_max)==0)
oldindex = @index
@@ -857,7 +873,9 @@ class SpriteWindow_Selectable < SpriteWindow_Base
update_cursor_rect
end
end
elsif Input.repeat?(Input::DOWN)
end
def scroll_down()
if @index < @item_max - @column_max ||
(Input.trigger?(Input::DOWN) && (@item_max % @column_max)==0)
oldindex = @index
@@ -867,16 +885,9 @@ class SpriteWindow_Selectable < SpriteWindow_Base
update_cursor_rect
end
end
elsif Input.repeat?(Input::LEFT)
if @column_max >= 2 && @index > 0
oldindex = @index
@index -= 1
if @index!=oldindex
pbPlayCursorSE()
update_cursor_rect
end
end
elsif Input.repeat?(Input::RIGHT)
def scroll_left()
if @column_max >= 2 && @index < @item_max - 1
oldindex = @index
@index += 1
@@ -885,7 +896,21 @@ class SpriteWindow_Selectable < SpriteWindow_Base
update_cursor_rect
end
end
elsif Input.repeat?(Input::JUMPUP)
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
@@ -895,7 +920,10 @@ class SpriteWindow_Selectable < SpriteWindow_Base
update_cursor_rect
end
end
elsif Input.repeat?(Input::JUMPDOWN)
end
def jump_down()
if @index < @item_max-1
oldindex = @index
@index = [self.index+self.page_item_max, @item_max-1].min
@@ -906,8 +934,6 @@ class SpriteWindow_Selectable < SpriteWindow_Base
end
end
end
end
end
private