drag appearance looks better

undo
saint 2023-08-04 15:02:22 -04:00
parent f6dd4f0f2c
commit 2de85571af
1 changed files with 8 additions and 1 deletions

View File

@ -153,26 +153,31 @@ struct RibbonCrown : View {
.if(draggedRibbon != nil && draggedRibbon!.id == ribbon.id && isDragging) { $0.overlay(Color(red: 0.1, green: 0.1, blue: 0.1)) } .if(draggedRibbon != nil && draggedRibbon!.id == ribbon.id && isDragging) { $0.overlay(Color(red: 0.1, green: 0.1, blue: 0.1)) }
.offset(x: 10)
Text(ribbon.title) Text(ribbon.title)
.foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00))) .foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00)))
// .foregroundColor(.white)) // .foregroundColor(.white))
// .foregroundColor(.black) // .foregroundColor(.black)
.frame(minWidth: CGFloat(70), maxWidth: CGFloat(70), minHeight: height, maxHeight: height, alignment: .center) .frame(minWidth: CGFloat(70), maxWidth: CGFloat(70), minHeight: height, maxHeight: height, alignment: .center)
.if(draggedRibbon != nil && draggedRibbon!.id == ribbon.id && isDragging) { $0.overlay(Color(red: 0.1, green: 0.1, blue: 0.1)) } .if(draggedRibbon != nil && draggedRibbon!.id == ribbon.id && isDragging) { $0.overlay(Color(red: 0.1, green: 0.1, blue: 0.1)) }
// .if(!isDragging || draggedRibbon == nil || draggedRibbon!.id != ribbon.id) { $0.background(Color(red: 0.1, green: 0.1, blue: 0.1)) } // .if(!isDragging || draggedRibbon == nil || draggedRibbon!.id != ribbon.id) { $0.background(Color(red: 0.1, green: 0.1, blue: 0.1)) }
// .if(draggedRibbon != nil && draggedRibbon!.id == ribbon.id) { $0.background(.red) } // .if(draggedRibbon != nil && draggedRibbon!.id == ribbon.id) { $0.background(.red) }
.background(Color(red: 0.1, green: 0.1, blue: 0.1)) .background(Color(red: 0.1, green: 0.1, blue: 0.1))
.offset(x: 10)
// .background(Color(red: 0.1, green: 0.1, blue: 0.1)) // .background(Color(red: 0.1, green: 0.1, blue: 0.1))
// .background(.red) // .background(.red)
// .background(.yellow) // .background(.yellow)
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
// .minimumScaleFactor(0.5) // .minimumScaleFactor(0.5)
.padding([.top, .bottom], 10) // .padding([.top, .bottom], 10)
.font(Font.custom("AveriaSerifLibre-Regular", size: CGFloat(10))) .font(Font.custom("AveriaSerifLibre-Regular", size: CGFloat(10)))
} }
.frame(width: CGFloat(100 * 1.66 * scale + 10 ), height:CGFloat(100 * scale + 5))
// Text(ribbon.title) // Text(ribbon.title)
// .foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00))) // .foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00)))
@ -397,6 +402,7 @@ struct ContentView: View {
draggedRibbon: draggedRibbon, draggedRibbon: draggedRibbon,
isDragging: isDragging isDragging: isDragging
) )
// .offset(x: 6, y: 6)
.onDrag { .onDrag {
self.draggedRibbon = ribbon self.draggedRibbon = ribbon
return NSItemProvider() return NSItemProvider()
@ -926,6 +932,7 @@ struct DropViewDelegate2: DropDelegate {
} }
func performDrop(info: DropInfo) -> Bool { func performDrop(info: DropInfo) -> Bool {
isDragging = false
return true return true
} }