@Mykle1 Well, “real soon now” turned out to be nearly four years but… the module now displays orbits. They’re displayed by default and drawn with a dark gray line. The line’s color can be modified via the config.
Read the statement by Michael Teeuw here.
Posts
-
RE: MM-orrery - Show the planets and their current relation to the Sun
-
Lesson Learned: Updating HTML canvas module
Hello All -
I wanted to share something I figured out yesterday in the hopes that this info may be useful to a future developer.
My module does all of its rendering onto an HTML canvas. The problem I had was that the module would never update after its initial display. In the start function my module calls setInterval() to have it call updateDom() periodically. I saw my log statements from my module’s getDom() function every update so I presumed all was good. Once my mirror had been running for days on end, however, without me fiddling with it I noticed that my module’s display wasn’t updating. (My module displays the planets’ locations so the display changes very slowly.)
The root cause of the problem was that my module returned the exact same HTML on every invocation of getDom(). Basically,
<div>< canvas>< /canvas></div>
. When MM’s updateDom() fires for a module, it calls the module’s getDom() function. It then compares the HTML that was returned against what was previously displayed and only updates the display if there’s a difference. Since the differences from one update to the next in my module are drawing commands buried inside the canvas object, MM didn’t see that the module had changed so it didn’t update the display.My solution was to add an id attribute to the canvas object with the current time in the id’s value. Now the HTML is different each time getDom() is called so the display updates.
Searching the forum I didn’t see that anyone else had come across this but I may have missed something. If there’s a better way I could have resolved this issue please let me know.
Thanks,
Dave -
RE: MM-orrery - Show the planets and their current relation to the Sun
To anyone using this module, please perform a “git pull” to get the latest code. This will resolve the issue of the module not refreshing its display.
Thanks,
Dave -
RE: MM-orrery - Show the planets and their current relation to the Sun
Thank you, @Mykle1 and @broberg, for your replies. I’m glad you like the module, Mykle1. I’m an amateur astronomer, as well. I’ve got an 8" Celestron on a Dobsonian mount that I like bumping around the the sky when time and weather permit.
broberg, you’re exactly right. You can adjust the color, drawing radius, and scale of each planet via config settings. I’ve updated the documentation in the README file to give some examples.
On a geeky astronomy aside, what was really eye opening to me as I was developing this module was to set jupiterScale to 1.0 and see how the inner planets clump around the Sun. Then to set neptuneScale to 1.0 and see how Jupiter clumps in with the inner planets. Neptune is way, way out there.
As far as showing the orbits, that’s a feature I’m hoping to have “real soon now”. I’ll let you know once I get it added o the module.
Thanks,
DaveP.S. It’s fun to see that Mercury has moved a couple of pixels since I first started developing this module. On the flip side, it’ll be about 80 years before Neptune moves from the lower right to the upper left of the display. :-)
-
MM-orrery - Show the planets and their current relation to the Sun
Hello -
I created an orrery module. The module shows the planets and their current relation to the Sun. (And in the interest of full disclosure I should say that I didn’t know the word orrery before I started on this little adventure. :- )
You can clone the module from here:
[card:hoyski/MM-orrery]
Here’s how it looks on my mirror:
This is my first module, and first foray into JavaScript for that matter, so any and all comments or suggestions on the module itself or the code behind it would be appreciated.
Thanks,
Dave