Skip to content

Commit

Permalink
Minor change to support undo.
Browse files Browse the repository at this point in the history
Undo is still PRIMITIVE and does not take layers into account.
  • Loading branch information
poetaster committed May 3, 2022
1 parent 43376bb commit fb98bcc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion qml/components/DrawingCanvas.qml
Expand Up @@ -34,6 +34,10 @@ Canvas
property alias areagMouseX: area.gMouseX
property alias areagMouseY: area.gMouseY

// try some
renderTarget: Canvas.FramebufferObject // default slower: Canvas.Image
renderStrategy: Canvas.Immediate // less memory: Canvas.Cooperative

property var brush

Connections
Expand Down Expand Up @@ -354,8 +358,10 @@ Canvas
area.gMouseX = Math.round(mouseX)
area.gMouseY = Math.round(mouseY)
}
// undo

// begin undo
idSaveCanvastimer.start()

switch (drawMode)
{
case Painter.Eraser:
Expand Down
2 changes: 1 addition & 1 deletion qml/components/ToolbarButtonUndo.qml
Expand Up @@ -15,7 +15,7 @@ IconButton
icon.source: "../icons/icon-m-undo.svg"
icon.width: Theme.iconSizeMedium
icon.height: Theme.iconSizeMedium

height: parent.height
rotation: rotationSensor.angle
Behavior on rotation { SmoothedAnimation { duration: 500 } }

Expand Down

0 comments on commit fb98bcc

Please sign in to comment.