From 5a82c1bc1da7734901d3b24bd69ac63e7e5f6e91 Mon Sep 17 00:00:00 2001 From: Justin Brooks Date: Sat, 29 May 2021 10:05:26 -0500 Subject: [PATCH] Cleanup --- .../vgo/core/optimization/RemoveRedundantCommands.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/optimization/RemoveRedundantCommands.kt b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/optimization/RemoveRedundantCommands.kt index 77c2433d..9ec4f0c7 100644 --- a/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/optimization/RemoveRedundantCommands.kt +++ b/vgo-core/src/main/kotlin/com/jzbrooks/vgo/core/optimization/RemoveRedundantCommands.kt @@ -47,14 +47,13 @@ class RemoveRedundantCommands : TopDownOptimization, PathElementVisitor { commands.add(current) } - if (pathElement.commands.last() is ClosePath) { + if (commands.last() is ClosePath) { val commandsWithoutFinalClosePath = commands.dropLast(1) val current = computeAbsoluteCoordinates(commandsWithoutFinalClosePath) val firstCurrentPoint = firstCommand.parameters.last() if (current == firstCurrentPoint) { - pathElement.commands = commandsWithoutFinalClosePath - return + commands.removeLast() } }