|
21 | 21 | import { getMapContext } from '~/mapModules/MapModule'; |
22 | 22 | import type { AscentSegment, IItem as Item } from '~/models/Item'; |
23 | 23 | import { showError } from '@shared/utils/showError'; |
24 | | - import { colors, fonts } from '~/variables'; |
| 24 | + import { colors, fontScale, fonts } from '~/variables'; |
25 | 25 | import { SDK_VERSION } from '@akylas/nativescript/utils'; |
26 | 26 | let { colorOnPrimary, colorOnSurface, colorOutline, colorOutlineVariant, colorPrimary } = $colors; |
27 | 27 | $: ({ colorOnPrimary, colorOnSurface, colorOutline, colorOutlineVariant, colorPrimary } = $colors); |
|
384 | 384 | chartView.resetZoom(); |
385 | 385 | } |
386 | 386 | const deltaA = profile.max[1] - profile.min[1]; |
387 | | - const spaceMin = 50; |
| 387 | + const spaceMin = 100; |
388 | 388 | let spaceMax = 0; |
389 | 389 | const chartElevationMinRange = ApplicationSettings.getNumber('chart_elevation_min_range', 250); |
390 | 390 | if (deltaA < chartElevationMinRange) { |
|
398 | 398 | leftAxis.labelCount = labelCount; |
399 | 399 | leftAxis.spaceMin = spaceMin; |
400 | 400 | leftAxis.spaceMax = spaceMax; |
401 | | - leftAxis.textSize = 9; |
| 401 | + leftAxis.textSize = 9 * $fontScale; |
402 | 402 |
|
403 | 403 | const totalDistance = it.route.totalDistance; |
404 | 404 | const xLabelCount = 6; |
405 | 405 | xinterval = closestUpper(xintervals, totalDistance / xLabelCount / 1000) * 1000; |
406 | 406 | xAxis.forcedInterval = xinterval; |
407 | 407 | xAxis.labelCount = xLabelCount; |
408 | | - xAxis.textSize = 9; |
| 408 | + xAxis.textSize = 9 * $fontScale; |
409 | 409 | xAxis.clipLimitLinesToContent = false; |
410 | 410 | const chartData = chartView.data; |
411 | 411 | let set: LineDataSet; |
|
460 | 460 | limitLine.enableDashedLine(4, 3, 0); |
461 | 461 | limitLine.lineWidth = 0.5; |
462 | 462 | limitLine.yOffset = -1; |
463 | | - limitLine.textSize = 9; |
| 463 | + limitLine.textSize = 9 * $fontScale; |
464 | 464 | limitLine.textColor = colorOnSurface; |
465 | 465 | // limitLine.ensureVisible = true; |
466 | 466 | limitLine.labelPosition = LimitLabelPosition.RIGHT_BOTTOM; |
|
471 | 471 | limitLine.enableDashedLine(4, 3, 0); |
472 | 472 | limitLine.lineWidth = 0.5; |
473 | 473 | limitLine.yOffset = 1; |
474 | | - limitLine.textSize = 9; |
| 474 | + limitLine.textSize = 9 * $fontScale; |
475 | 475 | limitLine.textColor = colorOnSurface; |
476 | 476 | limitLine.ensureVisible = true; |
477 | 477 | leftAxis.addLimitLine(limitLine); |
478 | 478 |
|
479 | 479 | xAxis.removeAllLimitLines(); |
480 | | - if (showAscents) { |
| 480 | + if (showAscents && profile.ascents) { |
481 | 481 | profile.ascents.forEach((ascent: AscentSegment) => { |
482 | 482 | const text = convertElevation(ascent.highestElevation) + '\n+' + convertElevation(ascent.gain); |
483 | | -
|
484 | 483 | limitLine = new LimitLine(profileData[ascent.highestPointIndex].d, text); |
485 | 484 | limitLine.lineColor = colorOutline; |
486 | 485 | limitLine.enableDashedLine(6, 3, 0); |
487 | 486 | limitLine.lineWidth = 0.5; |
488 | | - limitLine.textSize = 7; |
| 487 | + limitLine.textSize = 7 * $fontScale; |
489 | 488 | limitLine.xOffset = 0; |
490 | 489 | limitLine.textColor = colorOnSurface; |
491 | 490 | limitLine.ensureVisible = true; |
492 | 491 | limitLine.drawLabel = (c: Canvas, label: string, x: number, y: number, paint: Paint) => { |
493 | 492 | c.drawCircle(x + 5, y - 6, 6, waypointsBackPaint); |
494 | | - waypointsPaint.textSize = 7; |
| 493 | + waypointsPaint.textSize = 7 * $fontScale; |
495 | 494 | c.drawText('', x + 5, y - 5 + 1, waypointsPaint); |
496 | 495 | // paint.setTextAlign(Align.CENTER); |
497 | 496 | const staticLayout = new StaticLayout(label, paint, c.getWidth(), LayoutAlignment.ALIGN_NORMAL, 1, 0, true); |
|
503 | 502 | xAxis.addLimitLine(limitLine); |
504 | 503 | }); |
505 | 504 | } |
506 | | - if (showWaypoints) { |
507 | | - const positions = packageService.getRouteItemPoses(it); |
| 505 | + if (showWaypoints && it.route.waypoints) { |
508 | 506 | it.route.waypoints.forEach((p) => { |
509 | 507 | if (p.properties.showOnMap && p.properties.index > 0) { |
510 | 508 | limitLine = new LimitLine(profileData[p.properties.index].d, ' '); |
|
514 | 512 | limitLine.ensureVisible = true; |
515 | 513 | limitLine.drawLabel = (c: Canvas, label: string, x: number, y: number, paint: Paint) => { |
516 | 514 | c.drawCircle(x - 5, y + 0, 6, waypointsBackPaint); |
517 | | - waypointsPaint.textSize = 8; |
| 515 | + waypointsPaint.textSize = 8 * $fontScale; |
518 | 516 | c.drawText('', x - 5, y + 4 - 1, waypointsPaint); |
519 | 517 | }; |
520 | 518 | xAxis.addLimitLine(limitLine); |
|
0 commit comments