cancel drawing when limit entered
This commit is contained in:
@@ -112,6 +112,7 @@ export const VerboseCallback = prototype(ShapeCallback, {
|
||||
})
|
||||
|
||||
let drawingTool = null
|
||||
let previousDrawingTool = null
|
||||
|
||||
export function drawShape(shapeType, ...callbacks) {
|
||||
// puts the chart into a line-drawing mode for a new shape
|
||||
@@ -121,6 +122,7 @@ export function drawShape(shapeType, ...callbacks) {
|
||||
invokeCallbacks(co.drawingCallbacks, 'onUndraw')
|
||||
co.drawingCallbacks = callbacks
|
||||
drawingTool = null
|
||||
previousDrawingTool = widget.selectedLineTool()
|
||||
co.drawing = true
|
||||
widget.selectLineTool(shapeType.code)
|
||||
invokeCallbacks(callbacks, 'onDraw')
|
||||
@@ -154,8 +156,9 @@ export function createShape(shapeType, points, options={}, ...callbacks) {
|
||||
export function cancelDrawing() {
|
||||
const co = useChartOrderStore()
|
||||
if (co.drawing) {
|
||||
invokeCallbacks(co.drawingCallbacks, 'onUndraw')
|
||||
co.drawing = false
|
||||
widget.selectLineTool(previousDrawingTool)
|
||||
invokeCallbacks(co.drawingCallbacks, 'onUndraw')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user