mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Resize Servo on surface resize
This commit is contained in:
parent
10f86935b8
commit
b2c56940eb
2 changed files with 15 additions and 2 deletions
|
@ -51,6 +51,8 @@ void ServoControl::OnLoaded(IInspectable const &, RoutedEventArgs const &) {
|
|||
});
|
||||
panel.ManipulationDelta(
|
||||
std::bind(&ServoControl::OnSurfaceManipulationDelta, this, _1, _2));
|
||||
Panel().SizeChanged(
|
||||
std::bind(&ServoControl::OnSurfaceResized, this, _1, _2));
|
||||
InitializeConditionVariable(&mGLCondVar);
|
||||
InitializeCriticalSection(&mGLLock);
|
||||
CreateRenderSurface();
|
||||
|
@ -100,6 +102,14 @@ void ServoControl::OnSurfaceClicked(IInspectable const &,
|
|||
e.Handled(true);
|
||||
}
|
||||
|
||||
void ServoControl::OnSurfaceResized(IInspectable const &,
|
||||
SizeChangedEventArgs const &e) {
|
||||
auto size = e.NewSize();
|
||||
auto w = size.Width * mDPI;
|
||||
auto h = size.Height * mDPI;
|
||||
RunOnGLThread([=] { mServo->SetSize(w, h); });
|
||||
}
|
||||
|
||||
void ServoControl::GoBack() {
|
||||
RunOnGLThread([=] { mServo->GoBack(); });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue