On Wed, Feb 13, 2019 at 5:06 PM Simon Huber <hypnotizedkanga...@gmail.com> wrote:
> >> >> On Wed, Feb 13, 2019 at 3:56 PM Simon Huber <hypnotize...@gmail.com> >> wrote: >> >>> Hi stefano, >>> >>> from within the render method it should be possible to access the parent >>> if I recall correctly, >>> >>> could you post a bit of code to work with? >>> >>> >> Well, it is all very rudimentary still, but the idea is the following: >> In my plugin I import the library and instantiate it, then create the div >> to pass to it. Then I call the constructor of my library's main object with >> the div as its argument: >> '''' >> (function(){ >> /*jslint node: true, browser: true */ >> /*global $tw: false */ >> "use strict"; >> var Widget = require("$:/core/modules/widgets/widget.js").widget; >> >> >> > Stefano, here you should be able to get dimensions of the parent domnode by > > var rect = this.parentDomNode.getBoundingClientRect(); > > for example ... > > var width = rect.width; > > Brilliant! It works like a charm. One day I will understand TW's data model and its relationship to the DOM... But that day is still far away. Thanks a bunch. S. -- __________________________________________________ Stefano Franchi stefano.fran...@gmail.com <stef...@tamu.edu> http://stefano.cleinias.org -- 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 tiddlywikidev+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywikidev@googlegroups.com. 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/CAJODLwYu%3DeE5zRZpW1g9ggBULLSWTuB4E8Mf%2BhtkGnoEL4s%2B-w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.