diff --git a/app/src/main/java/com/benny/pxerstudio/shape/BaseShape.kt b/app/src/main/java/com/benny/pxerstudio/shape/BaseShape.kt index 5b42261..e6453f7 100644 --- a/app/src/main/java/com/benny/pxerstudio/shape/BaseShape.kt +++ b/app/src/main/java/com/benny/pxerstudio/shape/BaseShape.kt @@ -34,13 +34,13 @@ abstract class BaseShape { return !hasEnded } - protected fun endDraw(previousPxer: ArrayList, pxerView: PxerView) { + protected fun PxerView.endDraw(previousPxer: ArrayList) { if (previousPxer.isEmpty()) { return } - pxerView.currentHistory.addAll(previousPxer) + this.currentHistory.addAll(previousPxer) previousPxer.clear() - pxerView.setUnrecordedChanges(true) - pxerView.finishAddHistory() + this.setUnrecordedChanges(true) + this.finishAddHistory() } } diff --git a/app/src/main/java/com/benny/pxerstudio/shape/EraserShape.kt b/app/src/main/java/com/benny/pxerstudio/shape/EraserShape.kt index 83c0c55..b1e58e4 100644 --- a/app/src/main/java/com/benny/pxerstudio/shape/EraserShape.kt +++ b/app/src/main/java/com/benny/pxerstudio/shape/EraserShape.kt @@ -58,7 +58,7 @@ class EraserShape : BaseShape() { override fun onDrawEnd(pxerView: PxerView) { super.onDrawEnd(pxerView) hasInit = false - endDraw(previousPxer, pxerView) + pxerView.endDraw(previousPxer) } init { diff --git a/app/src/main/java/com/benny/pxerstudio/shape/draw/LineShape.kt b/app/src/main/java/com/benny/pxerstudio/shape/draw/LineShape.kt index 9345560..675ccb6 100644 --- a/app/src/main/java/com/benny/pxerstudio/shape/draw/LineShape.kt +++ b/app/src/main/java/com/benny/pxerstudio/shape/draw/LineShape.kt @@ -68,7 +68,7 @@ class LineShape : DrawShape() { override fun onDrawEnd(pxerView: PxerView) { super.onDrawEnd(pxerView) hasInit = false - endDraw(previousPxer, pxerView) + pxerView.endDraw(previousPxer) } init { diff --git a/app/src/main/java/com/benny/pxerstudio/shape/draw/RectShape.kt b/app/src/main/java/com/benny/pxerstudio/shape/draw/RectShape.kt index 690033f..5044221 100644 --- a/app/src/main/java/com/benny/pxerstudio/shape/draw/RectShape.kt +++ b/app/src/main/java/com/benny/pxerstudio/shape/draw/RectShape.kt @@ -49,6 +49,6 @@ class RectShape : DrawShape() { override fun onDrawEnd(pxerView: PxerView) { super.onDrawEnd(pxerView) - endDraw(previousPxer, pxerView) + pxerView.endDraw(previousPxer) } }