Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

Interactions with minor labels#625

Closed
y-lohse wants to merge 2 commits intovisjs:masterfrom
CalderaGraphics:master
Closed

Interactions with minor labels#625
y-lohse wants to merge 2 commits intovisjs:masterfrom
CalderaGraphics:master

Conversation

@y-lohse
Copy link

@y-lohse y-lohse commented Feb 10, 2015

Hi, I'm not sure you're interested in this, but since we needed it… :-)

This commit adds touch/click events on minor labels. The use case for this being recentering the view on the clicked label or maybe zooming into it (ie. clicking on "Sun. 23" shows the whole day).

The implementation mirrors the way Item selection is designed so I don't think I went too much astray there; The actual changes are fairly little, so not sure why the dif on the minified files is so large. The event contains a single property called label which is a Date object.

It'd be quick to implement that on major labels too althought I'm not sure if there is a use case.

Oh, and the example is a bit messy right now but it tests support for both orientations & on the fly orientation change.

@josdejong
Copy link
Member

Thanks for your PR @y-lohse . The timeline still lacks support for events like click, double-click, hover, etc. So you can add your own behavior. Clicking a label is one of these customizations.

I haven't yet thought about a clear API for these event listeners. An API like .on('label', ...) may be limiting if we would want to support say double-clicking on a label too. Maybe we could have a generic .on('click', callback), which provides the clicked thing as argument, that could be an item, label, group, or empty space.

@y-lohse
Copy link
Author

y-lohse commented Mar 4, 2015

You're right, this approach is very limited and the one you described seems to be closer to what's going on in the rest of the vis.js. I'll close this PR, the code is still there if someone needs a headstart for the labels at some point :-)

@y-lohse y-lohse closed this Mar 4, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments