1
This commit is contained in:
parent
d363a9ef1f
commit
ffe344d633
@ -254,12 +254,21 @@ class MinecraftWikiButtonTheme(BaseButtonTheme):
|
||||
+ (button.font_height * 0.2)
|
||||
+ self.list_pad // 2
|
||||
)
|
||||
|
||||
self.back_ground.x = self.x + (self.pad * 2)
|
||||
self.back_ground.y = self.y + (self.pad * 2)
|
||||
self.back_ground.position = self.x + (self.pad * 2), self.y + (self.pad * 2)
|
||||
self.back_ground.height = self.height - (self.pad * 4)
|
||||
self.cover_back.x = self.x + self.pad
|
||||
self.cover_back.y = self.y + self.pad
|
||||
self.cover_back.position = self.x + self.pad, self.y + self.pad
|
||||
self.cover_back.height = self.height - (self.pad * 2)
|
||||
self.cover_back2.x = self.x + self.pad
|
||||
self.cover_back2.y = self.y + self.pad
|
||||
self.cover_back2.position = self.x + self.pad, self.y + self.pad
|
||||
self.cover_back2.height = self.height - (self.pad * 3)
|
||||
self.list_back.x = self.x
|
||||
self.list_back.y = self.y
|
||||
else:
|
||||
button.text_label.y = (
|
||||
self.y
|
||||
@ -381,6 +390,28 @@ class PressTextButton(widgets.WidgetBase):
|
||||
|
||||
self.value = text # 重新分配一下高度和宽度的位置
|
||||
|
||||
@property
|
||||
def x(self) -> int:
|
||||
return self._x
|
||||
|
||||
@x.setter
|
||||
def x(self, value: int) -> None:
|
||||
self._x = value
|
||||
self.text_label.x = value
|
||||
self.draw_theme.x = value
|
||||
self.draw_theme.on_update(self)
|
||||
|
||||
@property
|
||||
def y(self) -> int:
|
||||
return self._y
|
||||
|
||||
@y.setter
|
||||
def y(self, value: int) -> None:
|
||||
self._y = value
|
||||
self.text_label.y = value + 4
|
||||
self.draw_theme.y = value
|
||||
self.draw_theme.on_update(self)
|
||||
|
||||
@property
|
||||
def value(self):
|
||||
return self.text
|
||||
|
@ -510,8 +510,22 @@ class SR1ShipRender(BaseScreen):
|
||||
and x <= self.ships_buttons_end_x \
|
||||
and y >= self.ships_buttons_begin_y \
|
||||
and y <= self.ships_buttons_end_y:
|
||||
min_y = 9999999
|
||||
max_y = 0
|
||||
for ship_button in self.ships_buttons:
|
||||
ship_button.back_rec.position = ship_button.back_rec.position[0], ship_button.back_rec.position[1] + scroll_y
|
||||
min_y = min(min_y, ship_button.y)
|
||||
max_y = max(max_y, ship_button.y)
|
||||
|
||||
if max_y + scroll_y * 50 <= self.height:
|
||||
scroll_y = (self.height - max_y) / 50
|
||||
|
||||
if min_y + scroll_y * 50 >= 10:
|
||||
scroll_y = (10 - min_y) / 50
|
||||
|
||||
|
||||
|
||||
for ship_button in self.ships_buttons:
|
||||
ship_button.y = ship_button.y + scroll_y * 50
|
||||
|
||||
|
||||
|
||||
@ -801,7 +815,6 @@ class PressOpenShipButton(PressTextButton):
|
||||
def get_y(self):
|
||||
return self.y
|
||||
|
||||
|
||||
def on_mouse_release(self, x, y, buttons, modifiers):
|
||||
if self.pressed and (x, y) in self:
|
||||
if self.draw_theme:
|
||||
|
Loading…
Reference in New Issue
Block a user