fix #161 - draw shadow around widget control elements

This commit is contained in:
Josia Pietsch 2025-05-12 13:47:21 +02:00
parent 1ba7479469
commit 23bc58806c
Signed by: jrpie
GPG key ID: E70B571D66986A2D

View file

@ -24,24 +24,30 @@ private const val HANDLE_EDGE_SIZE = (1.2 * HANDLE_SIZE).toInt()
*/
class WidgetOverlayView : ViewGroup {
private val paint = Paint()
private val handlePaint = Paint()
private val selectedHandlePaint = Paint()
private val popupAnchor = View(context)
val paint = Paint()
val handlePaint = Paint()
val selectedHandlePaint = Paint()
var mode: WidgetManagerView.EditMode? = null
class Handle(val mode: WidgetManagerView.EditMode, val position: Rect)
init {
addView(popupAnchor)
setWillNotDraw(false)
handlePaint.style = Paint.Style.STROKE
handlePaint.setARGB(255, 255, 255, 255)
handlePaint.color = Color.WHITE
handlePaint.strokeWidth = 2f
handlePaint.setShadowLayer(10f,0f,0f, Color.BLACK)
selectedHandlePaint.style = Paint.Style.FILL_AND_STROKE
selectedHandlePaint.setARGB(100, 255, 255, 255)
handlePaint.setShadowLayer(10f,0f,0f, Color.BLACK)
paint.style = Paint.Style.STROKE
paint.setARGB(255, 255, 255, 255)
paint.color = Color.WHITE
paint.setShadowLayer(10f,0f,0f, Color.BLACK)
}
private var preview: Drawable? = null
@ -80,14 +86,15 @@ class WidgetOverlayView : ViewGroup {
}
}
val bounds = getBounds()
canvas.drawRoundRect(bounds.toRectF(), 5f, 5f, paint)
if (mode == null) {
return
}
//preview?.bounds = bounds
//preview?.draw(canvas)
}
override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
popupAnchor.layout(0,0,0,0)