11package org.polyfrost.crosshair
22
3- import dev.deftu.clipboard.Clipboard
4- import dev.deftu.clipboard.ClipboardImage
53import org.polyfrost.oneconfig.api.platform.v1.Platform
64import org.polyfrost.oneconfig.api.ui.v1.OCPolyUIBuilder
75import org.polyfrost.polyui.animate.Animations
@@ -16,6 +14,7 @@ import org.polyfrost.polyui.component.impl.*
1614import org.polyfrost.polyui.event.Event
1715import org.polyfrost.polyui.operations.Recolor
1816import org.polyfrost.polyui.unit.Align
17+ import org.polyfrost.polyui.unit.Align.Wrap
1918import org.polyfrost.polyui.unit.Vec2
2019import org.polyfrost.polyui.unit.by
2120import org.polyfrost.polyui.unit.seconds
@@ -104,7 +103,7 @@ object PolyCrosshairUI {
104103 Group (
105104 Text (" v2.0.0" ).setPalette { text.secondary },
106105 Image (" assets/oneconfig/ico/close.svg" ).onInit { size = Vec2 (24f , 24f ) }
107- .setDestructivePalette().withStates ().onClick {
106+ .setDestructivePalette().withHoverStates ().onClick {
108107 // will save the crosshair
109108 needsToSave = true
110109 currentCard = null
@@ -127,9 +126,9 @@ object PolyCrosshairUI {
127126 Button (" assets/polycrosshair/copy.svg" .image(), padding = Vec2 (7f , 6f )).onInit {
128127 this [0 ].size = Vec2 (13.25f , 16f )
129128 }.onClick {
130- Clipboard .getInstance().image = ClipboardImage (canvasSize, canvasSize, genColorData(canvasContainer[0 ]).toByteArray())
129+ // Clipboard.getInstance().image = ClipboardImage(canvasSize, canvasSize, genColorData(canvasContainer[0]).toByteArray())
131130 },
132- Image (" assets/polycrosshair/trashcan.svg" ).onInit { this .size = Vec2 (14.75f , 16f ) }.withStates ().setDestructivePalette().onClick {
131+ Image (" assets/polycrosshair/trashcan.svg" ).onInit { this .size = Vec2 (14.75f , 16f ) }.withHoverStates ().setDestructivePalette().onClick {
133132 // generate a new canvas to effectively clear it
134133 canvasContainer[0 ] = genCanvas(canvasSize)
135134 true
@@ -158,7 +157,7 @@ object PolyCrosshairUI {
158157 ).named(" CanvasSizeControl" ),
159158 Group (
160159 Text (" Pen Color" , fontSize = 18f ),
161- Block (color = penColor.deref(), size = Vec2 (56f , 28f )).withBoarder (3f , color = { page.border20 })
160+ Block (color = penColor.deref(), size = Vec2 (56f , 28f )).withBorder (3f , color = { page.border20 })
162161 .onClick { ColorPicker (penColor, null , null , polyUI); true },
163162 alignment = Align (main = Align .Main .SpaceBetween , pad = Vec2 (6f , 12f )),
164163 size = Vec2 (326f , 40f )
@@ -209,7 +208,7 @@ object PolyCrosshairUI {
209208 size = Vec2 (335f , 214f ),
210209 alignment = Align (cross = Align .Cross .Start , pad = Vec2 .ZERO )
211210 ).named(" Library" ),
212- alignment = Align (maxRowSize = 1 , pad = Vec2 (0f , 24f )),
211+ alignment = Align (wrap = Wrap . ALWAYS , pad = Vec2 (0f , 24f )),
213212 ),
214213 )
215214 if (library.children.isNullOrEmpty()) {
@@ -243,14 +242,14 @@ object PolyCrosshairUI {
243242 Image (fileName),
244243 size = Vec2 (48f , 48f ),
245244 alignment = Align (main = Align .Main .Center , pad = Vec2 .ZERO )
246- ).withBoarder (2f ) { page.border10 },
245+ ).withBorder (2f ) { page.border10 },
247246 Text (name, fontSize = 8f ).setPalette { text.secondary }.padded(0f , 6f , 0f , 0f ),
248- alignment = Align (main = Align .Main .Center , maxRowSize = 1 , pad = Vec2 .ZERO )
247+ alignment = Align (main = Align .Main .Center , wrap = Wrap . ALWAYS , pad = Vec2 .ZERO )
249248 ).onClick {
250249 currentCard = this
251250 }.onRightClick {
252251 PopupMenu (
253- Text (" Delete" ).withStates ().setDestructivePalette().onClick {
252+ Text (" Delete" ).withHoverStates ().setDestructivePalette().onClick {
254253 library.removeChild(this @onRightClick)
255254 Paths .get((this @onRightClick[1 ] as Text ).text.toFileName()).deleteIfExists()
256255 polyUI.unfocus()
@@ -277,7 +276,7 @@ object PolyCrosshairUI {
277276 val cl = colorData?.get(it) ? : 0
278277 val color = if (cl != 0 ) argb(cl).mutable() else defColor
279278 var toggled = ! color.transparent
280- Block (radii = null , size = Vec2 (sqSize, sqSize), color = color).withBoarder (1f ) { page.border10 }
279+ Block (radii = null , size = Vec2 (sqSize, sqSize), color = color).withBorder (1f ) { page.border10 }
281280 .events {
282281 Event .Mouse .Entered then { ev ->
283282 (this .color as PolyColor .Mutable ).alpha + = 0.05f
0 commit comments