It appears better to use than onresize since it triggers when the playing area size changes even though the window has not. For example switching between log_mode = normal to 2cols
thanks
Post by Brainchild »
Code: Select all
let topbarCoords = dojo.position("topbar");you can get width with topbarCoords.w
Post by Brainchild »
I know, I'm wondering if this is the best way, and ideally if onScreenWidthChange can include the width value in the callback.
Code: Select all
dojo.position('page-title')Post by Brainchild »
I switched to page-title but I'm unfortunately getting the same width value regardless of whether the player has "game log in second column" enabled. I'm pretty sure it's because that option hasn't been applied yet at the moment I check the width of page-title (in setup()).JumpMaybe wrote: ↑30 June 2020, 09:50 The problem with using the topbar's width is there are 1 or 2 columns of player info + logs on the right (in desktop mode anyway) whose width you would have to subtract.
If you useyou get the actual width of the playing area. I'm using it since last week, so there might still be some trickyness with it I haven't run into.Code: Select all
dojo.position('page-title')
Code: Select all
dojo.position('game_play_area')Post by Brainchild »
I tried that but it doesn't exist yet in setup().
Code: Select all
updateSize: function(){
if($('game_play_area')){
var w = dojo.position('game_play_area')['w'];
...
},
onScreenWidthChange: function(){
this.updateSize();
}