Skip to content

Commit eef59a7

Browse files
committed
Update to the HTML stroke handling
1 parent f278251 commit eef59a7

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/fidget.nim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,11 @@ proc stroke*(color: Color) =
321321
## Sets stroke/border color.
322322
current.stroke = color
323323

324+
proc stroke*(color: Color, alpha: float32) =
325+
## Sets stroke/border color.
326+
current.stroke = color
327+
current.stroke.a = alpha
328+
324329
proc stroke*(color: string, alpha = 1.0) =
325330
## Sets stroke/border color.
326331
current.stroke = parseHtmlColor(color)

src/fidget/dom2.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,7 @@ proc now*(p: Performance): float
15911591
proc removeAllRanges*(s: Selection)
15921592
proc deleteFromDocument*(s: Selection)
15931593
proc getRangeAt*(s: Selection, index: int): Range
1594-
proc collapse*(s: Selection)
1594+
proc collapse*(s: Selection, node: Node, offset: int)
15951595
converter toString*(s: Selection): cstring
15961596
proc `$`*(s: Selection): string = $(s.toString())
15971597

src/fidget/htmlbackend.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ proc startFidget*(draw: proc(), load: proc() = nil, w = 0, h = 0) =
600600
if selection.rangeCount == 0:
601601
return
602602
selection.getRangeAt(0).insertNode(document.createTextNode(paste))
603-
selection.collapse()
603+
selection.removeAllRanges()
604604
ev.preventDefault()
605605
keyboard.input = $document.activeElement.innerText
606606
echo "keyboard.input"

0 commit comments

Comments
 (0)