Browse Source

Fixed #197: items in groups sometimes being displayed but not positioned correctly.

v3_develop
jos 9 years ago
parent
commit
fb6675a585
6 changed files with 53 additions and 25 deletions
  1. +4
    -0
      HISTORY.md
  2. +23
    -11
      dist/vis.js
  3. +1
    -1
      dist/vis.map
  4. +2
    -2
      dist/vis.min.js
  5. +1
    -0
      lib/timeline/component/Group.js
  6. +22
    -11
      lib/util.js

+ 4
- 0
HISTORY.md View File

@ -4,6 +4,10 @@ http://visjs.org
## not yet released, version 3.0.1-SNAPSHOT
### Timeline
- Fixed items in groups sometimes being displayed but not positioned correctly.
## 2014-07-07, version 3.0.0

+ 23
- 11
dist/vis.js View File

@ -1275,7 +1275,8 @@ return /******/ (function(modules) { // webpackBootstrap
*
* @param {{byStart: Item[], byEnd: Item[]}} orderedItems
* @param {{start: number, end: number}} range
* @param {Boolean} byEnd
* @param {String} field
* @param {String} field2
* @returns {number}
* @private
*/
@ -1286,11 +1287,15 @@ return /******/ (function(modules) { // webpackBootstrap
var found = false;
var low = 0;
var high = array.length;
var newLow = low;
var newHigh = high;
var guess = Math.floor(0.5*(high+low));
var newGuess;
var value;
if (high == 0) {guess = -1;}
if (high == 0) {
guess = -1;
}
else if (high == 1) {
value = field2 === undefined ? array[guess][field] : array[guess][field][field2];
if ((value > range.start - interval) && (value < range.end)) {
@ -1302,26 +1307,28 @@ return /******/ (function(modules) { // webpackBootstrap
}
else {
high -= 1;
while (found == false) {
value = field2 === undefined ? array[guess][field] : array[guess][field][field2];
if ((value > range.start - interval) && (value < range.end)) {
found = true;
}
else {
if (value < range.start - interval) { // it is too small --> increase low
low = Math.floor(0.5*(high+low));
newLow = Math.floor(0.5*(high+low));
}
else { // it is too big --> decrease high
high = Math.floor(0.5*(high+low));
newHigh = Math.floor(0.5*(high+low));
}
newGuess = Math.floor(0.5*(high+low));
// not in list;
if (guess == newGuess) {
if (low == newLow && high == newHigh) {
guess = -1;
found = true;
}
else {
guess = newGuess;
high = newHigh; low = newLow;
guess = Math.floor(0.5*(high+low));
}
}
}
@ -1341,7 +1348,8 @@ return /******/ (function(modules) { // webpackBootstrap
*
* @param {Array} orderedItems
* @param {{start: number, end: number}} target
* @param {Boolean} byEnd
* @param {String} field
* @param {String} sidePreference 'before' or 'after'
* @returns {number}
* @private
*/
@ -1350,6 +1358,8 @@ return /******/ (function(modules) { // webpackBootstrap
var found = false;
var low = 0;
var high = array.length;
var newLow = low;
var newHigh = high;
var guess = Math.floor(0.5*(high+low));
var newGuess;
var prevValue, value, nextValue;
@ -1395,12 +1405,13 @@ return /******/ (function(modules) { // webpackBootstrap
}
newGuess = Math.floor(0.5*(high+low));
// not in list;
if (guess == newGuess) {
guess = -2;
if (low == newLow && high == newHigh) {
guess = -1;
found = true;
}
else {
guess = newGuess;
high = newHigh; low = newLow;
guess = Math.floor(0.5*(high+low));
}
}
}
@ -10228,6 +10239,7 @@ return /******/ (function(modules) { // webpackBootstrap
return false;
}
else {
if (item.displayed) item.hide();
return true;
}
};

+ 1
- 1
dist/vis.map
File diff suppressed because it is too large
View File


+ 2
- 2
dist/vis.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
lib/timeline/component/Group.js View File

@ -393,6 +393,7 @@ Group.prototype._checkIfInvisible = function(item, visibleItems, range) {
return false;
}
else {
if (item.displayed) item.hide();
return true;
}
};

+ 22
- 11
lib/util.js View File

@ -1132,7 +1132,8 @@ exports.mergeOptions = function (mergeTarget, options, option) {
*
* @param {{byStart: Item[], byEnd: Item[]}} orderedItems
* @param {{start: number, end: number}} range
* @param {Boolean} byEnd
* @param {String} field
* @param {String} field2
* @returns {number}
* @private
*/
@ -1143,11 +1144,15 @@ exports.binarySearch = function(orderedItems, range, field, field2) {
var found = false;
var low = 0;
var high = array.length;
var newLow = low;
var newHigh = high;
var guess = Math.floor(0.5*(high+low));
var newGuess;
var value;
if (high == 0) {guess = -1;}
if (high == 0) {
guess = -1;
}
else if (high == 1) {
value = field2 === undefined ? array[guess][field] : array[guess][field][field2];
if ((value > range.start - interval) && (value < range.end)) {
@ -1159,26 +1164,28 @@ exports.binarySearch = function(orderedItems, range, field, field2) {
}
else {
high -= 1;
while (found == false) {
value = field2 === undefined ? array[guess][field] : array[guess][field][field2];
if ((value > range.start - interval) && (value < range.end)) {
found = true;
}
else {
if (value < range.start - interval) { // it is too small --> increase low
low = Math.floor(0.5*(high+low));
newLow = Math.floor(0.5*(high+low));
}
else { // it is too big --> decrease high
high = Math.floor(0.5*(high+low));
newHigh = Math.floor(0.5*(high+low));
}
newGuess = Math.floor(0.5*(high+low));
// not in list;
if (guess == newGuess) {
if (low == newLow && high == newHigh) {
guess = -1;
found = true;
}
else {
guess = newGuess;
high = newHigh; low = newLow;
guess = Math.floor(0.5*(high+low));
}
}
}
@ -1198,7 +1205,8 @@ exports.binarySearch = function(orderedItems, range, field, field2) {
*
* @param {Array} orderedItems
* @param {{start: number, end: number}} target
* @param {Boolean} byEnd
* @param {String} field
* @param {String} sidePreference 'before' or 'after'
* @returns {number}
* @private
*/
@ -1207,6 +1215,8 @@ exports.binarySearchGeneric = function(orderedItems, target, field, sidePreferen
var found = false;
var low = 0;
var high = array.length;
var newLow = low;
var newHigh = high;
var guess = Math.floor(0.5*(high+low));
var newGuess;
var prevValue, value, nextValue;
@ -1252,12 +1262,13 @@ exports.binarySearchGeneric = function(orderedItems, target, field, sidePreferen
}
newGuess = Math.floor(0.5*(high+low));
// not in list;
if (guess == newGuess) {
guess = -2;
if (low == newLow && high == newHigh) {
guess = -1;
found = true;
}
else {
guess = newGuess;
high = newHigh; low = newLow;
guess = Math.floor(0.5*(high+low));
}
}
}

Loading…
Cancel
Save