mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2025-12-12 15:49:18 -08:00
Allow color as function for select types
This commit is contained in:
committed by
Matthieu Baumann
parent
00c9d6ffc5
commit
5410544404
@@ -57,8 +57,9 @@ export class CircleSelect extends FSM {
|
||||
let ctx = view.catalogCtx;
|
||||
|
||||
// draw the selection
|
||||
ctx.fillStyle = options.color + '7f';
|
||||
ctx.strokeStyle = options.color;
|
||||
let colorValue = (typeof options.color === 'function') ? options.color(this.startCoo, this.coo) : options.color;
|
||||
ctx.fillStyle = colorValue;
|
||||
ctx.strokeStyle = colorValue;
|
||||
ctx.lineWidth = options.lineWidth;
|
||||
|
||||
var r2 = (this.coo.x - this.startCoo.x) * (this.coo.x - this.startCoo.x) + (this.coo.y - this.startCoo.y) * (this.coo.y - this.startCoo.y);
|
||||
|
||||
@@ -121,11 +121,12 @@ export class PolySelect extends FSM {
|
||||
|
||||
let draw = () => {
|
||||
let ctx = view.catalogCtx;
|
||||
|
||||
|
||||
// draw the selection
|
||||
ctx.save();
|
||||
ctx.fillStyle = options.color + '7f';
|
||||
ctx.strokeStyle = options.color;
|
||||
let colorValue = (typeof options.color === 'function') ? options.color() : options.color;
|
||||
ctx.fillStyle = colorValue;
|
||||
ctx.strokeStyle = colorValue;
|
||||
ctx.lineWidth = options.lineWidth;
|
||||
|
||||
ctx.beginPath();
|
||||
|
||||
@@ -58,8 +58,10 @@ export class RectSelect extends FSM {
|
||||
let ctx = view.catalogCtx;
|
||||
|
||||
// draw the selection
|
||||
ctx.fillStyle = options.color + '7f';
|
||||
ctx.strokeStyle = options.color;
|
||||
let colorValue = (typeof options.color === 'function') ? options.color(this.startCoo, this.coo) : options.color;
|
||||
|
||||
ctx.fillStyle = colorValue;
|
||||
ctx.strokeStyle = colorValue;
|
||||
ctx.lineWidth = options.lineWidth;
|
||||
|
||||
var w = this.coo.x - this.startCoo.x;
|
||||
|
||||
Reference in New Issue
Block a user