Browse Source

Functions `select` and `unselect` on Items working

css_transitions
josdejong 11 years ago
parent
commit
b017edcaaa
8 changed files with 15 additions and 58 deletions
  1. +1
    -1
      NOTICE
  2. +1
    -1
      README.md
  3. +1
    -1
      docs/index.html
  4. +8
    -0
      src/timeline/component/css/item.css
  5. +2
    -0
      src/timeline/component/item/Item.js
  6. +0
    -18
      src/timeline/component/item/ItemBox.js
  7. +0
    -18
      src/timeline/component/item/ItemPoint.js
  8. +2
    -19
      src/timeline/component/item/ItemRange.js

+ 1
- 1
NOTICE View File

@ -1,5 +1,5 @@
Vis.js Vis.js
Copyright 2010-2013 Almende B.V.
Copyright 2010-2014 Almende B.V.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

+ 1
- 1
README.md View File

@ -154,7 +154,7 @@ Then run the tests:
## License ## License
Copyright (C) 2010-2013 Almende B.V.
Copyright (C) 2010-2014 Almende B.V.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

+ 1
- 1
docs/index.html View File

@ -179,7 +179,7 @@ var timeline = new vis.Timeline(container, data, options);
<h2 id="license">License</h2> <h2 id="license">License</h2>
<p> <p>
Copyright (C) 2010-2013 Almende B.V.
Copyright (C) 2010-2014 Almende B.V.
</p> </p>
<p> <p>

+ 8
- 0
src/timeline/component/css/item.css View File

@ -13,6 +13,14 @@
z-index: 999; z-index: 999;
} }
.vis.timeline .item.point.selected {
background-color: #FFF785;
z-index: 999;
}
.vis.timeline .item.point.selected .dot {
border-color: #FFC200;
}
.vis.timeline .item.cluster { .vis.timeline .item.cluster {
/* TODO: use another color or pattern? */ /* TODO: use another color or pattern? */
background: #97B0F8 url('img/cluster_bg.png'); background: #97B0F8 url('img/cluster_bg.png');

+ 2
- 0
src/timeline/component/item/Item.js View File

@ -27,6 +27,7 @@ function Item (parent, data, options, defaultOptions) {
*/ */
Item.prototype.select = function select() { Item.prototype.select = function select() {
this.selected = true; this.selected = true;
if (this.visible) this.repaint();
}; };
/** /**
@ -34,6 +35,7 @@ Item.prototype.select = function select() {
*/ */
Item.prototype.unselect = function unselect() { Item.prototype.unselect = function unselect() {
this.selected = false; this.selected = false;
if (this.visible) this.repaint();
}; };
/** /**

+ 0
- 18
src/timeline/component/item/ItemBox.js View File

@ -29,24 +29,6 @@ function ItemBox (parent, data, options, defaultOptions) {
ItemBox.prototype = new Item (null, null); ItemBox.prototype = new Item (null, null);
/**
* Select the item
* @override
*/
ItemBox.prototype.select = function select() {
this.selected = true;
// TODO: select and unselect
};
/**
* Unselect the item
* @override
*/
ItemBox.prototype.unselect = function unselect() {
this.selected = false;
// TODO: select and unselect
};
/** /**
* Repaint the item * Repaint the item
* @return {Boolean} changed * @return {Boolean} changed

+ 0
- 18
src/timeline/component/item/ItemPoint.js View File

@ -26,24 +26,6 @@ function ItemPoint (parent, data, options, defaultOptions) {
ItemPoint.prototype = new Item (null, null); ItemPoint.prototype = new Item (null, null);
/**
* Select the item
* @override
*/
ItemPoint.prototype.select = function select() {
this.selected = true;
// TODO: select and unselect
};
/**
* Unselect the item
* @override
*/
ItemPoint.prototype.unselect = function unselect() {
this.selected = false;
// TODO: select and unselect
};
/** /**
* Repaint the item * Repaint the item
* @return {Boolean} changed * @return {Boolean} changed

+ 2
- 19
src/timeline/component/item/ItemRange.js View File

@ -21,24 +21,6 @@ function ItemRange (parent, data, options, defaultOptions) {
ItemRange.prototype = new Item (null, null); ItemRange.prototype = new Item (null, null);
/**
* Select the item
* @override
*/
ItemRange.prototype.select = function select() {
this.selected = true;
// TODO: select and unselect
};
/**
* Unselect the item
* @override
*/
ItemRange.prototype.unselect = function unselect() {
this.selected = false;
// TODO: select and unselect
};
/** /**
* Repaint the item * Repaint the item
* @return {Boolean} changed * @return {Boolean} changed
@ -86,7 +68,8 @@ ItemRange.prototype.repaint = function repaint() {
} }
// update class // update class
var className = this.data.className ? (' ' + this.data.className) : '';
var className = (this.data.className? ' ' + this.data.className : '') +
(this.selected ? ' selected' : '');
if (this.className != className) { if (this.className != className) {
this.className = className; this.className = className;
dom.box.className = 'item range' + className; dom.box.className = 'item range' + className;

Loading…
Cancel
Save