Add line dash option to Overlay class

This commit is contained in:
Philip Matsson
2024-03-19 14:27:47 +01:00
committed by Matthieu Baumann
parent fade1f95d2
commit fea04ae118

View File

@@ -46,6 +46,7 @@ export let Overlay = (function() {
this.color = options.color || Color.getNextColor();
this.lineWidth = options["lineWidth"] || 2;
this.lineDash = options["lineDash"] || [];
//this.indexationNorder = 5; // at which level should we index overlays?
//this.overlays = [];
@@ -204,6 +205,7 @@ export let Overlay = (function() {
// simple drawing
ctx.strokeStyle= this.color;
ctx.lineWidth = this.lineWidth;
ctx.setLineDash(this.lineDash);
// 1. Drawing polygons
@@ -262,6 +264,11 @@ export let Overlay = (function() {
this.reportChange();
};
Overlay.prototype.setLineDash = function(lineDash) {
this.lineDash = lineDash;
this.reportChange();
}
// callback function to be called when the status of one of the footprints has changed
Overlay.prototype.reportChange = function() {
this.view && this.view.requestRedraw();