7 changed files with 203 additions and 146 deletions
-
4kplayer.xcodeproj/project.pbxproj
-
1kplayer/core/MediaItem.swift
-
25kplayer/detail/DetailViewController+Show.swift
-
72kplayer/detail/EditItemView.swift
-
70kplayer/photo/SPhotoAlbumView.swift
-
5kplayer/photo/SPhotoModel.swift
-
172kplayer/photo/SPhotoView.swift
@ -0,0 +1,70 @@ |
|||||
|
// |
||||
|
// Created by Marco Schmickler on 26.06.22. |
||||
|
// Copyright (c) 2022 Marco Schmickler. All rights reserved. |
||||
|
// |
||||
|
|
||||
|
import Foundation |
||||
|
import SwiftUI |
||||
|
|
||||
|
struct SPhotoAlbumView: View { |
||||
|
var completionHandler: ((Bool) -> Void)? |
||||
|
@ObservedObject |
||||
|
var model: SPhotoModel |
||||
|
|
||||
|
@State var more = false |
||||
|
@State var edit = false |
||||
|
|
||||
|
init(completionHandler: ((Bool) -> ())?, model: SPhotoModel) { |
||||
|
self.completionHandler = completionHandler |
||||
|
self.model = model |
||||
|
} |
||||
|
|
||||
|
var body: some View { |
||||
|
let v = VStack { |
||||
|
HStack { |
||||
|
Group { |
||||
|
Button(action: { |
||||
|
cleanup() |
||||
|
completionHandler!(true) |
||||
|
}, label: { |
||||
|
//Text("cancel") |
||||
|
Text("X").frame(width: 30) |
||||
|
})//.foregroundColor(update ? Color.yellow : Color.blue) |
||||
|
.buttonStyle(BorderlessButtonStyle()) |
||||
|
Button(action: { |
||||
|
more.toggle() |
||||
|
}, label: { |
||||
|
//Text("cancel") |
||||
|
Text("\(model.index)").frame(width: 70) |
||||
|
})//.foregroundColor(update ? Color.yellow : Color.blue) |
||||
|
.buttonStyle(BorderlessButtonStyle()) |
||||
|
Spacer() |
||||
|
SPhotoScrubber(model: model) |
||||
|
} |
||||
|
} |
||||
|
.frame(height: 50) |
||||
|
SPhotoView(model: model) |
||||
|
} |
||||
|
if more { |
||||
|
v.overlay(VStack { |
||||
|
KToggleButton(text: "spring", binding: $model.spring).frame(height: 30) |
||||
|
KToggleButton(text: "edit", binding: $edit).frame(height: 30) |
||||
|
} |
||||
|
.frame(width: 60, alignment: .top).offset(x: 0, y: 70), alignment: .topLeading).overlay(TagEditor(item: model.allItems[model.index]) |
||||
|
.frame(width: 60, alignment: .top).offset(x: 0, y: 70), |
||||
|
alignment: .topTrailing) |
||||
|
} |
||||
|
else { |
||||
|
v |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
func cleanup() { |
||||
|
for i in model.allItems { |
||||
|
i.thumbImage = nil |
||||
|
i.image = nil |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue