ladders!
This commit is contained in:
@@ -34,6 +34,7 @@ function initChart() {
|
||||
const co = useChartOrderStore()
|
||||
invokeCallbacks(co.drawingCallbacks, 'onRedraw')
|
||||
})
|
||||
useChartOrderStore().chartReady = true
|
||||
}
|
||||
|
||||
|
||||
@@ -114,6 +115,9 @@ export function drawShape(shapeType, ...callbacks) {
|
||||
|
||||
|
||||
export function createShape(shapeType, points, options, ...callbacks) {
|
||||
const co = useChartOrderStore()
|
||||
co.drawingCallbacks = null
|
||||
co.drawing = false
|
||||
options.shape = shapeType.code
|
||||
// programatically adds a shape to the chart
|
||||
let shapeId
|
||||
@@ -126,6 +130,8 @@ export function createShape(shapeType, points, options, ...callbacks) {
|
||||
if( callbacks.length )
|
||||
shapeCallbacks[shapeId] = callbacks
|
||||
console.log('created shape', shapeId)
|
||||
const props = chart.getShapeById(shapeId).getProperties()
|
||||
invokeCallbacks(callbacks, 'onCreate', shapeId, points, props)
|
||||
return shapeId
|
||||
}
|
||||
|
||||
@@ -194,14 +200,14 @@ function handleDrawingEvent(id, event) {
|
||||
} else if (event === 'points_changed') {
|
||||
if (id in shapeCallbacks) {
|
||||
const points = shape.getPoints()
|
||||
console.log('points', points)
|
||||
// console.log('points', points)
|
||||
invokeCallbacks(shapeCallbacks[id], 'onPoints', id, points)
|
||||
}
|
||||
} else if (event === 'properties_changed') {
|
||||
console.log('id in shapes', id in shapeCallbacks, id, shapeCallbacks)
|
||||
if (id in shapeCallbacks) {
|
||||
const props = shape.getProperties()
|
||||
console.log('props', props)
|
||||
// console.log('props', props)
|
||||
invokeCallbacks(shapeCallbacks[id], 'onProps', id, props)
|
||||
}
|
||||
} else if (event === 'move') {
|
||||
@@ -228,7 +234,7 @@ function handleDrawingEvent(id, event) {
|
||||
console.log('unknown drawing event', event)
|
||||
}
|
||||
|
||||
export function deleteShape(id) {
|
||||
export function deleteShapeId(id) {
|
||||
if( id in shapeCallbacks )
|
||||
delete shapeCallbacks[id]
|
||||
console.log('removing entity', id)
|
||||
|
||||
Reference in New Issue
Block a user