Skip to content

Trigger "repositioned" event after position change - #196

Merged
TrevorBurnham merged 2 commits into
masterfrom
repositioned-event
Aug 3, 2016
Merged

Trigger "repositioned" event after position change#196
TrevorBurnham merged 2 commits into
masterfrom
repositioned-event

Conversation

@TrevorBurnham

Copy link
Copy Markdown
Contributor

Fixes #195.

@slorber Try this out locally and see if it works for you, OK?

@slorber

slorber commented Aug 3, 2016

Copy link
Copy Markdown

Hey, thanks it works great for my usecase you can release that :)

I use react-tether and had to hack a bit the library so that it supports something like:

      <TetherComponent
        attachment={this.props.hotspotPosition}
        targetAttachment={this.props.hotspotPosition}
        className={"onboarding-hotspot-tethered " + this.props.name}
        offset={this.props.hotspotOffset}
        constraints={[{
          to: 'scrollParent',
          attachment: 'none'
        }]}
        on={[
          {
            event: "repositioned",
            fn: this.repositionTooltip
          }
        ]}
      >

By the way, I think it would be useful to document that event system because I couldn't find anything in doc about it.

Also, would find it useful to have events for entering/leaving out-of-bound/pinned state as it would permit to avoid querying class names on tether dom node

@TrevorBurnham

Copy link
Copy Markdown
Contributor Author

Also, would find it useful to have events for entering/leaving out-of-bound/pinned state

You should be able to do that by responding to the "update" event, which fires whenever the Tether's attachment is overridden by a constraint.

@TrevorBurnham
TrevorBurnham merged commit 4259a99 into master Aug 3, 2016
@TrevorBurnham
TrevorBurnham deleted the repositioned-event branch August 3, 2016 15:58
@slorber

slorber commented Aug 3, 2016

Copy link
Copy Markdown

Ok thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants