normalize legacy controller position

This commit is contained in:
TrueZhuangjia authored and TrueZhuanjia committed 2025-03-29 20:22:32 +08:00
1 parent 94f2e39367
commit c8522de476
4 files changed
+46 -5

No files matched your search

+9
View File
@@ -376,6 +376,14 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
}
}
- (CGPoint)denormalizeWidgetPosition:(CGPoint)position {
if(position.x < 1.0 && position.y < 1.0){
position.x = position.x * self.bounds.size.width;
position.y = position.y * self.bounds.size.height;
}
return position;
}
- (void) reloadOnScreenWidgetViews{
NSLog(@"reload on screen keyboard buttons here");
@@ -408,6 +416,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
widgetView.minStickOffset = buttonState.minStickOffset;
// Add the widgetView to the view controller's view
[self->streamFrameTopLayerView addSubview:widgetView]; // add keyboard button to the stream frame view. must add it to the target view before setting location.
buttonState.position = [self denormalizeWidgetPosition:buttonState.position];
[widgetView setLocationWithXOffset:buttonState.position.x yOffset:buttonState.position.y];
[widgetView resizeWidgetView]; // resize must be called after relocation
[widgetView adjustTransparencyWithAlpha:buttonState.backgroundAlpha];