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

Tooltip on item update time #2247

Merged
merged 10 commits into from
Nov 4, 2016
Merged

Conversation

yotamberk
Copy link
Member

see #1506

Copy link
Member

@mojoaxel mojoaxel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!! This is fabulous!
Maybe you can change these small details and then we have a cool new feature!

@@ -90,6 +90,16 @@
padding: 5px;
}

.vis-item .vis-onUpdateTime-tooltip {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add text-align: center and white-space: nowrap, make it autosize and remove the double background:

.vis-item .vis-onUpdateTime-tooltip {
    position: absolute;
    color: white;
    width: auto;
    background: #4f81bd;
    padding: 5px;
    border-radius: 1px;
    text-align: center;
    white-space: nowrap;
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

* @protected
*/
Item.prototype._repaintOnItemUpdateTimeTooltip = function (anchor) {
if (!this.options.tooltipOnItemUpdateTime) return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a semicolon at the end of the line. Without it the code is more error-prone.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

maxHeight: 400,
start: new Date(),
end: new Date(1000*60*60*24 + (new Date()).valueOf()),
tooltipOnItemUpdateTime: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really would like to see the new template option here to show how it works. Can you please add an simple example!?

<td>Show a tooltip on updating an item's time. Note: <code>editable.updateTime</code> must be <code>true</code></td>
</tr>
<tr parent="tooltipOnItemUpdateTime" class="hidden">
<td class="indent">template</td>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There already is a option template. Maybe we should call it tooltipTemplate or hoverTemplate or something like this? I'm not sure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's in the tooltipOnItemUpdateTime so I don't think we need to change the name.


<script>

// create groups
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally would prefer a much more simple example without groups and stuff. Just something like the basicExample.


// specify options
var options = {
orientation: 'top',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only should change options that are necessary to show the new feature.


<script src="../../../dist/vis.js"></script>
<link href="../../../dist/vis.css" rel="stylesheet" type="text/css" />

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be nice to demonstrate also how to overwrite the tooltip style. e.g. with something simple like:

.vis-item .vis-onUpdateTime-tooltip {
    border-radius: 4px;
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea! done

@mojoaxel mojoaxel merged commit 51528ba into visjs:develop Nov 4, 2016
@mojoaxel
Copy link
Member

mojoaxel commented Nov 4, 2016

@yotamberk Thanks! Thats a nice new feature!

@yotamberk yotamberk deleted the tooltip-onchange branch March 4, 2017 19:01
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.

2 participants