@@ 313,7 313,7 @@ proc ellipse(a, b: Vec, filled: bool): seq[Vec] =
a.y.inc()
b.y.dec()
if filled:
- result = toSeq(toHashSet(result))
+ result = result.toHashSet.toSeq # deduplicate
proc select(picture: Picture, target: Vec, tool: Tool) =
case tool.kind
@@ 670,14 670,15 @@ proc draw(app: App) =
app.pictures, origin, maxSize, app.selectedPictureIndex.int32
):
picture.draw(app, origin, selected = index == app.selectedPictureIndex)
- drawText(
- app.font,
- app.command.cstring,
- (margin, screenSize.y - margin - textSize).toVector2,
- textSize,
- textSpacing,
- White,
- )
+ if app.command != "\xC0":
+ drawText(
+ app.font,
+ app.command.cstring,
+ (margin, screenSize.y - margin - textSize).toVector2,
+ textSize,
+ textSpacing,
+ White,
+ )
proc processKeyboard(app: App) =
let shift = isKeyDown(LeftShift) or isKeyDown(RightShift)
@@ 703,7 704,10 @@ proc processKeyboard(app: App) =
app.command.setLen(app.command.len - 1)
else:
while (var ch = getCharPressed(); ch != 0):
- app.command.add(Rune(ch))
+ if app.command == "\xC0": # evil hack to work around a bug
+ app.command = ""
+ else:
+ app.command.add(Rune(ch))
else:
if isKeyPressed(Escape):
if app.activeSelection:
@@ 783,9 787,7 @@ proc processKeyboard(app: App) =
app.color = app.selectedPicture.colorAtCursor
if isKeyPressed(Semicolon):
app.mode = Command
- app.command = ""
- while (var ch = getCharPressed(); ch != 0):
- discard
+ app.command = "\xC0" # evil hack to work around a bug
if isKeyPressed(Equal):
if shift:
app.pictures.apply(zoomIn)
@@ 869,9 871,7 @@ proc processMouse(app: App) =
app.secondaryColorPos.palette = index
app.secondaryColorPos.cursor = (pos - canvasOrigin) div palette.scale
app.secondaryColor =
- palette.image.getImageColor(
- app.secondaryColorPos.cursor.x, app.secondaryColorPos.cursor.y
- )
+ palette[(app.secondaryColorPos.cursor.x, app.secondaryColorPos.cursor.y)]
break
block pictures:
let origin: Vec = (margin, margin + maxPaletteHeight + margin)