()
| 12298 | } |
| 12299 | |
| 12300 | func layoutFrame() fyne.CanvasObject { |
| 12301 | entry := widget.NewEntry() |
| 12302 | layout := container.NewStack(entry) |
| 12303 | |
| 12304 | resizeWindow(ui.MaxWidth, ui.MaxHeight) |
| 12305 | session.Window.SetContent(layout) |
| 12306 | session.Window.SetFixedSize(false) |
| 12307 | |
| 12308 | go func() { |
| 12309 | time.Sleep(time.Second * 2) |
| 12310 | removeOverlays() |
| 12311 | |
| 12312 | ui.MaxWidth = entry.Size().Width |
| 12313 | ui.MaxHeight = entry.Size().Height |
| 12314 | lastOrientation := a.Driver().Device().Orientation() |
| 12315 | initialOrientationVertical := fyne.IsVertical(lastOrientation) |
| 12316 | |
| 12317 | ui.Width = ui.MaxWidth * 0.9 |
| 12318 | ui.Height = ui.MaxHeight |
| 12319 | ui.Padding = ui.MaxWidth * 0.05 |
| 12320 | if fyne.IsHorizontal(lastOrientation) { |
| 12321 | // Smaller if horizontal for swipe scroll |
| 12322 | ui.MaxWidth = ui.MaxWidth * 0.7 |
| 12323 | ui.Width = ui.MaxWidth * 0.7 |
| 12324 | ui.Padding = ui.MaxWidth * 0.15 |
| 12325 | } |
| 12326 | |
| 12327 | resizeWindow(ui.MaxWidth, ui.MaxHeight) |
| 12328 | session.Window.SetContent(layoutTransition()) |
| 12329 | session.Window.SetContent(layoutMain()) |
| 12330 | |
| 12331 | frameWidth := ui.MaxWidth |
| 12332 | frameHeight := ui.MaxHeight |
| 12333 | |
| 12334 | // Mobile loop checking if orientation has changed |
| 12335 | for a.Driver() != nil { |
| 12336 | currentOrientation := a.Driver().Device().Orientation() |
| 12337 | if lastOrientation != currentOrientation { |
| 12338 | if initialOrientationVertical { |
| 12339 | if fyne.IsVertical(lastOrientation) && !fyne.IsVertical(currentOrientation) { |
| 12340 | ui.MaxWidth = frameHeight |
| 12341 | ui.MaxHeight = frameWidth |
| 12342 | } else { |
| 12343 | ui.MaxWidth = frameWidth |
| 12344 | ui.MaxHeight = frameHeight |
| 12345 | } |
| 12346 | } else { |
| 12347 | if fyne.IsHorizontal(lastOrientation) && !fyne.IsHorizontal(currentOrientation) { |
| 12348 | ui.MaxWidth = frameHeight |
| 12349 | ui.MaxHeight = frameWidth |
| 12350 | } else { |
| 12351 | ui.MaxWidth = frameWidth |
| 12352 | ui.MaxHeight = frameHeight |
| 12353 | } |
| 12354 | } |
| 12355 | |
| 12356 | ui.Width = ui.MaxWidth * 0.9 |
| 12357 | ui.Height = ui.MaxHeight |
no test coverage detected