Closed zefirka closed 7 months ago
I discovered that on init
setSelect
will be triggered based onselect.show
, which leads to triggeringsetSelect
every time chart inits. Why does that happen?
i think the intent was to allow setting the selection at the time of initialization, or maybe to allow default hidden styling. maybe this can be skipped during init if width or height is 0. :thinking:
I try to understand may I rely on
u.select.width === 0
to skip my handler.
yes
Are there any cases when
setSelect
fired but select width is 0 except the first initialization fire?
if you manually call u.setSelect()
with a width of 0 (to hide it), it will call the hook. unless fireHook
arg is false
: https://github.com/leeoniya/uPlot/blob/cf139ff2e0e1eef64694033f86ac003a36b7a5a6/dist/uPlot.d.ts#L105
should be fixed now.
since uPlot doesn't invoke setSelect
hooks for its own auto-hide actions (like during zoom mouseup), it shouldn't run it during init either (unless the initial selection dims are non-zero)
Hi! I have a question about
setSelect
and initialization of plot. I discovered that on initsetSelect
will be triggered based onselect.show
, which leads to triggeringsetSelect
every time chart inits. Why does that happen?I have some handler on
setSelect
. I try to understand may I rely onu.select.width === 0
to skip my handler. Are there any cases whensetSelect
fired but select width is 0 except the first initialization fire?