diagonal debug

This commit is contained in:
Tim
2024-05-06 14:32:02 -04:00
parent 49b41450c3
commit 613cb7d7f5
4 changed files with 184 additions and 53 deletions

View File

@@ -57,7 +57,7 @@ export class Shape {
// lineColor, textColor, color, // lineColor and textColor default to color
// }
this.debug = false
this.debug = true
this.id = null // TradingView shapeId, or null if no TV shape created yet (drawing mode)
this.type = type // ShapeType
this.model = {} // set to nothing at first
@@ -324,30 +324,17 @@ export class Shape {
}
let lineChangeInfo = null
function dirtyPoints(pointsA, pointsB) {
const result = dirtyPoints2(pointsA,pointsB)
console.error('dirtyPoints', result, pointsA, pointsB)
return result
}
function dirtyPoints2(pointsA, pointsB) {
console.log('dp2', pointsA, pointsB)
if (pointsA === undefined)
return true
console.log('dp2b')
if (pointsB === undefined)
return false
console.log('dp2c')
if (pointsB===null)
return pointsA !== null
console.log('dp2d')
if (pointsA===null)
return pointsB.length > 0
console.log('dp2e')
if (pointsA.length!==pointsB.length)
return true
console.log('dp2f')
for (const i in pointsA) {
const a = pointsA[i]
const b = pointsB[i]
@@ -355,7 +342,6 @@ function dirtyPoints2(pointsA, pointsB) {
a.time !== b.time || a.price !== b.price )
return true
}
console.log('dp3')
return false
}
@@ -401,7 +387,7 @@ class ShapeTVCallbacks {
onProps(shapeId, _tvShape, props) {
if (!this.enabled) return // possible when shape is deleted and re-created
if (this.shape.debug) console.log('tvOnProps', props)
if (this.shape.debug) console.error('tvOnProps', props)
this.shape.onProps(props)
this.shape.tvProps = props
}
@@ -563,6 +549,13 @@ export class DLine extends Line {
}
drawingOverrides() {
const result = super.drawingOverrides();
result.linetoolextended = {extendLeft: false, extendRight: false}
return result
}
delete() {
this.model.pointA = null
this.model.pointB = null