From e86b9738d835dff784adb63318bb5e5c338b7eb6 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 22 Apr 2024 21:12:43 -0400 Subject: [PATCH] SMOOTH RENDERING! --- src/charts/chart.js | 57 +--------------- src/charts/shape.js | 1 - src/components/AbsoluteTimeEntry.vue | 4 +- src/components/chart/DCABuilder.vue | 62 +++++++++-------- src/components/chart/LimitBuilder.vue | 36 ++++++++-- src/components/chart/RungBuilder.vue | 98 +++++++++------------------ 6 files changed, 99 insertions(+), 159 deletions(-) diff --git a/src/charts/chart.js b/src/charts/chart.js index 34abab5..b546a48 100644 --- a/src/charts/chart.js +++ b/src/charts/chart.js @@ -141,7 +141,6 @@ export function drawShape(shapeType, ...callbacks) { export function createShape(shapeType, points, options={}, ...callbacks) { - console.log('tvShape creating') const co = useChartOrderStore() drawingCallbacks = null co.drawing = false @@ -164,45 +163,14 @@ export function createShape(shapeType, points, options={}, ...callbacks) { if( callbacks.length ) shapeCallbacks[shapeId] = callbacks const shape = chart.getShapeById(shapeId) - console.log('tvShape created', shape) // todo debug + console.log('tvShape created', shapeId) shape.bringToFront() const props = shape.getProperties() invokeCallbacks(callbacks, 'onCreate', shapeId, shape, points, props) - - stub(shape) - return shapeId } -let stubbed = true -// todo debug -function stub(shape) { - if(stubbed||shape===null) return - function stubFunc(funcName) { - const obj = shape._model - console.log('stubbing', funcName, obj) - const func = obj[funcName] - obj[funcName] = function () { - console.error(shapeId, funcName+'()', [...arguments]) - func(...arguments) - } - } - - stubFunc('start') - stubFunc('stop') - stubFunc('startChanging') - stubFunc('endChanging') - stubFunc('startMoving') - stubFunc('endMoving') - stubFunc('startMovingPoint') - stubFunc('move') - stubFunc('restart') - stubFunc('restorePoints') - stubbed = true -} - - export let allShapeIds = [] export function cancelDrawing() { @@ -228,14 +196,12 @@ function onSelectedLineToolChanged() { export let dragging = false function mouseDown() { - console.log('mouseDown') - dump() + // console.log('mouseDown') dragging = true } function mouseUp() { - console.log('mouseUp') - dump() + // console.log('mouseUp') dragging = false draggingShapeIds = [] } @@ -243,21 +209,6 @@ function mouseUp() { export let draggingShapeIds = [] -function dump() { - return - console.log('all', allShapeIds) - for (const shapeId of allShapeIds) { - const shape = chart.getShapeById(shapeId) - console.log('shape', shape) - console.log('_linePointBeingChanged', shape._model._linePointBeingChanged) - // console.log('_lineBeingEdited', shape._model._lineBeingEdited) - // console.log('_lineBeingCreated', shape._model._lineBeingCreated) - // console.log('_linePointBeingEdited', shape._model._linePointBeingEdited) - // console.log('_lastHoveredHittestData', shape._model._lastHoveredHittestData) - // console.log('_lastSelectedHittestData', shape._model._lastSelectedHittestData) - } - -} function handleCrosshairMovement(point) { crosshairHandler.invoke(point) // delayed invocation to await selection to register later in the tv loop @@ -352,8 +303,6 @@ function doHandleDrawingEvent(id, event) { } } if (event === 'create') { - console.log('created tvShape', id, shape) // todo remove debug - stub(shape) // todo debug allShapeIds.push(id) const co = useChartOrderStore(); diff --git a/src/charts/shape.js b/src/charts/shape.js index 445c918..3bdc693 100644 --- a/src/charts/shape.js +++ b/src/charts/shape.js @@ -502,7 +502,6 @@ export class VLine extends Line { constructor(model, onModel=null, onDelete=null, props=null) { super(ShapeType.VLine, onModel, onDelete, props) - this.debug = true // todo debug // Model this.model.time = null diff --git a/src/components/AbsoluteTimeEntry.vue b/src/components/AbsoluteTimeEntry.vue index 1b81cbc..9eeed3d 100644 --- a/src/components/AbsoluteTimeEntry.vue +++ b/src/components/AbsoluteTimeEntry.vue @@ -266,9 +266,9 @@ let newValue = null } .day { - width: 2em; + width: 4em; max-width: 4em; - min-width: 2em; + min-width: 4em; } .picker { diff --git a/src/components/chart/DCABuilder.vue b/src/components/chart/DCABuilder.vue index d15b974..bd7b1c1 100644 --- a/src/components/chart/DCABuilder.vue +++ b/src/components/chart/DCABuilder.vue @@ -1,6 +1,5 @@