Skip to content

Commit 5671760

Browse files
authored
add part of fortune symbol (#51)
1 parent 6c82468 commit 5671760

6 files changed

Lines changed: 45 additions & 3 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
@@ -51,6 +51,7 @@ export interface Settings {
5151
SYMBOL_LILITH: string;
5252
SYMBOL_NNODE: string;
5353
SYMBOL_SNODE: string;
54+
SYMBOL_FORTUNE: string;
5455
SYMBOL_AS: string;
5556
SYMBOL_DS: string;
5657
SYMBOL_MC: string;

dist/project/src/svg.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ declare class SVG {
7070
lilith(x: number, y: number): Element;
7171
nnode(x: number, y: number): Element;
7272
snode(x: number, y: number): Element;
73+
fortune(x: number, y: number): Element;
7374
aries(x: number, y: number): Element;
7475
taurus(x: number, y: number): Element;
7576
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], "SNode":[182]},
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], "Fortune":[35]},
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
@@ -49,6 +49,7 @@ export interface Settings {
4949
SYMBOL_LILITH: string
5050
SYMBOL_NNODE: string
5151
SYMBOL_SNODE: string
52+
SYMBOL_FORTUNE: string
5253
SYMBOL_AS: string
5354
SYMBOL_DS: string
5455
SYMBOL_MC: string
@@ -206,6 +207,7 @@ const settings: Settings = {
206207
SYMBOL_LILITH: 'Lilith',
207208
SYMBOL_NNODE: 'NNode',
208209
SYMBOL_SNODE: 'SNode',
210+
SYMBOL_FORTUNE: 'Fortune',
209211

210212
// Axis
211213
SYMBOL_AS: 'As',

project/src/svg.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class SVG {
7676
return this.nnode(x, y)
7777
case this.settings.SYMBOL_SNODE:
7878
return this.snode(x, y)
79+
case this.settings.SYMBOL_FORTUNE:
80+
return this.fortune(x, y)
7981
case this.settings.SYMBOL_ARIES:
8082
return this.aries(x, y)
8183
case this.settings.SYMBOL_TAURUS:
@@ -636,7 +638,7 @@ class SVG {
636638
y = Math.round(y + (yShift * this.settings.SYMBOL_SCALE))
637639

638640
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)
641+
wrapper.setAttribute('transform', 'translate(' + (-x * (this.settings.SYMBOL_SCALE - 1)) + ',' + (-y * (this.settings.SYMBOL_SCALE - 1)) + ')')
640642

641643
const node = document.createElementNS(this.context.root.namespaceURI, 'path')
642644
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')
@@ -647,6 +649,42 @@ class SVG {
647649

648650
return wrapper
649651
}
652+
653+
/*
654+
* Fortune path
655+
* @private
656+
*
657+
* @param {int} x
658+
* @param {int} y
659+
*
660+
* @return {SVGPathElement} path
661+
*/
662+
fortune (x: number, y: number): Element {
663+
// center symbol
664+
const xShift = -10
665+
const yShift = -8
666+
x = Math.round(x + (xShift * this.settings.SYMBOL_SCALE))
667+
y = Math.round(y + (yShift * this.settings.SYMBOL_SCALE))
668+
669+
const wrapper = document.createElementNS(this.context.root.namespaceURI, 'g')
670+
wrapper.setAttribute('transform', 'translate(' + (-x * (this.settings.SYMBOL_SCALE - 2)) + ',' + (-y * (this.settings.SYMBOL_SCALE - 2)) + ')')
671+
672+
const path1 = document.createElementNS(this.context.root.namespaceURI, 'path')
673+
path1.setAttribute('d', 'M15.971322059631348,8.000000953674316A7.971322252863855,7.971322252863855,0,0,1,8,15.97132396697998A7.971322252863855,7.971322252863855,0,0,1,0.028678132221102715,8.000000953674316A7.971322252863855,7.971322252863855,0,0,1,8,0.028677448630332947A7.971322252863855,7.971322252863855,0,0,1,15.971322059631348,8.000000953674316Z')
674+
const path2 = document.createElementNS(this.context.root.namespaceURI, 'path')
675+
path2.setAttribute('d', 'M2.668839454650879,2.043858766555786C6.304587364196777,5.906839370727539,9.94033432006836,9.769822120666504,13.576082229614258,13.632804870605469')
676+
const path3 = document.createElementNS(this.context.root.namespaceURI, 'path')
677+
path3.setAttribute('d', 'm2.5541272163391113,13.747519493103027c3.635746955871582,-3.8629846572875977,7.271494388580322,-7.72596549987793,10.90724229812622,-11.588947772979736')
678+
679+
wrapper.setAttribute('stroke', this.settings.POINTS_COLOR)
680+
wrapper.setAttribute('stroke-width', this.settings.POINTS_STROKE.toString())
681+
wrapper.setAttribute('fill', 'none')
682+
wrapper.appendChild(path1)
683+
wrapper.appendChild(path2)
684+
wrapper.appendChild(path3)
685+
686+
return wrapper
687+
}
650688

651689
/*
652690
* Aries symbol path

0 commit comments

Comments
 (0)