🐛[bugfix] Model : overlayのui_scalingの処理を修正
This commit is contained in:
14
model.py
14
model.py
@@ -78,10 +78,10 @@ class Model:
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS["depth"],
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"],
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS["fadeout_duration"],
|
||||
config.OVERLAY_SETTINGS["ui_scaling"],
|
||||
)
|
||||
self.overlay_image = OverlayImage(
|
||||
config.OVERLAY_SETTINGS["opacity"],
|
||||
config.OVERLAY_SETTINGS["ui_scaling"],
|
||||
)
|
||||
self.pre_overlay_message = None
|
||||
self.th_overlay = None
|
||||
@@ -637,14 +637,6 @@ class Model:
|
||||
def updateOverlayImageUiScaling(self):
|
||||
if self.overlay.initFlag is True:
|
||||
ui_scaling = config.OVERLAY_SETTINGS["ui_scaling"]
|
||||
self.overlay_image.setUiScaling(ui_scaling)
|
||||
if self.pre_overlay_message is not None:
|
||||
img = self.overlay_image.createOverlayImageShort(
|
||||
self.pre_overlay_message["message"],
|
||||
self.pre_overlay_message["your_language"],
|
||||
self.pre_overlay_message["translation"],
|
||||
self.pre_overlay_message["target_language"],
|
||||
self.pre_overlay_message["ui_type"]
|
||||
)
|
||||
self.overlay.uiManager.setImage(img)
|
||||
self.overlay.uiManager.setUiScaling(ui_scaling)
|
||||
|
||||
model = Model()
|
||||
@@ -36,7 +36,7 @@ class UIElement:
|
||||
self.setTransparency(self.settings['Transparency'])
|
||||
self.overlay.setOverlayWidthInMeters(
|
||||
self.handle,
|
||||
self.settings['Normalized_icon_width'] * self.settings['Icon_plane_depth']
|
||||
self.settings['Ui_scaling']
|
||||
)
|
||||
|
||||
self.updatePosition()
|
||||
@@ -82,6 +82,12 @@ class UIElement:
|
||||
def setDepth(self, depth):
|
||||
self.settings["Icon_plane_depth"] = depth
|
||||
|
||||
def setUiScaling(self, ui_scaling):
|
||||
self.overlay.setOverlayWidthInMeters(
|
||||
self.handle,
|
||||
ui_scaling,
|
||||
)
|
||||
|
||||
class UIManager:
|
||||
def __init__(self, overlay_key, overlay_name, settings):
|
||||
self.overlay = openvr.IVROverlay()
|
||||
@@ -131,8 +137,11 @@ class UIManager:
|
||||
def setFadeInterval(self, fade_interval):
|
||||
self.settings["Fade_interval"] = fade_interval
|
||||
|
||||
def setUiScaling(self, ui_scaling):
|
||||
self.overlayUI.setUiScaling(ui_scaling)
|
||||
|
||||
class Overlay:
|
||||
def __init__(self, x, y , depth, fade_time, fade_interval):
|
||||
def __init__(self, x, y , depth, fade_time, fade_interval, ui_scaling):
|
||||
self.initFlag = False
|
||||
settings = {
|
||||
"Color": [1, 1, 1],
|
||||
@@ -143,6 +152,7 @@ class Overlay:
|
||||
"Normalized_icon_width": 1,
|
||||
"Fade_time": fade_time,
|
||||
"Fade_interval": fade_interval,
|
||||
"Ui_scaling": ui_scaling,
|
||||
}
|
||||
self.settings = settings
|
||||
|
||||
|
||||
@@ -18,9 +18,8 @@ class OverlayImage:
|
||||
"Chinese Traditional": "NotoSansTC-Regular",
|
||||
}
|
||||
|
||||
def __init__(self, opacity, ui_scaling):
|
||||
def __init__(self, opacity):
|
||||
self.opacity = int(opacity*255)
|
||||
self.ui_scaling = ui_scaling
|
||||
|
||||
@staticmethod
|
||||
def concatenateImagesVertically(img1: Image, img2: Image) -> Image:
|
||||
@@ -142,14 +141,11 @@ class OverlayImage:
|
||||
def setOpacity(self, opacity):
|
||||
self.opacity = int(opacity*255)
|
||||
|
||||
def setUiScaling(self, ui_scaling):
|
||||
self.ui_scaling = ui_scaling
|
||||
|
||||
def getUiSize(self):
|
||||
return {
|
||||
"width": int(960*self.ui_scaling),
|
||||
"height": int(23*self.ui_scaling),
|
||||
"font_size": int(23*self.ui_scaling),
|
||||
"width": 960,
|
||||
"height": 23,
|
||||
"font_size": 23,
|
||||
}
|
||||
|
||||
def getUiColors(self, ui_type):
|
||||
|
||||
Reference in New Issue
Block a user