Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Perlkonig committed Dec 14, 2024
2 parents 4e90ab6 + f8496ab commit e5bf67d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
32 changes: 20 additions & 12 deletions src/renderers/_base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6157,6 +6157,10 @@ export abstract class RendererBase {
if (note.dashed !== undefined && note.dashed !== null) {
dasharray = (note.dashed ).join(" ");
}
let bgopacity = 1;
if ( ("occlude" in note) && note.occlude === false) {
bgopacity = 0;
}
for (const node of (note.targets as ITarget[])) {
// outline the polygon if provided
if (polys !== undefined && polys[node.row][node.col] !== undefined) {
Expand All @@ -6166,7 +6170,7 @@ export abstract class RendererBase {
notes.circle(poly.r * 2)
.addClass(`aprender-annotation-${x2uid(cloned)}`)
.fill("none")
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round"})
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round", opacity: bgopacity})
.center(poly.cx, poly.cy)
.attr({ 'pointer-events': 'none' });
notes.circle(poly.r * 2)
Expand All @@ -6179,7 +6183,7 @@ export abstract class RendererBase {
notes.path(poly.path)
.addClass(`aprender-annotation-${x2uid(cloned)}`)
.fill("none")
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round"})
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round", opacity: bgopacity})
.attr({ 'pointer-events': 'none' });
notes.path(poly.path)
.addClass(`aprender-annotation-${x2uid(cloned)}`)
Expand All @@ -6190,7 +6194,7 @@ export abstract class RendererBase {
notes.polygon(poly.points.map(({x,y}) => [x,y].join(",")).join(" "))
.addClass(`aprender-annotation-${x2uid(cloned)}`)
.fill("none")
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round"})
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round", opacity: bgopacity})
.attr({ 'pointer-events': 'none' });
notes.polygon(poly.points.map(({x,y}) => [x,y].join(",")).join(" "))
.addClass(`aprender-annotation-${x2uid(cloned)}`)
Expand All @@ -6214,7 +6218,7 @@ export abstract class RendererBase {
notes.rect(this.cellsize, this.cellsize)
.addClass(`aprender-annotation-${x2uid(cloned)}`)
.fill("none")
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round"})
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round", opacity: bgopacity})
.center(pt.x, pt.y)
.attr({ 'pointer-events': 'none' });
notes.rect(this.cellsize, this.cellsize)
Expand All @@ -6227,7 +6231,7 @@ export abstract class RendererBase {
notes.circle(this.cellsize * 1.1, this.cellsize * 1.1)
.addClass(`aprender-annotation-${x2uid(cloned)}`)
.fill("none")
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round"})
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round", opacity: bgopacity})
.center(pt.x, pt.y)
.attr({ 'pointer-events': 'none' });
notes.circle(this.cellsize * 1.1, this.cellsize * 1.1)
Expand All @@ -6248,7 +6252,7 @@ export abstract class RendererBase {
notes.polygon(periph)
.addClass(`aprender-annotation-${x2uid(cloned)}`)
.fill("none")
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round"})
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round", opacity: bgopacity})
.center(pt.x, pt.y)
.attr({ 'pointer-events': 'none' });
notes.polygon(periph)
Expand Down Expand Up @@ -6276,6 +6280,10 @@ export abstract class RendererBase {
if (note.dashed !== undefined && note.dashed !== null) {
dasharray = (note.dashed ).join(" ");
}
let bgopacity = 1;
if ( ("occlude" in note) && note.occlude === false) {
bgopacity = 0;
}
for (const node of (note.targets as ITarget[])) {
// outline the polygon if provided
if (polys !== undefined) {
Expand All @@ -6285,7 +6293,7 @@ export abstract class RendererBase {
notes.circle(poly.r * 2)
.addClass(`aprender-annotation-${x2uid(cloned)}`)
.fill("none")
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round"})
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round", opacity: bgopacity})
.center(poly.cx, poly.cy)
.attr({ 'pointer-events': 'none' });
notes.circle(poly.r * 2)
Expand All @@ -6298,7 +6306,7 @@ export abstract class RendererBase {
notes.path(poly.path)
.addClass(`aprender-annotation-${x2uid(cloned)}`)
.fill("none")
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round"})
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round", opacity: bgopacity})
.attr({ 'pointer-events': 'none' });
notes.path(poly.path)
.addClass(`aprender-annotation-${x2uid(cloned)}`)
Expand All @@ -6309,7 +6317,7 @@ export abstract class RendererBase {
notes.polygon(poly.points.map(({x,y}) => [x,y].join(",")).join(" "))
.addClass(`aprender-annotation-${x2uid(cloned)}`)
.fill("none")
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round"})
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round", opacity: bgopacity})
.attr({ 'pointer-events': 'none' });
notes.polygon(poly.points.map(({x,y}) => [x,y].join(",")).join(" "))
.addClass(`aprender-annotation-${x2uid(cloned)}`)
Expand All @@ -6333,7 +6341,7 @@ export abstract class RendererBase {
notes.rect(this.cellsize, this.cellsize)
.addClass(`aprender-annotation-${x2uid(cloned)}`)
.fill("none")
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round"})
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round", opacity: bgopacity})
.center(pt.x, pt.y)
.attr({ 'pointer-events': 'none' });
notes.rect(this.cellsize, this.cellsize)
Expand All @@ -6346,7 +6354,7 @@ export abstract class RendererBase {
notes.circle(this.cellsize * 1.1, this.cellsize * 1.1)
.addClass(`aprender-annotation-${x2uid(cloned)}`)
.fill("none")
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round"})
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round", opacity: bgopacity})
.center(pt.x, pt.y)
.attr({ 'pointer-events': 'none' });
notes.circle(this.cellsize * 1.1, this.cellsize * 1.1)
Expand All @@ -6367,7 +6375,7 @@ export abstract class RendererBase {
notes.polygon(periph)
.addClass(`aprender-annotation-${x2uid(cloned)}`)
.fill("none")
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round"})
.stroke({color: this.options.colourContext.background, width: strokeWeight, linecap: "round", linejoin: "round", opacity: bgopacity})
.center(pt.x, pt.y)
.attr({ 'pointer-events': 'none' });
notes.polygon(periph)
Expand Down
4 changes: 4 additions & 0 deletions src/schemas/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,10 @@ export interface AnnotationBasic {
* Only meaningful for the `enter` and `exit` notations. Determines the shape of the dotted line.
*/
shape?: "square" | "circle" | "hexf" | "hexp";
/**
* Only meaningful for enter/exit notations. By default, a background is drawn before the dotted line. This isn't desireably in rare occasions where you want markers underneath the annotation to be visible.
*/
occlude?: boolean;
}
/**
* Delta annotations for the `sowing-*` renderers
Expand Down
5 changes: 5 additions & 0 deletions src/schemas/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,11 @@
"description": "Only meaningful for the `enter` and `exit` notations. Determines the shape of the dotted line.",
"enum": ["square", "circle", "hexf", "hexp"],
"default": "square"
},
"occlude": {
"description": "Only meaningful for enter/exit notations. By default, a background is drawn before the dotted line. This isn't desireably in rare occasions where you want markers underneath the annotation to be visible.",
"type": "boolean",
"default": true
}
},
"required": ["type", "targets"],
Expand Down

0 comments on commit e5bf67d

Please sign in to comment.