[bugfix] Main Page: Message Box Ratio. store the data in float and fix the bug that was set bit off message box's height.

This commit is contained in:
Sakamoto Shiina
2024-10-11 04:25:34 +09:00
parent 31d8b503d0
commit 99cd3d1df0
5 changed files with 6 additions and 5 deletions

View File

@@ -399,7 +399,7 @@ class Config:
@MESSAGE_BOX_RATIO.setter
def MESSAGE_BOX_RATIO(self, value):
if isinstance(value, int) and self.MESSAGE_BOX_RATIO_RANGE[0] <= value <= self.MESSAGE_BOX_RATIO_RANGE[1]:
if isinstance(value, float):
self._MESSAGE_BOX_RATIO = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)

View File

@@ -549,7 +549,7 @@ class Controller:
@staticmethod
def setMessageBoxRatio(data, *args, **kwargs) -> dict:
config.MESSAGE_BOX_RATIO = int(data)
config.MESSAGE_BOX_RATIO = float(data)
return {"status":200, "result":config.MESSAGE_BOX_RATIO}
@staticmethod

View File

@@ -49,8 +49,8 @@ export const MessageContainer = () => {
const container_height = container_ref.current.offsetHeight;
const container_padding_bottom = parseFloat(window.getComputedStyle(container_ref.current).paddingBottom);
const total_height = container_height - container_padding_bottom;
return ((ratio / 100) * total_height / 10) | 0; // 10px = 1rem
if (total_height === 0) return 0;
return ((ratio / 100) * total_height / 10); // 10px = 1rem
};

View File

@@ -11,7 +11,7 @@
width: 100%;
justify-content: space-between;
align-items: center;
height: 2rem;
height: var(--title_bar_height);
margin-top: 0.4rem;
}

View File

@@ -46,6 +46,7 @@
--dark_1000_color: #151517;
--title_bar_height: 2rem;
--main_page_topbar_height: 4.8rem;
--config_page_sidebar_width: 18rem;
--config_page_topbar_height: 8rem;