@twab/visualization 1.6.1 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1181,12 +1181,13 @@ FramesManager.prototype.goTo = async function (time) {
1181
1181
  this.cancelAllPendingRequests();
1182
1182
 
1183
1183
  this.currentTime = time || this.currentTime;
1184
- const frameIndex = this.findFrameIndexByTime(this.currentTime);
1184
+ const frameIndex = this.findFrameIndexByTime();
1185
1185
 
1186
1186
  if (frameIndex >= 0) {
1187
1187
  this.currentPosition = frameIndex;
1188
1188
  } else {
1189
1189
  this.buffer = [];
1190
+ this.currentPosition = 0;
1190
1191
  await this.getSmallBlock(this.currentTime, this.channel, 1);
1191
1192
  }
1192
1193
  };
@@ -1253,7 +1254,7 @@ FramesManager.prototype.getSmallBlock = async function (
1253
1254
  }
1254
1255
 
1255
1256
  this.orderFramesBlock(images);
1256
- this.currentPosition = this.findFrameIndexByTime(this.currentTime);
1257
+ this.currentPosition = this.findFrameIndexByTime();
1257
1258
 
1258
1259
  delete this.requests[`block_${ENUM.Direction.Next}_${response.end}`];
1259
1260
  delete this.requests[requestId];
@@ -1313,7 +1314,7 @@ FramesManager.prototype.getBlock = async function (
1313
1314
 
1314
1315
  this.orderFramesBlock(response.data.frames, direction === 'Previous');
1315
1316
 
1316
- this.currentPosition = this.findFrameIndexByTime(this.currentTime);
1317
+ this.currentPosition = this.findFrameIndexByTime();
1317
1318
 
1318
1319
  if (checkMinBlock) {
1319
1320
  await this.checkMinBlockSize(!substituition);
@@ -1385,7 +1386,7 @@ FramesManager.prototype.orderFramesBlock = function (
1385
1386
 
1386
1387
  if (this.buffer.length > 0) {
1387
1388
  const uniqueTimes = new Set();
1388
- const result = [];
1389
+ let result = [];
1389
1390
 
1390
1391
  for (const item of this.buffer) {
1391
1392
  if (!uniqueTimes.has(item.time)) {
@@ -1403,23 +1404,19 @@ FramesManager.prototype.orderFramesBlock = function (
1403
1404
 
1404
1405
  result.sort((a, b) => a.time - b.time);
1405
1406
 
1406
- const sliceLimit =
1407
- ENUM.MinBlockSizesBack[this.currentStep] +
1408
- ENUM.MinBlockSizes[this.currentStep] +
1409
- 900;
1407
+ //! Verificar um novo método para remover frames desnecessários (está a dar raia no goto)
1408
+ // if (!backwards && !this.checkFramesBackward()) {
1409
+ // result = result.slice(images.length)
1410
+ // }
1410
1411
 
1411
- if (backwards) {
1412
- this.buffer = result.slice(0, sliceLimit);
1413
- } else {
1414
- this.buffer = result.slice(-sliceLimit);
1415
- }
1412
+ this.buffer = result;
1416
1413
  } else {
1417
1414
  this.buffer = images;
1418
1415
  }
1419
1416
  };
1420
1417
 
1421
- FramesManager.prototype.findFrameIndexByTime = function (time) {
1422
- return this.buffer.findIndex((frame) => frame.time === time)
1418
+ FramesManager.prototype.findFrameIndexByTime = function () {
1419
+ return this.buffer.findIndex((frame) => frame.time === this.currentTime)
1423
1420
  };
1424
1421
 
1425
1422
  FramesManager.prototype.cancelAllPendingRequests = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twab/visualization",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "main": "dist/visualization.js",
5
5
  "files": [
6
6
  "dist"