Yeah the core Popup object failed at good abstractions. That is unfortunate. There isn't any way to avoid the double storage save because DOMElement.offsetLeft properties are read only so you can change those. The only option would be to copy the logic which IMHO is worse then storing twice. Keeping the two in sync would be a nightmare.
Also I had thought that the core rendering engine would delay reactions to storage changes till next tick allowing changes to finish and the call stack to exhaust. That way multiple changes to a tiddler only trigger a final DOM render. Does the system not do this? Seems that would be a huge performance issue if it attempted to update the DOM at every step of the call stack. On Wednesday, January 13, 2016 at 11:48:14 AM UTC-5, Tobias Beer wrote: > > Hi Devin, > > >> Looking at your code I would push the *hackery* as far away as possible. >> Here is a stab at how I would approach the same problem >> https://gist.github.com/71a1e6b22104ede5f6e7 (Google Groups just had a >> tantrum attempting to copy/paste the code here. Use the link above. >> (╯°□°)╯︵ ┻━┻ ). >> > > Thanks a lot for taking the time and provide this alternative code. > I'm always keen to learn good coding practice. > > I very much agree that it looks much cleaner to > factor all the popup stuff out into its own utils module. > And, I believe I can do the very same with my codebase, as well. > > Other than that, though, your code basically does the same thing: > overwrite the core popup handler. > > However, besides being encapsulated in its own module, > it appears to be less efficient though, since you're not only > calculating all things twice but also writing to the store twice, > once the core handler and then the custom code of EnhancedPopup. > > Best wishes, > > Tobias. > -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/tiddlywikidev. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/f14d8da9-583c-494f-9a20-774ae3523356%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
