mirror of
https://github.com/dscyrescotti/Memola.git
synced 2026-05-19 22:27:27 +02:00
feat: remove lock button
This commit is contained in:
@@ -32,7 +32,6 @@ final class Canvas: ObservableObject, Identifiable, @unchecked Sendable {
|
||||
|
||||
@Published var state: State = .initial
|
||||
@Published var zoomScale: CGFloat = .zero
|
||||
@Published var locksCanvas: Bool = false
|
||||
|
||||
@Published var gridMode: GridMode = .point
|
||||
|
||||
|
||||
@@ -260,11 +260,6 @@ extension CanvasViewController {
|
||||
self?.zoomChanged(zoomScale)
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
canvas.$locksCanvas
|
||||
.sink { [weak self] state in
|
||||
self?.lockModeChanged(state)
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
canvas.$gridMode
|
||||
.delay(for: .milliseconds(100), scheduler: DispatchQueue.main)
|
||||
.sink { [weak self] mode in
|
||||
|
||||
@@ -57,7 +57,7 @@ struct DashboardView: View {
|
||||
MemosView()
|
||||
}
|
||||
}
|
||||
.fullScreenCover(item: $memoManager.memo) { memo in
|
||||
.fullScreenCover(item: $memoManager.memoObject) { memo in
|
||||
MemoView(memo: memo)
|
||||
.onDisappear {
|
||||
withPersistence(\.viewContext) { context in
|
||||
|
||||
@@ -234,7 +234,6 @@ struct ElementToolbar: View {
|
||||
.contentShape(.rect(cornerRadius: 8))
|
||||
}
|
||||
.hoverEffect(.lift)
|
||||
.buttonStyle(.plain)
|
||||
#endif
|
||||
PhotosPicker(selection: $photosPickerItem, matching: .images, preferredItemEncoding: .compatible) {
|
||||
Image(systemName: "photo.fill.on.rectangle.fill")
|
||||
|
||||
@@ -109,7 +109,7 @@ struct MemoView: View {
|
||||
}
|
||||
}
|
||||
.overlay(alignment: .bottom) {
|
||||
if tool.selection != .hand && !canvas.locksCanvas {
|
||||
if tool.selection != .hand {
|
||||
Button {
|
||||
withAnimation {
|
||||
tool.selectTool(.hand)
|
||||
@@ -135,7 +135,6 @@ struct MemoView: View {
|
||||
let lowerBound: CGFloat = 10
|
||||
let zoomScale: CGFloat = (((canvas.zoomScale - canvas.minimumZoomScale) * (upperBound - lowerBound) / (canvas.maximumZoomScale - canvas.minimumZoomScale)) + lowerBound).rounded()
|
||||
let zoomScales: [Int] = [400, 200, 100, 75, 50, 25, 10]
|
||||
if !canvas.locksCanvas {
|
||||
#if os(macOS)
|
||||
Menu {
|
||||
ForEach(zoomScales, id: \.self) { scale in
|
||||
@@ -201,7 +200,6 @@ struct MemoView: View {
|
||||
.transition(.move(edge: .bottom).combined(with: .blurReplace))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
func loadingIndicator(_ title: String) -> some View {
|
||||
ProgressView {
|
||||
|
||||
@@ -29,8 +29,6 @@ struct PenDock: View {
|
||||
|
||||
var body: some View {
|
||||
#if os(macOS)
|
||||
ZStack(alignment: .bottomTrailing) {
|
||||
if !canvas.locksCanvas {
|
||||
VStack(alignment: .trailing) {
|
||||
penPropertyTool
|
||||
penItemList
|
||||
@@ -39,15 +37,8 @@ struct PenDock: View {
|
||||
.frame(maxHeight: .infinity)
|
||||
.padding(10)
|
||||
.transition(.move(edge: .trailing).combined(with: .blurReplace))
|
||||
}
|
||||
lockButton
|
||||
.padding(10)
|
||||
.transition(.move(edge: .trailing).combined(with: .blurReplace))
|
||||
}
|
||||
#else
|
||||
if horizontalSizeClass == .regular {
|
||||
ZStack(alignment: .bottomTrailing) {
|
||||
if !canvas.locksCanvas {
|
||||
VStack(alignment: .trailing) {
|
||||
penPropertyTool
|
||||
penItemList
|
||||
@@ -56,15 +47,7 @@ struct PenDock: View {
|
||||
.frame(maxHeight: .infinity)
|
||||
.padding(10)
|
||||
.transition(.move(edge: .trailing).combined(with: .blurReplace))
|
||||
}
|
||||
lockButton
|
||||
.padding(10)
|
||||
.transition(.move(edge: .trailing).combined(with: .blurReplace))
|
||||
}
|
||||
} else {
|
||||
GeometryReader { proxy in
|
||||
ZStack(alignment: .bottomTrailing) {
|
||||
if !canvas.locksCanvas {
|
||||
GeometryReader { proxy in
|
||||
HStack(alignment: .bottom, spacing: 10) {
|
||||
newPenButton
|
||||
@@ -87,14 +70,6 @@ struct PenDock: View {
|
||||
}
|
||||
.transition(.move(edge: .bottom).combined(with: .blurReplace))
|
||||
}
|
||||
lockButton
|
||||
.frame(maxWidth: .infinity, alignment: .bottomTrailing)
|
||||
.padding(10)
|
||||
.offset(y: canvas.locksCanvas || proxy.size.width > proxy.size.height ? 0 : -(height * factor - size + 30))
|
||||
.transition(.move(edge: .trailing).combined(with: .blurReplace))
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -331,7 +306,6 @@ struct PenDock: View {
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
.fill(.regularMaterial)
|
||||
}
|
||||
.transition(.move(edge: .trailing).combined(with: .blurReplace))
|
||||
} else {
|
||||
Color.clear
|
||||
.frame(width: width * factor - 18, height: 50)
|
||||
@@ -546,26 +520,6 @@ struct PenDock: View {
|
||||
}
|
||||
}
|
||||
|
||||
var lockButton: some View {
|
||||
Button {
|
||||
withAnimation {
|
||||
canvas.locksCanvas.toggle()
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: canvas.locksCanvas ? "lock.fill" : "lock.open.fill")
|
||||
.frame(width: size, height: size)
|
||||
.background(.regularMaterial)
|
||||
.clipShape(.rect(cornerRadius: 8))
|
||||
.contentShape(.rect(cornerRadius: 8))
|
||||
}
|
||||
#if os(iOS)
|
||||
.hoverEffect(.lift)
|
||||
#else
|
||||
.buttonStyle(.plain)
|
||||
#endif
|
||||
.contentTransition(.symbolEffect(.replace))
|
||||
}
|
||||
|
||||
func createNewPen() {
|
||||
let pen = PenObject.createObject(\.viewContext, penStyle: .marker)
|
||||
var selectedPen = tool.selectedPen
|
||||
|
||||
@@ -35,27 +35,21 @@ struct Toolbar: View {
|
||||
var body: some View {
|
||||
HStack(spacing: 5) {
|
||||
HStack(spacing: 5) {
|
||||
if !canvas.locksCanvas {
|
||||
closeButton
|
||||
titleField
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
#if os(macOS)
|
||||
if !canvas.locksCanvas {
|
||||
ElementToolbar(size: size, tool: tool, canvas: canvas)
|
||||
}
|
||||
#else
|
||||
if !canvas.locksCanvas, horizontalSizeClass == .regular {
|
||||
if horizontalSizeClass == .regular {
|
||||
ElementToolbar(size: size, tool: tool, canvas: canvas)
|
||||
}
|
||||
#endif
|
||||
HStack(spacing: 5) {
|
||||
if !canvas.locksCanvas {
|
||||
gridModeControl
|
||||
historyControl
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
}
|
||||
.font(.subheadline)
|
||||
|
||||
Reference in New Issue
Block a user