Skip to content

Commit 03956f6

Browse files
Fixed scroll button bug
1 parent 0ad75db commit 03956f6

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

UI/UI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def display_sorting(self, screen_group, options_screen_group, slide_in = True):
224224
self.SORTING_HEIGHT = (self.window.window.get_size()[1] - 2*self.TITLE_Y - 2*self.MARGIN_Y)
225225
self.SORTING_X = (3*self.window.window.get_size()[0]/4 - 2*self.MARGIN_X)/2 + self.MARGIN_X
226226
self.SORTING_Y = 2*self.TITLE_Y + self.MARGIN_Y + (self.window.window.get_size()[1] - 2*self.TITLE_Y - 2*self.MARGIN_Y)/2
227-
print(self.SORTING_X, self.SORTING_Y, self.SORTING_WIDTH, self.SORTING_HEIGHT)
227+
#print(self.SORTING_X, self.SORTING_Y, self.SORTING_WIDTH, self.SORTING_HEIGHT)
228228
self.array = Array(self.sorting_group, (self.SORTING_WIDTH, self.SORTING_HEIGHT), (self.MARGIN_X, self.SORTING_Y - self.SORTING_HEIGHT/2), 1, self.array_length, self.midi)
229229

230230
screen_group.add(Wrapper.Text(Wrapper.DefaultText.text("Sorting", Wrapper.FontSizes.TITLE_SIZE), (self.window.window.get_size()[0]/2, self.TITLE_Y), self.window, slide_in))

UI/Wrapper.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ def __init__(self, buttons, coords, dim, scroll_group, window, default_text, wil
345345
self.handled = -1
346346

347347
def button_checks(self):
348+
#print(self.selected.coords)
348349
# inefficient way of checking if buttons were pressed (TODO : Find faster way?)
349350
if (self.extended):
350351
for sprite in self.scroll_group.sprites():
@@ -355,6 +356,7 @@ def button_checks(self):
355356
self.selected = sprite.copy()
356357
#self.selected.setCoords(self.coords)
357358
self.selected.setDim(self.dim)
359+
self.selected.setCoords(self.coords)
358360
self.selected.is_chosen = True
359361
time.sleep(0.3) # TODO : Fix bug to not click buttons behind it
360362
self.toggle()
@@ -422,7 +424,6 @@ def draw_drop_menu(self):
422424

423425
self.init_mouse_y = pygame.mouse.get_pos()[1]
424426

425-
426427
def toggle(self):
427428
if (not self.drag):
428429
self.extended = not self.extended
@@ -435,15 +436,6 @@ def toggle(self):
435436
self.scroll_group.add(self.selected)
436437
self.scroll_button.set_pressable()
437438
self.selected.set_pressable()
438-
439-
# If its in options, advanced tools, etc where a window would pop up, the button shouldn't be pressed
440-
def check_overlap(self):
441-
if (self.window.screen == Screen.NONE and self.screen != Screen.NONE):
442-
self.scroll_button.set_unpressable()
443-
self.selected.set_unpressable()
444-
else:
445-
self.scroll_button.set_pressable()
446-
self.selected.set_pressable()
447439

448440
def set_pressable(self):
449441
self.scroll_button.set_pressable()
@@ -524,7 +516,7 @@ def slide(self):
524516
self.window.window.blit(self.text, self.textRect)
525517

526518
def copy(self):
527-
copy = ScrollButton(self.copy_text, self.function, self.window)
519+
copy = ScrollButton(self.copy_text, self.function, self.window, False, None)
528520
return copy
529521

530522
def setDim(self, dim):

0 commit comments

Comments
 (0)