histropediajs 1.6.1 → 1.6.2
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.
- package/dist/histropedia.esm.js +63 -46
- package/dist/histropedia.umd.js +63 -46
- package/dist/histropedia.umd.min.js +2 -2
- package/index.d.ts +3 -0
- package/package.json +3 -3
package/dist/histropedia.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
HistropediaJS v1.6.
|
|
2
|
+
HistropediaJS v1.6.2 | Histropedia Ltd. (c) 2026 | https://js.histropedia.com
|
|
3
3
|
Use of this software is subject to our End User Licence Agreement: https://js.histropedia.com/licence.html
|
|
4
4
|
*/
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -905,6 +905,11 @@ function getDatePrecision(parts) {
|
|
|
905
905
|
}
|
|
906
906
|
__name(getDatePrecision, "getDatePrecision");
|
|
907
907
|
function getHistoricalPeriodBounds(year, size) {
|
|
908
|
+
if (year <= 0) {
|
|
909
|
+
const historicalYear = 1 - year;
|
|
910
|
+
const oldestYear = Math.ceil(historicalYear / size) * size;
|
|
911
|
+
return { startYear: 1 - oldestYear, endYear: size - oldestYear };
|
|
912
|
+
}
|
|
908
913
|
const endYear = Math.ceil(year / size) * size;
|
|
909
914
|
return {
|
|
910
915
|
startYear: endYear - size + 1,
|
|
@@ -912,6 +917,15 @@ function getHistoricalPeriodBounds(year, size) {
|
|
|
912
917
|
};
|
|
913
918
|
}
|
|
914
919
|
__name(getHistoricalPeriodBounds, "getHistoricalPeriodBounds");
|
|
920
|
+
function getDecadeBounds(year) {
|
|
921
|
+
if (year <= 0) {
|
|
922
|
+
const decade = Math.floor((1 - year) / 10) * 10;
|
|
923
|
+
return { startYear: 1 - (decade + 9), endYear: 1 - Math.max(1, decade) };
|
|
924
|
+
}
|
|
925
|
+
const startYear = Math.floor(year / 10) * 10;
|
|
926
|
+
return { startYear: Math.max(1, startYear), endYear: startYear + 9 };
|
|
927
|
+
}
|
|
928
|
+
__name(getDecadeBounds, "getDecadeBounds");
|
|
915
929
|
function clampInteger(value, fallback, minimum, maximum) {
|
|
916
930
|
const parsed = Number(value);
|
|
917
931
|
if (!Number.isFinite(parsed)) {
|
|
@@ -1277,11 +1291,19 @@ Dmy.CreateAsStartOfPeriod = function(isoDmy, precision) {
|
|
|
1277
1291
|
if (precision === "month") {
|
|
1278
1292
|
return new Dmy(isoYear, month, 1);
|
|
1279
1293
|
}
|
|
1280
|
-
if (precision === "year"
|
|
1294
|
+
if (precision === "year") {
|
|
1281
1295
|
return new Dmy(isoYear, 1, 1);
|
|
1282
1296
|
}
|
|
1297
|
+
if (precision === "million-years" || precision === "billion-years") {
|
|
1298
|
+
const size = precision === "million-years" ? 1e6 : 1e9;
|
|
1299
|
+
return new Dmy(
|
|
1300
|
+
isoYear <= 0 ? getHistoricalPeriodBounds(isoYear, size).startYear : isoYear,
|
|
1301
|
+
1,
|
|
1302
|
+
1
|
|
1303
|
+
);
|
|
1304
|
+
}
|
|
1283
1305
|
if (precision === "decade") {
|
|
1284
|
-
return new Dmy(
|
|
1306
|
+
return new Dmy(getDecadeBounds(isoYear).startYear, 1, 1);
|
|
1285
1307
|
}
|
|
1286
1308
|
if (precision === "century") {
|
|
1287
1309
|
return new Dmy(getHistoricalPeriodBounds(isoYear, 100).startYear, 1, 1);
|
|
@@ -1318,7 +1340,7 @@ Dmy.CreateAsEndOfPeriod = function(isoDmy, precision) {
|
|
|
1318
1340
|
return new Dmy(isoYear, 12, 31);
|
|
1319
1341
|
}
|
|
1320
1342
|
if (precision === "decade") {
|
|
1321
|
-
return new Dmy(
|
|
1343
|
+
return new Dmy(getDecadeBounds(isoYear).endYear, 12, 31);
|
|
1322
1344
|
}
|
|
1323
1345
|
if (precision === "century") {
|
|
1324
1346
|
return new Dmy(getHistoricalPeriodBounds(isoYear, 100).endYear, 12, 31);
|
|
@@ -1326,11 +1348,13 @@ Dmy.CreateAsEndOfPeriod = function(isoDmy, precision) {
|
|
|
1326
1348
|
if (precision === "millennium") {
|
|
1327
1349
|
return new Dmy(getHistoricalPeriodBounds(isoYear, 1e3).endYear, 12, 31);
|
|
1328
1350
|
}
|
|
1329
|
-
if (precision === "million-years") {
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1351
|
+
if (precision === "million-years" || precision === "billion-years") {
|
|
1352
|
+
const size = precision === "million-years" ? 1e6 : 1e9;
|
|
1353
|
+
return new Dmy(
|
|
1354
|
+
isoYear <= 0 ? getHistoricalPeriodBounds(isoYear, size).endYear : isoYear + size - 1,
|
|
1355
|
+
12,
|
|
1356
|
+
31
|
|
1357
|
+
);
|
|
1334
1358
|
}
|
|
1335
1359
|
Logger.error("precision is not implemented");
|
|
1336
1360
|
return new Dmy(isoYear, month, day);
|
|
@@ -5850,14 +5874,8 @@ function getParentIntervalStart(value, unit) {
|
|
|
5850
5874
|
return new Dmy(value.year, value.month, 1);
|
|
5851
5875
|
case ZOOM_YEAR:
|
|
5852
5876
|
return new Dmy(value.year, 1, 1);
|
|
5853
|
-
case ZOOM_DECADE:
|
|
5854
|
-
|
|
5855
|
-
return new Dmy(Math.floor(value.year / 10) * 10, 1, 1);
|
|
5856
|
-
}
|
|
5857
|
-
const displayedYear = 1 - value.year;
|
|
5858
|
-
const displayedDecade = Math.floor(displayedYear / 10) * 10;
|
|
5859
|
-
return new Dmy(1 - (displayedDecade + 9), 1, 1);
|
|
5860
|
-
}
|
|
5877
|
+
case ZOOM_DECADE:
|
|
5878
|
+
return Dmy.CreateAsStartOfPeriod(value, "decade");
|
|
5861
5879
|
case ZOOM_CENTURY:
|
|
5862
5880
|
return Dmy.CreateAsStartOfPeriod(value, "century");
|
|
5863
5881
|
case ZOOM_MILLENNIUM:
|
|
@@ -5882,7 +5900,7 @@ function getNextParentInterval(start, unit) {
|
|
|
5882
5900
|
case ZOOM_YEAR:
|
|
5883
5901
|
return start.addYears(1);
|
|
5884
5902
|
case ZOOM_DECADE:
|
|
5885
|
-
return
|
|
5903
|
+
return Dmy.CreateAsExclusiveEndOfPeriod(start, "decade");
|
|
5886
5904
|
case ZOOM_CENTURY:
|
|
5887
5905
|
return Dmy.CreateAsExclusiveEndOfPeriod(start, "century");
|
|
5888
5906
|
case ZOOM_MILLENNIUM:
|
|
@@ -6019,6 +6037,9 @@ TimescaleManager.prototype.formatParentContextLabel = function(value, unit) {
|
|
|
6019
6037
|
case ZOOM_DECADE: {
|
|
6020
6038
|
const displayedYear = value.year <= 0 ? 1 - value.year : value.year;
|
|
6021
6039
|
const decade = Math.floor(displayedYear / 10) * 10;
|
|
6040
|
+
if (decade === 0) {
|
|
6041
|
+
return value.year <= 0 ? `9–1${options.bceText}` : "1–9";
|
|
6042
|
+
}
|
|
6022
6043
|
const formattedDecade = new Dmy(decade, 1, 1).format("YYYY", {
|
|
6023
6044
|
thousandsSeparator: options.thousandsSeparator,
|
|
6024
6045
|
bceText: ""
|
|
@@ -8129,15 +8150,6 @@ function getFitZoomForInternalDates(timeline, internalStart, internalEnd, paddin
|
|
|
8129
8150
|
return normaliseZoomForManager(manager, targetZoom);
|
|
8130
8151
|
}
|
|
8131
8152
|
__name(getFitZoomForInternalDates, "getFitZoomForInternalDates");
|
|
8132
|
-
function getFitZoom(timeline, startDate, endDate, padding) {
|
|
8133
|
-
return getFitZoomForInternalDates(
|
|
8134
|
-
timeline,
|
|
8135
|
-
timeline.getDmyFromInput(normaliseDateInput(startDate)),
|
|
8136
|
-
timeline.getDmyFromInput(normaliseDateInput(endDate)),
|
|
8137
|
-
padding
|
|
8138
|
-
);
|
|
8139
|
-
}
|
|
8140
|
-
__name(getFitZoom, "getFitZoom");
|
|
8141
8153
|
function normaliseBoundDate(timeline, date) {
|
|
8142
8154
|
if (date == null) {
|
|
8143
8155
|
return null;
|
|
@@ -8482,10 +8494,8 @@ function animateDateRangeFit(timeline, targetStartDate, targetEndDate, targetZoo
|
|
|
8482
8494
|
const fitPixelSpan = getFitPixelSpan(timeline, padding);
|
|
8483
8495
|
const startPointAtPadding = getDayPointAtPixel(timeline, padding.left);
|
|
8484
8496
|
const startEndPointAtPadding = getDayPointAtPixel(timeline, padding.left + fitPixelSpan);
|
|
8485
|
-
const
|
|
8486
|
-
const
|
|
8487
|
-
const targetPoint = getDayPoint(targetInternalStart);
|
|
8488
|
-
const targetEndPoint = getDayPoint(targetInternalEnd);
|
|
8497
|
+
const targetPoint = getDayPoint(targetStartDate);
|
|
8498
|
+
const targetEndPoint = getDayPoint(targetEndDate);
|
|
8489
8499
|
const canInterpolateBoundaries = compareDayPoints(startEndPointAtPadding, startPointAtPadding) > 0 && compareDayPoints(targetEndPoint, targetPoint) > 0;
|
|
8490
8500
|
const rangeTween = tween({
|
|
8491
8501
|
from: 0,
|
|
@@ -8518,7 +8528,7 @@ function animateDateRangeFit(timeline, targetStartDate, targetEndDate, targetZoo
|
|
|
8518
8528
|
if (targetZoom !== timeline.timescaleManager.zoom) {
|
|
8519
8529
|
timeline.timescaleManager.setZoom(targetZoom);
|
|
8520
8530
|
}
|
|
8521
|
-
setInternalStartDate(timeline,
|
|
8531
|
+
setInternalStartDate(timeline, targetStartDate, padding.left, true);
|
|
8522
8532
|
timeline.isPanning = false;
|
|
8523
8533
|
}
|
|
8524
8534
|
});
|
|
@@ -12425,24 +12435,31 @@ Timeline.prototype.getZoom = function() {
|
|
|
12425
12435
|
Timeline.prototype.setCentreDate = function(dmy, pixelOffset) {
|
|
12426
12436
|
this.setStartDate(dmy, { padding: this.getWidth() / 2 + (pixelOffset || 0) });
|
|
12427
12437
|
};
|
|
12428
|
-
|
|
12438
|
+
function fitInternalDateRange(timeline, startDate, endDate, options = {}) {
|
|
12429
12439
|
const padding = normalisePadding(options.padding);
|
|
12440
|
+
const targetZoom = getFitZoomForInternalDates(timeline, startDate, endDate, padding);
|
|
12441
|
+
if (options.animation?.active) {
|
|
12442
|
+
animateDateRangeFit(timeline, startDate, endDate, targetZoom, padding, options.animation);
|
|
12443
|
+
return;
|
|
12444
|
+
}
|
|
12445
|
+
if (targetZoom !== timeline.timescaleManager.zoom) {
|
|
12446
|
+
timeline.setZoom(targetZoom);
|
|
12447
|
+
}
|
|
12448
|
+
setInternalStartDate(timeline, startDate, padding.left, true);
|
|
12449
|
+
}
|
|
12450
|
+
__name(fitInternalDateRange, "fitInternalDateRange");
|
|
12451
|
+
Timeline.prototype.fitDateRange = /* @__PURE__ */ __name(function fitDateRange(start, end, options = {}) {
|
|
12430
12452
|
let startRange = normaliseDateRangeInput(start);
|
|
12431
12453
|
let endRange = normaliseDateRangeInput(end);
|
|
12432
12454
|
if (startRange.start.compare(endRange.start) > 0) {
|
|
12433
12455
|
[startRange, endRange] = [endRange, startRange];
|
|
12434
12456
|
}
|
|
12435
|
-
|
|
12436
|
-
|
|
12437
|
-
|
|
12438
|
-
|
|
12439
|
-
|
|
12440
|
-
|
|
12441
|
-
}
|
|
12442
|
-
if (targetZoom !== this.timescaleManager.zoom) {
|
|
12443
|
-
this.setZoom(targetZoom);
|
|
12444
|
-
}
|
|
12445
|
-
this.setStartDate(startDate, { padding: padding.left });
|
|
12457
|
+
fitInternalDateRange(
|
|
12458
|
+
this,
|
|
12459
|
+
this.getDmyFromInput(startRange.start),
|
|
12460
|
+
this.getDmyFromInput(endRange.end),
|
|
12461
|
+
options
|
|
12462
|
+
);
|
|
12446
12463
|
}, "fitDateRange");
|
|
12447
12464
|
Timeline.prototype.settleDateBounds = /* @__PURE__ */ __name(function settleDateBounds(options = {}) {
|
|
12448
12465
|
let correction = getDateBoundCorrection(this);
|
|
@@ -12499,7 +12516,7 @@ Timeline.prototype.fitArticleRange = /* @__PURE__ */ __name(function fitArticleR
|
|
|
12499
12516
|
if (!article?.period?.from || !article.period.to) {
|
|
12500
12517
|
return false;
|
|
12501
12518
|
}
|
|
12502
|
-
this
|
|
12519
|
+
fitInternalDateRange(this, article.period.from, article.period.to, {
|
|
12503
12520
|
padding: options.padding,
|
|
12504
12521
|
animation: options.animation
|
|
12505
12522
|
});
|
|
@@ -12518,7 +12535,7 @@ Timeline.prototype.fitArticles = /* @__PURE__ */ __name(function fitArticles(opt
|
|
|
12518
12535
|
left: requestedPadding.left + articleRange.maxCardLeftOffset,
|
|
12519
12536
|
right: requestedPadding.right + articleRange.maxCardRightOffset
|
|
12520
12537
|
};
|
|
12521
|
-
this
|
|
12538
|
+
fitInternalDateRange(this, articleRange.earliest, articleRange.latest, {
|
|
12522
12539
|
padding: fitPadding,
|
|
12523
12540
|
animation: options.animation
|
|
12524
12541
|
});
|
package/dist/histropedia.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
HistropediaJS v1.6.
|
|
2
|
+
HistropediaJS v1.6.2 | Histropedia Ltd. (c) 2026 | https://js.histropedia.com
|
|
3
3
|
Use of this software is subject to our End User Licence Agreement: https://js.histropedia.com/licence.html
|
|
4
4
|
*/
|
|
5
5
|
(function(global, factory) {
|
|
@@ -927,6 +927,11 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
927
927
|
}
|
|
928
928
|
__name(getDatePrecision, "getDatePrecision");
|
|
929
929
|
function getHistoricalPeriodBounds(year, size) {
|
|
930
|
+
if (year <= 0) {
|
|
931
|
+
const historicalYear = 1 - year;
|
|
932
|
+
const oldestYear = Math.ceil(historicalYear / size) * size;
|
|
933
|
+
return { startYear: 1 - oldestYear, endYear: size - oldestYear };
|
|
934
|
+
}
|
|
930
935
|
const endYear = Math.ceil(year / size) * size;
|
|
931
936
|
return {
|
|
932
937
|
startYear: endYear - size + 1,
|
|
@@ -934,6 +939,15 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
934
939
|
};
|
|
935
940
|
}
|
|
936
941
|
__name(getHistoricalPeriodBounds, "getHistoricalPeriodBounds");
|
|
942
|
+
function getDecadeBounds(year) {
|
|
943
|
+
if (year <= 0) {
|
|
944
|
+
const decade = Math.floor((1 - year) / 10) * 10;
|
|
945
|
+
return { startYear: 1 - (decade + 9), endYear: 1 - Math.max(1, decade) };
|
|
946
|
+
}
|
|
947
|
+
const startYear = Math.floor(year / 10) * 10;
|
|
948
|
+
return { startYear: Math.max(1, startYear), endYear: startYear + 9 };
|
|
949
|
+
}
|
|
950
|
+
__name(getDecadeBounds, "getDecadeBounds");
|
|
937
951
|
function clampInteger(value, fallback, minimum, maximum) {
|
|
938
952
|
const parsed = Number(value);
|
|
939
953
|
if (!Number.isFinite(parsed)) {
|
|
@@ -1299,11 +1313,19 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
1299
1313
|
if (precision === "month") {
|
|
1300
1314
|
return new Dmy(isoYear, month, 1);
|
|
1301
1315
|
}
|
|
1302
|
-
if (precision === "year"
|
|
1316
|
+
if (precision === "year") {
|
|
1303
1317
|
return new Dmy(isoYear, 1, 1);
|
|
1304
1318
|
}
|
|
1319
|
+
if (precision === "million-years" || precision === "billion-years") {
|
|
1320
|
+
const size = precision === "million-years" ? 1e6 : 1e9;
|
|
1321
|
+
return new Dmy(
|
|
1322
|
+
isoYear <= 0 ? getHistoricalPeriodBounds(isoYear, size).startYear : isoYear,
|
|
1323
|
+
1,
|
|
1324
|
+
1
|
|
1325
|
+
);
|
|
1326
|
+
}
|
|
1305
1327
|
if (precision === "decade") {
|
|
1306
|
-
return new Dmy(
|
|
1328
|
+
return new Dmy(getDecadeBounds(isoYear).startYear, 1, 1);
|
|
1307
1329
|
}
|
|
1308
1330
|
if (precision === "century") {
|
|
1309
1331
|
return new Dmy(getHistoricalPeriodBounds(isoYear, 100).startYear, 1, 1);
|
|
@@ -1340,7 +1362,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
1340
1362
|
return new Dmy(isoYear, 12, 31);
|
|
1341
1363
|
}
|
|
1342
1364
|
if (precision === "decade") {
|
|
1343
|
-
return new Dmy(
|
|
1365
|
+
return new Dmy(getDecadeBounds(isoYear).endYear, 12, 31);
|
|
1344
1366
|
}
|
|
1345
1367
|
if (precision === "century") {
|
|
1346
1368
|
return new Dmy(getHistoricalPeriodBounds(isoYear, 100).endYear, 12, 31);
|
|
@@ -1348,11 +1370,13 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
1348
1370
|
if (precision === "millennium") {
|
|
1349
1371
|
return new Dmy(getHistoricalPeriodBounds(isoYear, 1e3).endYear, 12, 31);
|
|
1350
1372
|
}
|
|
1351
|
-
if (precision === "million-years") {
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1373
|
+
if (precision === "million-years" || precision === "billion-years") {
|
|
1374
|
+
const size = precision === "million-years" ? 1e6 : 1e9;
|
|
1375
|
+
return new Dmy(
|
|
1376
|
+
isoYear <= 0 ? getHistoricalPeriodBounds(isoYear, size).endYear : isoYear + size - 1,
|
|
1377
|
+
12,
|
|
1378
|
+
31
|
|
1379
|
+
);
|
|
1356
1380
|
}
|
|
1357
1381
|
Logger.error("precision is not implemented");
|
|
1358
1382
|
return new Dmy(isoYear, month, day);
|
|
@@ -5893,14 +5917,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
5893
5917
|
return new Dmy(value.year, value.month, 1);
|
|
5894
5918
|
case ZOOM_YEAR:
|
|
5895
5919
|
return new Dmy(value.year, 1, 1);
|
|
5896
|
-
case ZOOM_DECADE:
|
|
5897
|
-
|
|
5898
|
-
return new Dmy(Math.floor(value.year / 10) * 10, 1, 1);
|
|
5899
|
-
}
|
|
5900
|
-
const displayedYear = 1 - value.year;
|
|
5901
|
-
const displayedDecade = Math.floor(displayedYear / 10) * 10;
|
|
5902
|
-
return new Dmy(1 - (displayedDecade + 9), 1, 1);
|
|
5903
|
-
}
|
|
5920
|
+
case ZOOM_DECADE:
|
|
5921
|
+
return Dmy.CreateAsStartOfPeriod(value, "decade");
|
|
5904
5922
|
case ZOOM_CENTURY:
|
|
5905
5923
|
return Dmy.CreateAsStartOfPeriod(value, "century");
|
|
5906
5924
|
case ZOOM_MILLENNIUM:
|
|
@@ -5925,7 +5943,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
5925
5943
|
case ZOOM_YEAR:
|
|
5926
5944
|
return start.addYears(1);
|
|
5927
5945
|
case ZOOM_DECADE:
|
|
5928
|
-
return
|
|
5946
|
+
return Dmy.CreateAsExclusiveEndOfPeriod(start, "decade");
|
|
5929
5947
|
case ZOOM_CENTURY:
|
|
5930
5948
|
return Dmy.CreateAsExclusiveEndOfPeriod(start, "century");
|
|
5931
5949
|
case ZOOM_MILLENNIUM:
|
|
@@ -6064,6 +6082,9 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6064
6082
|
case ZOOM_DECADE: {
|
|
6065
6083
|
const displayedYear = value.year <= 0 ? 1 - value.year : value.year;
|
|
6066
6084
|
const decade = Math.floor(displayedYear / 10) * 10;
|
|
6085
|
+
if (decade === 0) {
|
|
6086
|
+
return value.year <= 0 ? `9–1${options.bceText}` : "1–9";
|
|
6087
|
+
}
|
|
6067
6088
|
const formattedDecade = new Dmy(decade, 1, 1).format("YYYY", {
|
|
6068
6089
|
thousandsSeparator: options.thousandsSeparator,
|
|
6069
6090
|
bceText: ""
|
|
@@ -8181,15 +8202,6 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
8181
8202
|
return normaliseZoomForManager(manager, targetZoom);
|
|
8182
8203
|
}
|
|
8183
8204
|
__name(getFitZoomForInternalDates, "getFitZoomForInternalDates");
|
|
8184
|
-
function getFitZoom(timeline, startDate, endDate, padding) {
|
|
8185
|
-
return getFitZoomForInternalDates(
|
|
8186
|
-
timeline,
|
|
8187
|
-
timeline.getDmyFromInput(normaliseDateInput(startDate)),
|
|
8188
|
-
timeline.getDmyFromInput(normaliseDateInput(endDate)),
|
|
8189
|
-
padding
|
|
8190
|
-
);
|
|
8191
|
-
}
|
|
8192
|
-
__name(getFitZoom, "getFitZoom");
|
|
8193
8205
|
function normaliseBoundDate(timeline, date) {
|
|
8194
8206
|
if (date == null) {
|
|
8195
8207
|
return null;
|
|
@@ -8539,10 +8551,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
8539
8551
|
const fitPixelSpan = getFitPixelSpan(timeline, padding);
|
|
8540
8552
|
const startPointAtPadding = getDayPointAtPixel(timeline, padding.left);
|
|
8541
8553
|
const startEndPointAtPadding = getDayPointAtPixel(timeline, padding.left + fitPixelSpan);
|
|
8542
|
-
const
|
|
8543
|
-
const
|
|
8544
|
-
const targetPoint = getDayPoint(targetInternalStart);
|
|
8545
|
-
const targetEndPoint = getDayPoint(targetInternalEnd);
|
|
8554
|
+
const targetPoint = getDayPoint(targetStartDate);
|
|
8555
|
+
const targetEndPoint = getDayPoint(targetEndDate);
|
|
8546
8556
|
const canInterpolateBoundaries = compareDayPoints(startEndPointAtPadding, startPointAtPadding) > 0 && compareDayPoints(targetEndPoint, targetPoint) > 0;
|
|
8547
8557
|
const rangeTween = tween({
|
|
8548
8558
|
from: 0,
|
|
@@ -8575,7 +8585,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
8575
8585
|
if (targetZoom !== timeline.timescaleManager.zoom) {
|
|
8576
8586
|
timeline.timescaleManager.setZoom(targetZoom);
|
|
8577
8587
|
}
|
|
8578
|
-
setInternalStartDate(timeline,
|
|
8588
|
+
setInternalStartDate(timeline, targetStartDate, padding.left, true);
|
|
8579
8589
|
timeline.isPanning = false;
|
|
8580
8590
|
}
|
|
8581
8591
|
});
|
|
@@ -12523,25 +12533,32 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
12523
12533
|
Timeline.prototype.setCentreDate = function(dmy, pixelOffset) {
|
|
12524
12534
|
this.setStartDate(dmy, { padding: this.getWidth() / 2 + (pixelOffset || 0) });
|
|
12525
12535
|
};
|
|
12526
|
-
|
|
12536
|
+
function fitInternalDateRange(timeline, startDate, endDate, options = {}) {
|
|
12527
12537
|
var _a;
|
|
12528
12538
|
const padding = normalisePadding(options.padding);
|
|
12539
|
+
const targetZoom = getFitZoomForInternalDates(timeline, startDate, endDate, padding);
|
|
12540
|
+
if ((_a = options.animation) == null ? void 0 : _a.active) {
|
|
12541
|
+
animateDateRangeFit(timeline, startDate, endDate, targetZoom, padding, options.animation);
|
|
12542
|
+
return;
|
|
12543
|
+
}
|
|
12544
|
+
if (targetZoom !== timeline.timescaleManager.zoom) {
|
|
12545
|
+
timeline.setZoom(targetZoom);
|
|
12546
|
+
}
|
|
12547
|
+
setInternalStartDate(timeline, startDate, padding.left, true);
|
|
12548
|
+
}
|
|
12549
|
+
__name(fitInternalDateRange, "fitInternalDateRange");
|
|
12550
|
+
Timeline.prototype.fitDateRange = /* @__PURE__ */ __name(function fitDateRange(start, end, options = {}) {
|
|
12529
12551
|
let startRange = normaliseDateRangeInput(start);
|
|
12530
12552
|
let endRange = normaliseDateRangeInput(end);
|
|
12531
12553
|
if (startRange.start.compare(endRange.start) > 0) {
|
|
12532
12554
|
[startRange, endRange] = [endRange, startRange];
|
|
12533
12555
|
}
|
|
12534
|
-
|
|
12535
|
-
|
|
12536
|
-
|
|
12537
|
-
|
|
12538
|
-
|
|
12539
|
-
|
|
12540
|
-
}
|
|
12541
|
-
if (targetZoom !== this.timescaleManager.zoom) {
|
|
12542
|
-
this.setZoom(targetZoom);
|
|
12543
|
-
}
|
|
12544
|
-
this.setStartDate(startDate, { padding: padding.left });
|
|
12556
|
+
fitInternalDateRange(
|
|
12557
|
+
this,
|
|
12558
|
+
this.getDmyFromInput(startRange.start),
|
|
12559
|
+
this.getDmyFromInput(endRange.end),
|
|
12560
|
+
options
|
|
12561
|
+
);
|
|
12545
12562
|
}, "fitDateRange");
|
|
12546
12563
|
Timeline.prototype.settleDateBounds = /* @__PURE__ */ __name(function settleDateBounds(options = {}) {
|
|
12547
12564
|
var _a;
|
|
@@ -12600,7 +12617,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
12600
12617
|
if (!((_a = article == null ? void 0 : article.period) == null ? void 0 : _a.from) || !article.period.to) {
|
|
12601
12618
|
return false;
|
|
12602
12619
|
}
|
|
12603
|
-
this
|
|
12620
|
+
fitInternalDateRange(this, article.period.from, article.period.to, {
|
|
12604
12621
|
padding: options.padding,
|
|
12605
12622
|
animation: options.animation
|
|
12606
12623
|
});
|
|
@@ -12620,7 +12637,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
12620
12637
|
left: requestedPadding.left + articleRange.maxCardLeftOffset,
|
|
12621
12638
|
right: requestedPadding.right + articleRange.maxCardRightOffset
|
|
12622
12639
|
};
|
|
12623
|
-
this
|
|
12640
|
+
fitInternalDateRange(this, articleRange.earliest, articleRange.latest, {
|
|
12624
12641
|
padding: fitPadding,
|
|
12625
12642
|
animation: options.animation
|
|
12626
12643
|
});
|