diagonals working
This commit is contained in:
@@ -2,9 +2,10 @@
|
||||
|
||||
import {invokeCallback, mixin} from "@/common.js";
|
||||
import {chart, createShape, deleteShapeId, dragging, draggingShapeIds, drawShape, widget} from "@/charts/chart.js";
|
||||
import {pointsToOhlcStart, unique} from "@/misc.js";
|
||||
import {unique} from "@/misc.js";
|
||||
import {allocationText} from "@/orderbuild.js";
|
||||
import Color from "color";
|
||||
import {pointsToOhlcStart} from "@/charts/chart-misc.js";
|
||||
|
||||
|
||||
//
|
||||
@@ -544,6 +545,8 @@ export class DLine extends Line {
|
||||
// Model
|
||||
this.model.pointA = null // {time:..., price:...}
|
||||
this.model.pointB = null
|
||||
this.model.extendLeft = false
|
||||
this.model.extendRight = false
|
||||
|
||||
this.setModel(model) // call setModel at the end
|
||||
}
|
||||
@@ -551,8 +554,8 @@ export class DLine extends Line {
|
||||
|
||||
drawingOverrides() {
|
||||
const result = super.drawingOverrides();
|
||||
result.extendLeft = false
|
||||
result.extendRight = false
|
||||
result.extendLeft = this.model.extendLeft
|
||||
result.extendRight = this.model.extendRight
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -567,14 +570,17 @@ export class DLine extends Line {
|
||||
super.setModel(model)
|
||||
if (model.pointA === null && model.pointB === null)
|
||||
this.delete()
|
||||
else if ('pointA' in model && 'pointB' in model) {
|
||||
const newPoints = [model.pointA, model.pointB];
|
||||
const oldPoints = [this.model.pointA, this.model.pointB];
|
||||
if (dirtyPoints(oldPoints, newPoints)) {
|
||||
this.model.pointA = newPoints[0]
|
||||
this.model.pointB = newPoints[1]
|
||||
this.setPoints(newPoints)
|
||||
else {
|
||||
if ('pointA' in model && 'pointB' in model) {
|
||||
const newPoints = [model.pointA, model.pointB];
|
||||
const oldPoints = [this.model.pointA, this.model.pointB];
|
||||
if (dirtyPoints(oldPoints, newPoints)) {
|
||||
this.model.pointA = newPoints[0]
|
||||
this.model.pointB = newPoints[1]
|
||||
this.setPoints(newPoints)
|
||||
}
|
||||
}
|
||||
this.setProps({extendLeft:model.extendLeft, extendRight: model.extendRight})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,4 +595,9 @@ export class DLine extends Line {
|
||||
this.updateModel({pointA: points[0], pointB: points[1]})
|
||||
}
|
||||
}
|
||||
|
||||
onProps(props) {
|
||||
super.onProps(props);
|
||||
this.updateModel({extendLeft: props.extendLeft, extendRight: props.extendRight})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user