Skip to content

Commit 6c82468

Browse files
authored
add south node symbol (#49)
1 parent aa5b1de commit 6c82468

6 files changed

Lines changed: 37 additions & 2 deletions

File tree

dist/astrochart.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/project/src/settings.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export interface Settings {
5050
SYMBOL_CHIRON: string;
5151
SYMBOL_LILITH: string;
5252
SYMBOL_NNODE: string;
53+
SYMBOL_SNODE: string;
5354
SYMBOL_AS: string;
5455
SYMBOL_DS: string;
5556
SYMBOL_MC: string;

dist/project/src/svg.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ declare class SVG {
6969
chiron(x: number, y: number): Element;
7070
lilith(x: number, y: number): Element;
7171
nnode(x: number, y: number): Element;
72+
snode(x: number, y: number): Element;
7273
aries(x: number, y: number): Element;
7374
taurus(x: number, y: number): Element;
7475
gemini(x: number, y: number): Element;

project/examples/radix/radix.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<script type="text/javascript">
1717

1818
var data = {
19-
"planets":{"Lilith":[18], "Chiron":[18], "Pluto":[63], "Neptune":[110, 0.2], "Uranus":[318], "Saturn":[201, -0.2], "Jupiter":[192], "Mars":[210], "Moon":[268], "Sun":[281], "Mercury":[312], "Venus":[330], "NNode":[2]},
19+
"planets":{"Lilith":[18], "Chiron":[18], "Pluto":[63], "Neptune":[110, 0.2], "Uranus":[318], "Saturn":[201, -0.2], "Jupiter":[192], "Mars":[210], "Moon":[268], "Sun":[281], "Mercury":[312], "Venus":[330], "NNode":[2], "SNode":[182]},
2020
"cusps":[296, 350, 30, 56, 75, 94, 116, 170, 210, 236, 255, 274]
2121
};
2222

project/src/settings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export interface Settings {
4848
SYMBOL_CHIRON: string
4949
SYMBOL_LILITH: string
5050
SYMBOL_NNODE: string
51+
SYMBOL_SNODE: string
5152
SYMBOL_AS: string
5253
SYMBOL_DS: string
5354
SYMBOL_MC: string
@@ -204,6 +205,7 @@ const settings: Settings = {
204205
SYMBOL_CHIRON: 'Chiron',
205206
SYMBOL_LILITH: 'Lilith',
206207
SYMBOL_NNODE: 'NNode',
208+
SYMBOL_SNODE: 'SNode',
207209

208210
// Axis
209211
SYMBOL_AS: 'As',

project/src/svg.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ class SVG {
7474
return this.lilith(x, y)
7575
case this.settings.SYMBOL_NNODE:
7676
return this.nnode(x, y)
77+
case this.settings.SYMBOL_SNODE:
78+
return this.snode(x, y)
7779
case this.settings.SYMBOL_ARIES:
7880
return this.aries(x, y)
7981
case this.settings.SYMBOL_TAURUS:
@@ -617,6 +619,35 @@ class SVG {
617619
return wrapper
618620
}
619621

622+
/*
623+
* SNode path
624+
* @private
625+
*
626+
* @param {int} x
627+
* @param {int} y
628+
*
629+
* @return {SVGPathElement} path
630+
*/
631+
snode (x: number, y: number): Element {
632+
// center symbol
633+
const xShift = 0
634+
const yShift = 0
635+
x = Math.round(x + (xShift * this.settings.SYMBOL_SCALE))
636+
y = Math.round(y + (yShift * this.settings.SYMBOL_SCALE))
637+
638+
const wrapper = document.createElementNS(this.context.root.namespaceURI, 'g')
639+
wrapper.setAttribute('transform', 'translate(' + (-x * (this.settings.SYMBOL_SCALE - 1)) + ',' + (-y * (this.settings.SYMBOL_SCALE - 1)) + ')')// scale(-1,1)
640+
641+
const node = document.createElementNS(this.context.root.namespaceURI, 'path')
642+
node.setAttribute('d', 'm' + x + ', ' + y + ' l1.3333282470703125,0.666656494140625l0.6666717529296875,0l1.3333282470703125,-0.666656494140625l0.6666717529296875,-1.333343505859375l0,-0.666656494140625l-0.6666717529296875,-1.333343505859375l-1.3333282470703125,-0.666656494140625l-0.6666717529296875,0l-1.3333282470703125,0.666656494140625l-0.6666717529296875,1.333343505859375l0,0.666656494140625l0.6666717529296875,1.333343505859375l2,2.666656494140625l0.6666717529296875,2l0,1.333343505859375l-0.6666717529296875,2l-1.3333282470703125,1.333343505859375l-2,0.666656494140625l-2.6666717529296875,0l-2,-0.666656494140625l-1.3333282470703125,-1.333343505859375l-0.6666717529296875,-2l0,-1.333343505859375l0.6666717529296875,-2l2,-2.666656494140625l0.666656494140625,-1.333343505859375l0,-0.666656494140625l-0.666656494140625,-1.333343505859375l-1.333343505859375,-0.666656494140625l-0.666656494140625,0l-1.333343505859375,0.666656494140625l-0.666656494140625,1.333343505859375l0,0.666656494140625l0.666656494140625,1.333343505859375l1.333343505859375,0.666656494140625l0.666656494140625,0l1.333343505859375,-0.666656494140625m8,6l-0.6666717529296875,1.333343505859375l-1.3333282470703125,1.33331298828125l-2,0.66668701171875l-2.6666717529296875,0l-2,-0.66668701171875l-1.3333282470703125,-1.33331298828125l-0.6666717529296875,-1.333343505859375')
643+
node.setAttribute('stroke', this.settings.POINTS_COLOR)
644+
node.setAttribute('stroke-width', this.settings.POINTS_STROKE.toString())
645+
node.setAttribute('fill', 'none')
646+
wrapper.appendChild(node)
647+
648+
return wrapper
649+
}
650+
620651
/*
621652
* Aries symbol path
622653
* @private

0 commit comments

Comments
 (0)