notations 0.0.51 → 0.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import * as TSU from "@panyam/tsutils";
1
2
  import { Embelishment } from "../shapes";
2
3
  import { GridCell, GridCellView } from "../grids";
3
4
  import { ElementShape } from "../shapes";
@@ -14,6 +15,7 @@ export declare class MarkerView extends ElementShape<SVGGElement> implements Gri
14
15
  rootGroup: SVGGElement;
15
16
  textElement: SVGTextElement;
16
17
  constructor(cell: GridCell, beat: Beat, markers: Marker[], isPreMarker: boolean, rootElement: SVGGraphicsElement, config?: any);
18
+ protected refreshMinSize(): TSU.Geom.Size;
17
19
  refreshLayout(): void;
18
20
  protected updateBounds(x: null | number, y: null | number, w: null | number, h: null | number): [number | null, number | null, number | null, number | null];
19
21
  }
@@ -55,10 +55,17 @@ class MarkerView extends shapes_1.ElementShape {
55
55
  attrs: {
56
56
  class: "markerText",
57
57
  pre: isPreMarker,
58
+ dx: isPreMarker ? 0 : 15,
58
59
  },
59
60
  text: this.markers[0].text,
60
61
  });
61
62
  }
63
+ refreshMinSize() {
64
+ const ts = TSU.DOM.svgBBox(this.textElement);
65
+ const totalWidth = ts.width;
66
+ const maxHeight = ts.height;
67
+ return new TSU.Geom.Size(totalWidth + 5, maxHeight + 5);
68
+ }
62
69
  refreshLayout() {
63
70
  this.rootGroup.setAttribute("transform", "translate(" + this.x + "," + this.y + ")");
64
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"beatviews.js","sourceRoot":"","sources":["../../../src/carnatic/beatviews.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AAGvC,sCAAyC;AACzC,2CAA6C;AAG7C,0CAAuD;AACvD,mDAA+D;AAE/D,MAAa,UAAW,SAAQ,qBAAyB;IAIvD,YACkB,IAAc,EACd,IAAU,EACV,OAAiB,EACjB,WAAoB,EACpB,WAA+B,EAC/C,MAAY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,IAAI,CAAC,QAAQ,CAAC,CAAC;YACtC,IAAI,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC,SAAS,GAAG,CAAC,EAAE;gBAIvC,IAAI,IAAI,CAAC,QAAQ,IAAI,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;oBAC1D,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;wBAE1C,MAAM,GAAG,GAAG,IAAI,4BAAY,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;wBACnD,aAAa,GAAG,CAAC,GAAG,CAAC,CAAC;qBACvB;yBAAM;wBAEL,MAAM,GAAG,GAAG,IAAI,4BAAY,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;wBAChD,aAAa,GAAG,CAAC,GAAG,CAAC,CAAC;qBACvB;iBACF;aACF;SACF;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AA7CD,4BA6CC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Embelishment } from \"../shapes\";\nimport { GridCell, GridCellView } from \"../grids\";\nimport { ElementShape } from \"../shapes\";\nimport { createAtomView } from \"./atomviews\";\nimport { Marker } from \"../core\";\nimport { Beat } from \"../beats\";\nimport { BeatView as BeatViewBase } from \"../beatview\";\nimport { BeatStartLines, BeatEndLines } from \"./embelishments\";\n\nexport class MarkerView extends ElementShape<SVGGElement> implements GridCellView {\n needsLayout = true;\n rootGroup: SVGGElement;\n textElement: SVGTextElement;\n constructor(\n public readonly cell: GridCell,\n public readonly beat: Beat,\n public readonly markers: Marker[],\n public readonly isPreMarker: boolean,\n public readonly rootElement: SVGGraphicsElement,\n config?: any,\n ) {\n const rootGroup = TSU.DOM.createSVGNode(\"g\", {\n parent: rootElement,\n attrs: {\n class: \"markerView\",\n pre: isPreMarker,\n roleName: beat.role.name,\n beatIndex: \"\" + beat.index,\n gridRow: cell.rowIndex,\n gridCol: cell.colIndex,\n },\n });\n super(rootGroup);\n this.rootGroup = rootGroup as SVGGElement;\n this.textElement = TSU.DOM.createSVGNode(\"text\", {\n parent: rootGroup,\n attrs: {\n class: \"markerText\",\n pre: isPreMarker,\n },\n text: this.markers[0].text,\n });\n }\n\n refreshLayout(): void {\n // TODO - move this code out to refreshLayout?\n // set the glyphs Y first so we can layout others\n this.rootGroup.setAttribute(\"transform\", \"translate(\" + this.x + \",\" + this.y + \")\");\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, y, NaN, NaN];\n }\n}\n\nexport class BeatView extends BeatViewBase {\n createAtomView() {\n return createAtomView(this.element, this.beat.atom, this.beat.role.defaultToNotes);\n }\n\n refreshLayout(): void {\n const newX = this.hasX ? this._x : 0;\n const newY = this.hasY ? this._y : 0;\n this.element.setAttribute(\"transform\", \"translate(\" + newX + \",\" + newY + \")\");\n this.invalidateBounds();\n for (const e of this.embelishments) e.refreshLayout();\n this.invalidateBounds();\n }\n\n protected createEmbelishments(): Embelishment[] {\n let embelishments: Embelishment[] = [];\n const beat = this.beat;\n // TODO - Should this be the group's parent element?\n const rootElement = this.rootElement;\n if (beat.beatIndex == 0 && beat.barIndex == 0 && beat.instance == 0) {\n // first beat in bar - Do a BarStart\n const emb = new BeatStartLines(this, rootElement);\n embelishments = [emb];\n } else {\n const cycle = this.cycle;\n const bar = cycle.bars[beat.barIndex];\n if (beat.beatIndex == bar.beatCount - 1) {\n // It is important that we are not just looking at the last beat of the bar\n // but also in the last \"instance\" of the beat in this bar to account for\n // kalais\n if (beat.instance == bar.instanceCount(beat.beatIndex) - 1) {\n if (beat.barIndex == cycle.bars.length - 1) {\n // last beat in last bar so - do a thalam end (2 lines)\n const emb = new BeatEndLines(this, rootElement, 2);\n embelishments = [emb];\n } else {\n // end of a bar so single line end\n const emb = new BeatEndLines(this, rootElement);\n embelishments = [emb];\n }\n }\n }\n }\n return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wBAChD,aAAa,GAAG,CAAC,GAAG,CAAC,CAAC;qBACvB;iBACF;aACF;SACF;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AA7CD,4BA6CC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Embelishment } from \"../shapes\";\nimport { GridCell, GridCellView } from \"../grids\";\nimport { ElementShape } from \"../shapes\";\nimport { createAtomView } from \"./atomviews\";\nimport { Marker } from \"../core\";\nimport { Beat } from \"../beats\";\nimport { BeatView as BeatViewBase } from \"../beatview\";\nimport { BeatStartLines, BeatEndLines } from \"./embelishments\";\n\nexport class MarkerView extends ElementShape<SVGGElement> implements GridCellView {\n needsLayout = true;\n rootGroup: SVGGElement;\n textElement: SVGTextElement;\n constructor(\n public readonly cell: GridCell,\n public readonly beat: Beat,\n public readonly markers: Marker[],\n public readonly isPreMarker: boolean,\n public readonly rootElement: SVGGraphicsElement,\n config?: any,\n ) {\n const rootGroup = TSU.DOM.createSVGNode(\"g\", {\n parent: rootElement,\n attrs: {\n class: \"markerView\",\n pre: isPreMarker,\n roleName: beat.role.name,\n beatIndex: \"\" + beat.index,\n gridRow: cell.rowIndex,\n gridCol: cell.colIndex,\n },\n });\n super(rootGroup);\n this.rootGroup = rootGroup as SVGGElement;\n this.textElement = TSU.DOM.createSVGNode(\"text\", {\n parent: rootGroup,\n attrs: {\n class: \"markerText\",\n pre: isPreMarker,\n dx: isPreMarker ? 0 : 15,\n },\n text: this.markers[0].text,\n });\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n const ts = TSU.DOM.svgBBox(this.textElement);\n const totalWidth = ts.width;\n const maxHeight = ts.height;\n return new TSU.Geom.Size(totalWidth + 5, maxHeight + 5);\n }\n\n refreshLayout(): void {\n // TODO - move this code out to refreshLayout?\n // set the glyphs Y first so we can layout others\n this.rootGroup.setAttribute(\"transform\", \"translate(\" + this.x + \",\" + this.y + \")\");\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, y, NaN, NaN];\n }\n}\n\nexport class BeatView extends BeatViewBase {\n createAtomView() {\n return createAtomView(this.element, this.beat.atom, this.beat.role.defaultToNotes);\n }\n\n refreshLayout(): void {\n const newX = this.hasX ? this._x : 0;\n const newY = this.hasY ? this._y : 0;\n this.element.setAttribute(\"transform\", \"translate(\" + newX + \",\" + newY + \")\");\n this.invalidateBounds();\n for (const e of this.embelishments) e.refreshLayout();\n this.invalidateBounds();\n }\n\n protected createEmbelishments(): Embelishment[] {\n let embelishments: Embelishment[] = [];\n const beat = this.beat;\n // TODO - Should this be the group's parent element?\n const rootElement = this.rootElement;\n if (beat.beatIndex == 0 && beat.barIndex == 0 && beat.instance == 0) {\n // first beat in bar - Do a BarStart\n const emb = new BeatStartLines(this, rootElement);\n embelishments = [emb];\n } else {\n const cycle = this.cycle;\n const bar = cycle.bars[beat.barIndex];\n if (beat.beatIndex == bar.beatCount - 1) {\n // It is important that we are not just looking at the last beat of the bar\n // but also in the last \"instance\" of the beat in this bar to account for\n // kalais\n if (beat.instance == bar.instanceCount(beat.beatIndex) - 1) {\n if (beat.barIndex == cycle.bars.length - 1) {\n // last beat in last bar so - do a thalam end (2 lines)\n const emb = new BeatEndLines(this, rootElement, 2);\n embelishments = [emb];\n } else {\n // end of a bar so single line end\n const emb = new BeatEndLines(this, rootElement);\n embelishments = [emb];\n }\n }\n }\n }\n return embelishments;\n }\n}\n"]}
@@ -163,7 +163,7 @@ class BeatEndLines extends shapes_1.Embelishment {
163
163
  this.source = source;
164
164
  this.rootElement = rootElement;
165
165
  this.lineSpacing = 2;
166
- this.barSpacing = 15;
166
+ this.barSpacing = 0;
167
167
  this.lines = [];
168
168
  for (let i = 0; i < nLines; i++) {
169
169
  this.lines.push(TSU.DOM.createSVGNode("line", {
@@ -1 +1 @@
1
- {"version":3,"file":"embelishments.js","sourceRoot":"","sources":["../../../src/carnatic/embelishments.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;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AC,CAAC;IAC/D,CAAC;IAES,cAAc;QACtB,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAES,WAAW;QACnB,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAES,YAAY,CACpB,CAAgB,EAChB,CAAgB,EAChB,CAAgB,EAChB,CAAgB;QAEhB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,aAAa;QACX,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF;AAvDD,sBAuDC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Note } from \"../core\";\nimport { BeatView } from \"../beatview\";\nimport { Embelishment } from \"../shapes\";\nimport { LeafAtomView } from \"./atomviews\";\nimport { JaaruGamaka } from \"./gamakas\";\n\n/**\n * Embelishments specifically \"around\" a single atom view.\n */\nexport abstract class LeafAtomViewEmbelishment extends Embelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super();\n }\n}\n\nexport class OctaveIndicator extends LeafAtomViewEmbelishment {\n dotRadius = 1;\n dotSpacing = 2.5;\n dotsElem: SVGGElement;\n\n constructor(public readonly noteView: LeafAtomView, public readonly note: Note) {\n super(noteView);\n const rootElem = this.noteView.embRoot();\n const numDots = Math.abs(note.octave);\n this.dotsElem = TSU.DOM.createSVGNode(\"g\", {\n doc: document,\n parent: rootElem,\n attrs: {\n width: this.dotRadius * 2 * numDots + (numDots - 1) * this.dotSpacing,\n height: this.dotRadius * 2,\n source: \"atom\" + this.noteView.leafAtom.uuid,\n },\n });\n let cx = 0;\n for (let i = 0; i < numDots; i++) {\n TSU.DOM.createSVGNode(\"circle\", {\n doc: document,\n parent: this.dotsElem,\n attrs: {\n cx: cx,\n cy: 0,\n r: this.dotRadius,\n stroke: \"black\",\n \"stroke-width\": \"1\",\n },\n });\n cx += this.dotRadius + this.dotRadius + this.dotSpacing;\n }\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.dotsElem);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n const numDots = Math.abs(this.note.octave);\n return {\n width: this.dotRadius * 2 * numDots + (numDots - 1) * this.dotSpacing,\n height: this.dotRadius * 2,\n };\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n if (x == null) x = this.x;\n if (y == null) y = this.y;\n // cannot set w/h\n // this.bbox.x = x;\n // this.bbox.y = y;\n return [x, y, null, null];\n }\n\n refreshLayout(): void {\n this.dotsElem.setAttribute(\"transform\", \"translate(\" + this.x + \",\" + this.y + \")\");\n }\n}\n\n////////// Carnatic embelishments\nexport class LabelEmbelishment extends LeafAtomViewEmbelishment {\n labelElem: SVGTextElement;\n constructor(public readonly label: string, public readonly atomView: LeafAtomView) {\n super(atomView);\n const rootElem = this.atomView.embRoot();\n this.labelElem = TSU.DOM.createSVGNode(\"text\", {\n doc: document,\n parent: rootElem,\n text: label,\n attrs: {\n source: \"atom\" + this.atomView.leafAtom.uuid,\n \"dominant-baseline\": \"hanging\",\n },\n });\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.labelElem);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return TSU.DOM.svgBBox(this.labelElem);\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, y, w, h];\n }\n\n refreshLayout(): void {\n this.labelElem.setAttribute(\"x\", \"\" + this.x);\n this.labelElem.setAttribute(\"y\", \"\" + this.y);\n }\n}\n\nexport class BeatStartLines extends Embelishment {\n barSpacing = 10;\n protected line: SVGLineElement;\n\n constructor(public readonly source: BeatView, public readonly rootElement: SVGGraphicsElement) {\n super();\n this.line = TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n parent: this.rootElement,\n attrs: {\n stroke: \"black\",\n \"stroke-width\": \"1\",\n class: \"bar-start-line\",\n },\n });\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n refreshLayout(): void {\n const line = this.line;\n const x = this.source.x - this.barSpacing;\n line.setAttribute(\"x1\", \"\" + x);\n line.setAttribute(\"x2\", \"\" + x);\n const y = this.source.y + this.source.bbox.y;\n const h = this.source.bbox.height;\n line.setAttribute(\"y1\", \"\" + y);\n line.setAttribute(\"y2\", \"\" + (y + h));\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, y, null, h];\n }\n}\n\nexport class BeatEndLines extends Embelishment {\n lineSpacing = 2;\n protected lines: SVGLineElement[];\n\n constructor(public readonly source: BeatView, public readonly rootElement: SVGGraphicsElement, nLines = 1) {\n super();\n this.lines = [];\n for (let i = 0; i < nLines; i++) {\n this.lines.push(\n TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n // parent: l2g,\n parent: this.rootElement,\n attrs: {\n stroke: \"black\",\n \"stroke-width\": \"1\",\n class: \"bar-end-line\",\n },\n }),\n );\n }\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected updatePosition(x: null | number, y: null | number): [number | null, number | null] {\n return [x, y];\n }\n\n barSpacing = 15;\n\n refreshLayout(): void {\n // const x = this.source.width + this.barSpacing;\n // const y = 0;\n // const h = this.source.height;\n const x = this.source.x + this.source.width + this.barSpacing;\n const y = this.source.y + this.source.bbox.y;\n const h = this.source.bbox.height;\n let currX = x;\n for (const line of this.lines) {\n const lx = \"\" + currX;\n line.setAttribute(\"x1\", lx);\n line.setAttribute(\"x2\", lx);\n currX += 4;\n }\n for (const line of this.lines) {\n line.setAttribute(\"y1\", \"\" + y);\n line.setAttribute(\"y2\", \"\" + (y + h));\n }\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [null, null, null, null];\n }\n}\n\n/// Carnatic Embelishments\nexport class Kampitham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"~\", atomView);\n }\n}\n\nexport class Nokku extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"w\", atomView);\n }\n}\n\nexport class Prathyagatham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"∵\", atomView);\n }\n}\nexport class Spuritham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"∴\", atomView);\n }\n}\nexport class Raavi extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"^\", atomView);\n }\n}\nexport class Kandippu extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"✓\", atomView);\n }\n}\n\nexport class Vaali extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"⌒\", atomView);\n }\n}\nexport class Odukkal extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"x\", atomView);\n }\n}\nexport class Orikkai extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"γ\", atomView);\n }\n}\n\nexport class Jaaru extends LeafAtomViewEmbelishment {\n pathElem: SVGPathElement;\n constructor(public readonly jaaru: JaaruGamaka, public readonly atomView: LeafAtomView) {\n super(atomView);\n // TODO - Create the \"fancier\" view\n // for now represent this with just a slant line (like a slash)\n const rootElem = this.atomView.embRoot();\n this.pathElem = TSU.DOM.createSVGNode(\"path\", {\n doc: document,\n parent: rootElem,\n attrs: {\n source: \"atom\" + this.atomView.leafAtom.uuid,\n stroke: \"black\",\n fill: \"transparent\",\n d: this.pathAttribute(),\n },\n });\n }\n\n pathAttribute(x = 0): string {\n const avbbox = this.atomView.glyph.minSize;\n let y2 = 0;\n const h2 = avbbox.height / 2;\n const x2 = x + h2;\n let y = this.atomView.y;\n if (this.jaaru.ascending) {\n y += avbbox.height;\n y2 = y - h2;\n } else {\n y -= h2;\n y2 = y + h2;\n }\n return [`M ${x} ${y}`, `Q ${x2} ${y} ${x2} ${y2}`].join(\" \");\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return TSU.DOM.svgBBox(this.pathElem);\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.pathElem);\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, null, null, null];\n }\n\n refreshLayout(): void {\n this.pathElem.setAttribute(\"d\", this.pathAttribute(this.x));\n }\n}\n"]}
1
+ {"version":3,"file":"embelishments.js","sourceRoot":"","sources":["../../../src/carnatic/embelishments.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AAGvC,sCAAyC;AAOzC,MAAsB,wBAAyB,SAAQ,qBAAY;IACjE,YAA4B,QAAsB;QAChD,KAAK,EAAE,CAAC;QADkB,aAAQ,GAAR,QAAQ,CAAc;IAElD,CAAC;CACF;AAJD,4DAIC;AAED,MAAa,eAAgB,SAAQ,wBAAwB;IAK3D,YAA4B,QAAsB,EAAkB,IAAU;QAC5E,KAAK,CAAC,QAAQ,CAAC,CAAC;QADU,aAAQ,GAAR,QAAQ,CAAc;QAAkB,SAAI,GAAJ,IAAI,CAAM;QAJ9E,cAAS,GAAG,CAAC,CAAC;QACd,eAAU,GAAG,GAAG,CAAC;QAKf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AY,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF;AAvDD,sBAuDC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Note } from \"../core\";\nimport { BeatView } from \"../beatview\";\nimport { Embelishment } from \"../shapes\";\nimport { LeafAtomView } from \"./atomviews\";\nimport { JaaruGamaka } from \"./gamakas\";\n\n/**\n * Embelishments specifically \"around\" a single atom view.\n */\nexport abstract class LeafAtomViewEmbelishment extends Embelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super();\n }\n}\n\nexport class OctaveIndicator extends LeafAtomViewEmbelishment {\n dotRadius = 1;\n dotSpacing = 2.5;\n dotsElem: SVGGElement;\n\n constructor(public readonly noteView: LeafAtomView, public readonly note: Note) {\n super(noteView);\n const rootElem = this.noteView.embRoot();\n const numDots = Math.abs(note.octave);\n this.dotsElem = TSU.DOM.createSVGNode(\"g\", {\n doc: document,\n parent: rootElem,\n attrs: {\n width: this.dotRadius * 2 * numDots + (numDots - 1) * this.dotSpacing,\n height: this.dotRadius * 2,\n source: \"atom\" + this.noteView.leafAtom.uuid,\n },\n });\n let cx = 0;\n for (let i = 0; i < numDots; i++) {\n TSU.DOM.createSVGNode(\"circle\", {\n doc: document,\n parent: this.dotsElem,\n attrs: {\n cx: cx,\n cy: 0,\n r: this.dotRadius,\n stroke: \"black\",\n \"stroke-width\": \"1\",\n },\n });\n cx += this.dotRadius + this.dotRadius + this.dotSpacing;\n }\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.dotsElem);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n const numDots = Math.abs(this.note.octave);\n return {\n width: this.dotRadius * 2 * numDots + (numDots - 1) * this.dotSpacing,\n height: this.dotRadius * 2,\n };\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n if (x == null) x = this.x;\n if (y == null) y = this.y;\n // cannot set w/h\n // this.bbox.x = x;\n // this.bbox.y = y;\n return [x, y, null, null];\n }\n\n refreshLayout(): void {\n this.dotsElem.setAttribute(\"transform\", \"translate(\" + this.x + \",\" + this.y + \")\");\n }\n}\n\n////////// Carnatic embelishments\nexport class LabelEmbelishment extends LeafAtomViewEmbelishment {\n labelElem: SVGTextElement;\n constructor(public readonly label: string, public readonly atomView: LeafAtomView) {\n super(atomView);\n const rootElem = this.atomView.embRoot();\n this.labelElem = TSU.DOM.createSVGNode(\"text\", {\n doc: document,\n parent: rootElem,\n text: label,\n attrs: {\n source: \"atom\" + this.atomView.leafAtom.uuid,\n \"dominant-baseline\": \"hanging\",\n },\n });\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.labelElem);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return TSU.DOM.svgBBox(this.labelElem);\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, y, w, h];\n }\n\n refreshLayout(): void {\n this.labelElem.setAttribute(\"x\", \"\" + this.x);\n this.labelElem.setAttribute(\"y\", \"\" + this.y);\n }\n}\n\nexport class BeatStartLines extends Embelishment {\n barSpacing = 10;\n protected line: SVGLineElement;\n\n constructor(public readonly source: BeatView, public readonly rootElement: SVGGraphicsElement) {\n super();\n this.line = TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n parent: this.rootElement,\n attrs: {\n stroke: \"black\",\n \"stroke-width\": \"1\",\n class: \"bar-start-line\",\n },\n });\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n refreshLayout(): void {\n const line = this.line;\n const x = this.source.x - this.barSpacing;\n line.setAttribute(\"x1\", \"\" + x);\n line.setAttribute(\"x2\", \"\" + x);\n const y = this.source.y + this.source.bbox.y;\n const h = this.source.bbox.height;\n line.setAttribute(\"y1\", \"\" + y);\n line.setAttribute(\"y2\", \"\" + (y + h));\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, y, null, h];\n }\n}\n\nexport class BeatEndLines extends Embelishment {\n lineSpacing = 2;\n protected lines: SVGLineElement[];\n\n constructor(public readonly source: BeatView, public readonly rootElement: SVGGraphicsElement, nLines = 1) {\n super();\n this.lines = [];\n for (let i = 0; i < nLines; i++) {\n this.lines.push(\n TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n // parent: l2g,\n parent: this.rootElement,\n attrs: {\n stroke: \"black\",\n \"stroke-width\": \"1\",\n class: \"bar-end-line\",\n },\n }),\n );\n }\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected updatePosition(x: null | number, y: null | number): [number | null, number | null] {\n return [x, y];\n }\n\n barSpacing = 0;\n\n refreshLayout(): void {\n // const x = this.source.width + this.barSpacing;\n // const y = 0;\n // const h = this.source.height;\n const x = this.source.x + this.source.width + this.barSpacing;\n const y = this.source.y + this.source.bbox.y;\n const h = this.source.bbox.height;\n let currX = x;\n for (const line of this.lines) {\n const lx = \"\" + currX;\n line.setAttribute(\"x1\", lx);\n line.setAttribute(\"x2\", lx);\n currX += 4;\n }\n for (const line of this.lines) {\n line.setAttribute(\"y1\", \"\" + y);\n line.setAttribute(\"y2\", \"\" + (y + h));\n }\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [null, null, null, null];\n }\n}\n\n/// Carnatic Embelishments\nexport class Kampitham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"~\", atomView);\n }\n}\n\nexport class Nokku extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"w\", atomView);\n }\n}\n\nexport class Prathyagatham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"∵\", atomView);\n }\n}\nexport class Spuritham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"∴\", atomView);\n }\n}\nexport class Raavi extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"^\", atomView);\n }\n}\nexport class Kandippu extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"✓\", atomView);\n }\n}\n\nexport class Vaali extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"⌒\", atomView);\n }\n}\nexport class Odukkal extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"x\", atomView);\n }\n}\nexport class Orikkai extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"γ\", atomView);\n }\n}\n\nexport class Jaaru extends LeafAtomViewEmbelishment {\n pathElem: SVGPathElement;\n constructor(public readonly jaaru: JaaruGamaka, public readonly atomView: LeafAtomView) {\n super(atomView);\n // TODO - Create the \"fancier\" view\n // for now represent this with just a slant line (like a slash)\n const rootElem = this.atomView.embRoot();\n this.pathElem = TSU.DOM.createSVGNode(\"path\", {\n doc: document,\n parent: rootElem,\n attrs: {\n source: \"atom\" + this.atomView.leafAtom.uuid,\n stroke: \"black\",\n fill: \"transparent\",\n d: this.pathAttribute(),\n },\n });\n }\n\n pathAttribute(x = 0): string {\n const avbbox = this.atomView.glyph.minSize;\n let y2 = 0;\n const h2 = avbbox.height / 2;\n const x2 = x + h2;\n let y = this.atomView.y;\n if (this.jaaru.ascending) {\n y += avbbox.height;\n y2 = y - h2;\n } else {\n y -= h2;\n y2 = y + h2;\n }\n return [`M ${x} ${y}`, `Q ${x2} ${y} ${x2} ${y2}`].join(\" \");\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return TSU.DOM.svgBBox(this.pathElem);\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.pathElem);\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, null, null, null];\n }\n\n refreshLayout(): void {\n this.pathElem.setAttribute(\"d\", this.pathAttribute(this.x));\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import * as TSU from "@panyam/tsutils";
1
2
  import { Embelishment } from "../shapes";
2
3
  import { GridCell, GridCellView } from "../grids";
3
4
  import { ElementShape } from "../shapes";
@@ -14,6 +15,7 @@ export declare class MarkerView extends ElementShape<SVGGElement> implements Gri
14
15
  rootGroup: SVGGElement;
15
16
  textElement: SVGTextElement;
16
17
  constructor(cell: GridCell, beat: Beat, markers: Marker[], isPreMarker: boolean, rootElement: SVGGraphicsElement, config?: any);
18
+ protected refreshMinSize(): TSU.Geom.Size;
17
19
  refreshLayout(): void;
18
20
  protected updateBounds(x: null | number, y: null | number, w: null | number, h: null | number): [number | null, number | null, number | null, number | null];
19
21
  }
@@ -29,10 +29,17 @@ export class MarkerView extends ElementShape {
29
29
  attrs: {
30
30
  class: "markerText",
31
31
  pre: isPreMarker,
32
+ dx: isPreMarker ? 0 : 15,
32
33
  },
33
34
  text: this.markers[0].text,
34
35
  });
35
36
  }
37
+ refreshMinSize() {
38
+ const ts = TSU.DOM.svgBBox(this.textElement);
39
+ const totalWidth = ts.width;
40
+ const maxHeight = ts.height;
41
+ return new TSU.Geom.Size(totalWidth + 5, maxHeight + 5);
42
+ }
36
43
  refreshLayout() {
37
44
  this.rootGroup.setAttribute("transform", "translate(" + this.x + "," + this.y + ")");
38
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"beatviews.js","sourceRoot":"","sources":["../../../src/carnatic/beatviews.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,iBAAiB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AAI,CAAC,SAAS,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,EAAE;YAEnE,MAAM,GAAG,GAAG,IAAI,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YAClD,aAAa,GAAG,CAAC,GAAG,CAAC,CAAC;SACvB;aAAM;YACL,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YACzB,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACtC,IAAI,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC,SAAS,GAAG,CAAC,EAAE;gBAIvC,IAAI,IAAI,CAAC,QAAQ,IAAI,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;oBAC1D,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;wBAE1C,MAAM,GAAG,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;wBACnD,aAAa,GAAG,CAAC,GAAG,CAAC,CAAC;qBACvB;yBAAM;wBAEL,MAAM,GAAG,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;wBAChD,aAAa,GAAG,CAAC,GAAG,CAAC,CAAC;qBACvB;iBACF;aACF;SACF;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Embelishment } from \"../shapes\";\nimport { GridCell, GridCellView } from \"../grids\";\nimport { ElementShape } from \"../shapes\";\nimport { createAtomView } from \"./atomviews\";\nimport { Marker } from \"../core\";\nimport { Beat } from \"../beats\";\nimport { BeatView as BeatViewBase } from \"../beatview\";\nimport { BeatStartLines, BeatEndLines } from \"./embelishments\";\n\nexport class MarkerView extends ElementShape<SVGGElement> implements GridCellView {\n needsLayout = true;\n rootGroup: SVGGElement;\n textElement: SVGTextElement;\n constructor(\n public readonly cell: GridCell,\n public readonly beat: Beat,\n public readonly markers: Marker[],\n public readonly isPreMarker: boolean,\n public readonly rootElement: SVGGraphicsElement,\n config?: any,\n ) {\n const rootGroup = TSU.DOM.createSVGNode(\"g\", {\n parent: rootElement,\n attrs: {\n class: \"markerView\",\n pre: isPreMarker,\n roleName: beat.role.name,\n beatIndex: \"\" + beat.index,\n gridRow: cell.rowIndex,\n gridCol: cell.colIndex,\n },\n });\n super(rootGroup);\n this.rootGroup = rootGroup as SVGGElement;\n this.textElement = TSU.DOM.createSVGNode(\"text\", {\n parent: rootGroup,\n attrs: {\n class: \"markerText\",\n pre: isPreMarker,\n },\n text: this.markers[0].text,\n });\n }\n\n refreshLayout(): void {\n // TODO - move this code out to refreshLayout?\n // set the glyphs Y first so we can layout others\n this.rootGroup.setAttribute(\"transform\", \"translate(\" + this.x + \",\" + this.y + \")\");\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, y, NaN, NaN];\n }\n}\n\nexport class BeatView extends BeatViewBase {\n createAtomView() {\n return createAtomView(this.element, this.beat.atom, this.beat.role.defaultToNotes);\n }\n\n refreshLayout(): void {\n const newX = this.hasX ? this._x : 0;\n const newY = this.hasY ? this._y : 0;\n this.element.setAttribute(\"transform\", \"translate(\" + newX + \",\" + newY + \")\");\n this.invalidateBounds();\n for (const e of this.embelishments) e.refreshLayout();\n this.invalidateBounds();\n }\n\n protected createEmbelishments(): Embelishment[] {\n let embelishments: Embelishment[] = [];\n const beat = this.beat;\n // TODO - Should this be the group's parent element?\n const rootElement = this.rootElement;\n if (beat.beatIndex == 0 && beat.barIndex == 0 && beat.instance == 0) {\n // first beat in bar - Do a BarStart\n const emb = new BeatStartLines(this, rootElement);\n embelishments = [emb];\n } else {\n const cycle = this.cycle;\n const bar = cycle.bars[beat.barIndex];\n if (beat.beatIndex == bar.beatCount - 1) {\n // It is important that we are not just looking at the last beat of the bar\n // but also in the last \"instance\" of the beat in this bar to account for\n // kalais\n if (beat.instance == bar.instanceCount(beat.beatIndex) - 1) {\n if (beat.barIndex == cycle.bars.length - 1) {\n // last beat in last bar so - do a thalam end (2 lines)\n const emb = new BeatEndLines(this, rootElement, 2);\n embelishments = [emb];\n } else {\n // end of a bar so single line end\n const emb = new BeatEndLines(this, rootElement);\n embelishments = [emb];\n }\n }\n }\n }\n return embelishments;\n }\n}\n"]}
1
+ {"version":3,"file":"beatviews.js","sourceRoot":"","sources":["../../../src/carnatic/beatviews.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/D,MAAM,OAAO,UAAW,SAAQ,YAAyB;IAIvD,YACkB,IAAc,EACd,IAAU,EACV,OAAiB,EACjB,WAAoB,EACpB,WAA+B,EAC/C,MAAY;QAEZ,MAAM,SAAS,GAAG,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,EAAE;YAC3C,MAAM,EAAE,WAAW;YACnB,KAAK,EAAE;gBACL,KAAK,EAAE,YAAY;gBACnB,GAAG,EAAE,WAAW;gBAChB,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;gBACxB,SAAS,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK;gBAC1B,OAAO,EAAE,IAAI,CAAC,QAAQ;gBACtB,OAAO,EAAE,IAAI,CAAC,QAAQ;aACvB;SACF,CAAC,CAAC;QACH,KAAK,CAAC,SAAS,CAAC,CAAC;QAlBD,SAAI,GAAJ,IAAI,CAAU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AAS,IAAI,GAAG,CAAC,SAAS,GAAG,CAAC,EAAE;gBAIvC,IAAI,IAAI,CAAC,QAAQ,IAAI,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;oBAC1D,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;wBAE1C,MAAM,GAAG,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;wBACnD,aAAa,GAAG,CAAC,GAAG,CAAC,CAAC;qBACvB;yBAAM;wBAEL,MAAM,GAAG,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;wBAChD,aAAa,GAAG,CAAC,GAAG,CAAC,CAAC;qBACvB;iBACF;aACF;SACF;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Embelishment } from \"../shapes\";\nimport { GridCell, GridCellView } from \"../grids\";\nimport { ElementShape } from \"../shapes\";\nimport { createAtomView } from \"./atomviews\";\nimport { Marker } from \"../core\";\nimport { Beat } from \"../beats\";\nimport { BeatView as BeatViewBase } from \"../beatview\";\nimport { BeatStartLines, BeatEndLines } from \"./embelishments\";\n\nexport class MarkerView extends ElementShape<SVGGElement> implements GridCellView {\n needsLayout = true;\n rootGroup: SVGGElement;\n textElement: SVGTextElement;\n constructor(\n public readonly cell: GridCell,\n public readonly beat: Beat,\n public readonly markers: Marker[],\n public readonly isPreMarker: boolean,\n public readonly rootElement: SVGGraphicsElement,\n config?: any,\n ) {\n const rootGroup = TSU.DOM.createSVGNode(\"g\", {\n parent: rootElement,\n attrs: {\n class: \"markerView\",\n pre: isPreMarker,\n roleName: beat.role.name,\n beatIndex: \"\" + beat.index,\n gridRow: cell.rowIndex,\n gridCol: cell.colIndex,\n },\n });\n super(rootGroup);\n this.rootGroup = rootGroup as SVGGElement;\n this.textElement = TSU.DOM.createSVGNode(\"text\", {\n parent: rootGroup,\n attrs: {\n class: \"markerText\",\n pre: isPreMarker,\n dx: isPreMarker ? 0 : 15,\n },\n text: this.markers[0].text,\n });\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n const ts = TSU.DOM.svgBBox(this.textElement);\n const totalWidth = ts.width;\n const maxHeight = ts.height;\n return new TSU.Geom.Size(totalWidth + 5, maxHeight + 5);\n }\n\n refreshLayout(): void {\n // TODO - move this code out to refreshLayout?\n // set the glyphs Y first so we can layout others\n this.rootGroup.setAttribute(\"transform\", \"translate(\" + this.x + \",\" + this.y + \")\");\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, y, NaN, NaN];\n }\n}\n\nexport class BeatView extends BeatViewBase {\n createAtomView() {\n return createAtomView(this.element, this.beat.atom, this.beat.role.defaultToNotes);\n }\n\n refreshLayout(): void {\n const newX = this.hasX ? this._x : 0;\n const newY = this.hasY ? this._y : 0;\n this.element.setAttribute(\"transform\", \"translate(\" + newX + \",\" + newY + \")\");\n this.invalidateBounds();\n for (const e of this.embelishments) e.refreshLayout();\n this.invalidateBounds();\n }\n\n protected createEmbelishments(): Embelishment[] {\n let embelishments: Embelishment[] = [];\n const beat = this.beat;\n // TODO - Should this be the group's parent element?\n const rootElement = this.rootElement;\n if (beat.beatIndex == 0 && beat.barIndex == 0 && beat.instance == 0) {\n // first beat in bar - Do a BarStart\n const emb = new BeatStartLines(this, rootElement);\n embelishments = [emb];\n } else {\n const cycle = this.cycle;\n const bar = cycle.bars[beat.barIndex];\n if (beat.beatIndex == bar.beatCount - 1) {\n // It is important that we are not just looking at the last beat of the bar\n // but also in the last \"instance\" of the beat in this bar to account for\n // kalais\n if (beat.instance == bar.instanceCount(beat.beatIndex) - 1) {\n if (beat.barIndex == cycle.bars.length - 1) {\n // last beat in last bar so - do a thalam end (2 lines)\n const emb = new BeatEndLines(this, rootElement, 2);\n embelishments = [emb];\n } else {\n // end of a bar so single line end\n const emb = new BeatEndLines(this, rootElement);\n embelishments = [emb];\n }\n }\n }\n }\n return embelishments;\n }\n}\n"]}
@@ -133,7 +133,7 @@ export class BeatEndLines extends Embelishment {
133
133
  this.source = source;
134
134
  this.rootElement = rootElement;
135
135
  this.lineSpacing = 2;
136
- this.barSpacing = 15;
136
+ this.barSpacing = 0;
137
137
  this.lines = [];
138
138
  for (let i = 0; i < nLines; i++) {
139
139
  this.lines.push(TSU.DOM.createSVGNode("line", {
@@ -1 +1 @@
1
- {"version":3,"file":"embelishments.js","sourceRoot":"","sources":["../../../src/carnatic/embelishments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAOzC,MAAM,OAAgB,wBAAyB,SAAQ,YAAY;IACjE,YAA4B,QAAsB;QAChD,KAAK,EAAE,CAAC;QADkB,aAAQ,GAAR,QAAQ,CAAc;IAElD,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,wBAAwB;IAK3D,YAA4B,QAAsB,EAAkB,IAAU;QAC5E,KAAK,CAAC,QAAQ,CAAC,CAAC;QADU,aAAQ,GAAR,QAAQ,CAAc;QAAkB,SAAI,GAAJ,IAAI,CAAM;QAJ9E,cAAS,GAAG,CAAC,CAAC;QACd,eAAU,GAAG,GAAG,CAAC;QAKf,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,EAAE;YACzC,GAAG,EAAE,QAAQ;YACb,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE;gBACL,KAAK,EAAE,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,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C,CAAC;QACxB,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;YACxB,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;YACnB,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;SACb;aAAM;YACL,CAAC,IAAI,EAAE,CAAC;YACR,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;SACb;QACD,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/D,CAAC;IAES,cAAc;QACtB,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAES,WAAW;QACnB,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAES,YAAY,CACpB,CAAgB,EAChB,CAAgB,EAChB,CAAgB,EAChB,CAAgB;QAEhB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,aAAa;QACX,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Note } from \"../core\";\nimport { BeatView } from \"../beatview\";\nimport { Embelishment } from \"../shapes\";\nimport { LeafAtomView } from \"./atomviews\";\nimport { JaaruGamaka } from \"./gamakas\";\n\n/**\n * Embelishments specifically \"around\" a single atom view.\n */\nexport abstract class LeafAtomViewEmbelishment extends Embelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super();\n }\n}\n\nexport class OctaveIndicator extends LeafAtomViewEmbelishment {\n dotRadius = 1;\n dotSpacing = 2.5;\n dotsElem: SVGGElement;\n\n constructor(public readonly noteView: LeafAtomView, public readonly note: Note) {\n super(noteView);\n const rootElem = this.noteView.embRoot();\n const numDots = Math.abs(note.octave);\n this.dotsElem = TSU.DOM.createSVGNode(\"g\", {\n doc: document,\n parent: rootElem,\n attrs: {\n width: this.dotRadius * 2 * numDots + (numDots - 1) * this.dotSpacing,\n height: this.dotRadius * 2,\n source: \"atom\" + this.noteView.leafAtom.uuid,\n },\n });\n let cx = 0;\n for (let i = 0; i < numDots; i++) {\n TSU.DOM.createSVGNode(\"circle\", {\n doc: document,\n parent: this.dotsElem,\n attrs: {\n cx: cx,\n cy: 0,\n r: this.dotRadius,\n stroke: \"black\",\n \"stroke-width\": \"1\",\n },\n });\n cx += this.dotRadius + this.dotRadius + this.dotSpacing;\n }\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.dotsElem);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n const numDots = Math.abs(this.note.octave);\n return {\n width: this.dotRadius * 2 * numDots + (numDots - 1) * this.dotSpacing,\n height: this.dotRadius * 2,\n };\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n if (x == null) x = this.x;\n if (y == null) y = this.y;\n // cannot set w/h\n // this.bbox.x = x;\n // this.bbox.y = y;\n return [x, y, null, null];\n }\n\n refreshLayout(): void {\n this.dotsElem.setAttribute(\"transform\", \"translate(\" + this.x + \",\" + this.y + \")\");\n }\n}\n\n////////// Carnatic embelishments\nexport class LabelEmbelishment extends LeafAtomViewEmbelishment {\n labelElem: SVGTextElement;\n constructor(public readonly label: string, public readonly atomView: LeafAtomView) {\n super(atomView);\n const rootElem = this.atomView.embRoot();\n this.labelElem = TSU.DOM.createSVGNode(\"text\", {\n doc: document,\n parent: rootElem,\n text: label,\n attrs: {\n source: \"atom\" + this.atomView.leafAtom.uuid,\n \"dominant-baseline\": \"hanging\",\n },\n });\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.labelElem);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return TSU.DOM.svgBBox(this.labelElem);\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, y, w, h];\n }\n\n refreshLayout(): void {\n this.labelElem.setAttribute(\"x\", \"\" + this.x);\n this.labelElem.setAttribute(\"y\", \"\" + this.y);\n }\n}\n\nexport class BeatStartLines extends Embelishment {\n barSpacing = 10;\n protected line: SVGLineElement;\n\n constructor(public readonly source: BeatView, public readonly rootElement: SVGGraphicsElement) {\n super();\n this.line = TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n parent: this.rootElement,\n attrs: {\n stroke: \"black\",\n \"stroke-width\": \"1\",\n class: \"bar-start-line\",\n },\n });\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n refreshLayout(): void {\n const line = this.line;\n const x = this.source.x - this.barSpacing;\n line.setAttribute(\"x1\", \"\" + x);\n line.setAttribute(\"x2\", \"\" + x);\n const y = this.source.y + this.source.bbox.y;\n const h = this.source.bbox.height;\n line.setAttribute(\"y1\", \"\" + y);\n line.setAttribute(\"y2\", \"\" + (y + h));\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, y, null, h];\n }\n}\n\nexport class BeatEndLines extends Embelishment {\n lineSpacing = 2;\n protected lines: SVGLineElement[];\n\n constructor(public readonly source: BeatView, public readonly rootElement: SVGGraphicsElement, nLines = 1) {\n super();\n this.lines = [];\n for (let i = 0; i < nLines; i++) {\n this.lines.push(\n TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n // parent: l2g,\n parent: this.rootElement,\n attrs: {\n stroke: \"black\",\n \"stroke-width\": \"1\",\n class: \"bar-end-line\",\n },\n }),\n );\n }\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected updatePosition(x: null | number, y: null | number): [number | null, number | null] {\n return [x, y];\n }\n\n barSpacing = 15;\n\n refreshLayout(): void {\n // const x = this.source.width + this.barSpacing;\n // const y = 0;\n // const h = this.source.height;\n const x = this.source.x + this.source.width + this.barSpacing;\n const y = this.source.y + this.source.bbox.y;\n const h = this.source.bbox.height;\n let currX = x;\n for (const line of this.lines) {\n const lx = \"\" + currX;\n line.setAttribute(\"x1\", lx);\n line.setAttribute(\"x2\", lx);\n currX += 4;\n }\n for (const line of this.lines) {\n line.setAttribute(\"y1\", \"\" + y);\n line.setAttribute(\"y2\", \"\" + (y + h));\n }\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [null, null, null, null];\n }\n}\n\n/// Carnatic Embelishments\nexport class Kampitham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"~\", atomView);\n }\n}\n\nexport class Nokku extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"w\", atomView);\n }\n}\n\nexport class Prathyagatham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"∵\", atomView);\n }\n}\nexport class Spuritham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"∴\", atomView);\n }\n}\nexport class Raavi extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"^\", atomView);\n }\n}\nexport class Kandippu extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"✓\", atomView);\n }\n}\n\nexport class Vaali extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"⌒\", atomView);\n }\n}\nexport class Odukkal extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"x\", atomView);\n }\n}\nexport class Orikkai extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"γ\", atomView);\n }\n}\n\nexport class Jaaru extends LeafAtomViewEmbelishment {\n pathElem: SVGPathElement;\n constructor(public readonly jaaru: JaaruGamaka, public readonly atomView: LeafAtomView) {\n super(atomView);\n // TODO - Create the \"fancier\" view\n // for now represent this with just a slant line (like a slash)\n const rootElem = this.atomView.embRoot();\n this.pathElem = TSU.DOM.createSVGNode(\"path\", {\n doc: document,\n parent: rootElem,\n attrs: {\n source: \"atom\" + this.atomView.leafAtom.uuid,\n stroke: \"black\",\n fill: \"transparent\",\n d: this.pathAttribute(),\n },\n });\n }\n\n pathAttribute(x = 0): string {\n const avbbox = this.atomView.glyph.minSize;\n let y2 = 0;\n const h2 = avbbox.height / 2;\n const x2 = x + h2;\n let y = this.atomView.y;\n if (this.jaaru.ascending) {\n y += avbbox.height;\n y2 = y - h2;\n } else {\n y -= h2;\n y2 = y + h2;\n }\n return [`M ${x} ${y}`, `Q ${x2} ${y} ${x2} ${y2}`].join(\" \");\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return TSU.DOM.svgBBox(this.pathElem);\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.pathElem);\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, null, null, null];\n }\n\n refreshLayout(): void {\n this.pathElem.setAttribute(\"d\", this.pathAttribute(this.x));\n }\n}\n"]}
1
+ {"version":3,"file":"embelishments.js","sourceRoot":"","sources":["../../../src/carnatic/embelishments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAA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OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAES,YAAY,CACpB,CAAgB,EAChB,CAAgB,EAChB,CAAgB,EAChB,CAAgB;QAEhB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,aAAa;QACX,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport { Note } from \"../core\";\nimport { BeatView } from \"../beatview\";\nimport { Embelishment } from \"../shapes\";\nimport { LeafAtomView } from \"./atomviews\";\nimport { JaaruGamaka } from \"./gamakas\";\n\n/**\n * Embelishments specifically \"around\" a single atom view.\n */\nexport abstract class LeafAtomViewEmbelishment extends Embelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super();\n }\n}\n\nexport class OctaveIndicator extends LeafAtomViewEmbelishment {\n dotRadius = 1;\n dotSpacing = 2.5;\n dotsElem: SVGGElement;\n\n constructor(public readonly noteView: LeafAtomView, public readonly note: Note) {\n super(noteView);\n const rootElem = this.noteView.embRoot();\n const numDots = Math.abs(note.octave);\n this.dotsElem = TSU.DOM.createSVGNode(\"g\", {\n doc: document,\n parent: rootElem,\n attrs: {\n width: this.dotRadius * 2 * numDots + (numDots - 1) * this.dotSpacing,\n height: this.dotRadius * 2,\n source: \"atom\" + this.noteView.leafAtom.uuid,\n },\n });\n let cx = 0;\n for (let i = 0; i < numDots; i++) {\n TSU.DOM.createSVGNode(\"circle\", {\n doc: document,\n parent: this.dotsElem,\n attrs: {\n cx: cx,\n cy: 0,\n r: this.dotRadius,\n stroke: \"black\",\n \"stroke-width\": \"1\",\n },\n });\n cx += this.dotRadius + this.dotRadius + this.dotSpacing;\n }\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.dotsElem);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n const numDots = Math.abs(this.note.octave);\n return {\n width: this.dotRadius * 2 * numDots + (numDots - 1) * this.dotSpacing,\n height: this.dotRadius * 2,\n };\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n if (x == null) x = this.x;\n if (y == null) y = this.y;\n // cannot set w/h\n // this.bbox.x = x;\n // this.bbox.y = y;\n return [x, y, null, null];\n }\n\n refreshLayout(): void {\n this.dotsElem.setAttribute(\"transform\", \"translate(\" + this.x + \",\" + this.y + \")\");\n }\n}\n\n////////// Carnatic embelishments\nexport class LabelEmbelishment extends LeafAtomViewEmbelishment {\n labelElem: SVGTextElement;\n constructor(public readonly label: string, public readonly atomView: LeafAtomView) {\n super(atomView);\n const rootElem = this.atomView.embRoot();\n this.labelElem = TSU.DOM.createSVGNode(\"text\", {\n doc: document,\n parent: rootElem,\n text: label,\n attrs: {\n source: \"atom\" + this.atomView.leafAtom.uuid,\n \"dominant-baseline\": \"hanging\",\n },\n });\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.labelElem);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return TSU.DOM.svgBBox(this.labelElem);\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, y, w, h];\n }\n\n refreshLayout(): void {\n this.labelElem.setAttribute(\"x\", \"\" + this.x);\n this.labelElem.setAttribute(\"y\", \"\" + this.y);\n }\n}\n\nexport class BeatStartLines extends Embelishment {\n barSpacing = 10;\n protected line: SVGLineElement;\n\n constructor(public readonly source: BeatView, public readonly rootElement: SVGGraphicsElement) {\n super();\n this.line = TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n parent: this.rootElement,\n attrs: {\n stroke: \"black\",\n \"stroke-width\": \"1\",\n class: \"bar-start-line\",\n },\n });\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n refreshLayout(): void {\n const line = this.line;\n const x = this.source.x - this.barSpacing;\n line.setAttribute(\"x1\", \"\" + x);\n line.setAttribute(\"x2\", \"\" + x);\n const y = this.source.y + this.source.bbox.y;\n const h = this.source.bbox.height;\n line.setAttribute(\"y1\", \"\" + y);\n line.setAttribute(\"y2\", \"\" + (y + h));\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, y, null, h];\n }\n}\n\nexport class BeatEndLines extends Embelishment {\n lineSpacing = 2;\n protected lines: SVGLineElement[];\n\n constructor(public readonly source: BeatView, public readonly rootElement: SVGGraphicsElement, nLines = 1) {\n super();\n this.lines = [];\n for (let i = 0; i < nLines; i++) {\n this.lines.push(\n TSU.DOM.createSVGNode(\"line\", {\n doc: document,\n // parent: l2g,\n parent: this.rootElement,\n attrs: {\n stroke: \"black\",\n \"stroke-width\": \"1\",\n class: \"bar-end-line\",\n },\n }),\n );\n }\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return new TSU.Geom.Rect(0, 0, 0, 0);\n }\n\n protected updatePosition(x: null | number, y: null | number): [number | null, number | null] {\n return [x, y];\n }\n\n barSpacing = 0;\n\n refreshLayout(): void {\n // const x = this.source.width + this.barSpacing;\n // const y = 0;\n // const h = this.source.height;\n const x = this.source.x + this.source.width + this.barSpacing;\n const y = this.source.y + this.source.bbox.y;\n const h = this.source.bbox.height;\n let currX = x;\n for (const line of this.lines) {\n const lx = \"\" + currX;\n line.setAttribute(\"x1\", lx);\n line.setAttribute(\"x2\", lx);\n currX += 4;\n }\n for (const line of this.lines) {\n line.setAttribute(\"y1\", \"\" + y);\n line.setAttribute(\"y2\", \"\" + (y + h));\n }\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [null, null, null, null];\n }\n}\n\n/// Carnatic Embelishments\nexport class Kampitham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"~\", atomView);\n }\n}\n\nexport class Nokku extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"w\", atomView);\n }\n}\n\nexport class Prathyagatham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"∵\", atomView);\n }\n}\nexport class Spuritham extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"∴\", atomView);\n }\n}\nexport class Raavi extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"^\", atomView);\n }\n}\nexport class Kandippu extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"✓\", atomView);\n }\n}\n\nexport class Vaali extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"⌒\", atomView);\n }\n}\nexport class Odukkal extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"x\", atomView);\n }\n}\nexport class Orikkai extends LabelEmbelishment {\n constructor(public readonly atomView: LeafAtomView) {\n super(\"γ\", atomView);\n }\n}\n\nexport class Jaaru extends LeafAtomViewEmbelishment {\n pathElem: SVGPathElement;\n constructor(public readonly jaaru: JaaruGamaka, public readonly atomView: LeafAtomView) {\n super(atomView);\n // TODO - Create the \"fancier\" view\n // for now represent this with just a slant line (like a slash)\n const rootElem = this.atomView.embRoot();\n this.pathElem = TSU.DOM.createSVGNode(\"path\", {\n doc: document,\n parent: rootElem,\n attrs: {\n source: \"atom\" + this.atomView.leafAtom.uuid,\n stroke: \"black\",\n fill: \"transparent\",\n d: this.pathAttribute(),\n },\n });\n }\n\n pathAttribute(x = 0): string {\n const avbbox = this.atomView.glyph.minSize;\n let y2 = 0;\n const h2 = avbbox.height / 2;\n const x2 = x + h2;\n let y = this.atomView.y;\n if (this.jaaru.ascending) {\n y += avbbox.height;\n y2 = y - h2;\n } else {\n y -= h2;\n y2 = y + h2;\n }\n return [`M ${x} ${y}`, `Q ${x2} ${y} ${x2} ${y2}`].join(\" \");\n }\n\n protected refreshMinSize(): TSU.Geom.Size {\n return TSU.DOM.svgBBox(this.pathElem);\n }\n\n protected refreshBBox(): TSU.Geom.Rect {\n return TSU.DOM.svgBBox(this.pathElem);\n }\n\n protected updateBounds(\n x: null | number,\n y: null | number,\n w: null | number,\n h: null | number,\n ): [number | null, number | null, number | null, number | null] {\n return [x, null, null, null];\n }\n\n refreshLayout(): void {\n this.pathElem.setAttribute(\"d\", this.pathAttribute(this.x));\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notations",
3
- "version": "0.0.51",
3
+ "version": "0.0.52",
4
4
  "author": "Sriram Panyam",
5
5
  "description": "A package for modelling, parsing, laying out carnatic musical notation",
6
6
  "homepage": "https://github.com/panyam/notations#readme",