mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-01 08:12:32 +00:00
fix crop selection from elevation profile, and improve for dark mode, closes #41
This commit is contained in:
@@ -40,6 +40,7 @@
|
|||||||
import { DateFormatter } from '@internationalized/date';
|
import { DateFormatter } from '@internationalized/date';
|
||||||
import type { GPXStatistics } from 'gpx';
|
import type { GPXStatistics } from 'gpx';
|
||||||
import { settings } from '$lib/db';
|
import { settings } from '$lib/db';
|
||||||
|
import { mode } from 'mode-watcher';
|
||||||
|
|
||||||
export let gpxStatistics: Writable<GPXStatistics>;
|
export let gpxStatistics: Writable<GPXStatistics>;
|
||||||
export let slicedGPXStatistics: Writable<[GPXStatistics, number, number] | undefined>;
|
export let slicedGPXStatistics: Writable<[GPXStatistics, number, number] | undefined>;
|
||||||
@@ -525,7 +526,8 @@
|
|||||||
// Draw selection rectangle
|
// Draw selection rectangle
|
||||||
let selectionContext = overlay.getContext('2d');
|
let selectionContext = overlay.getContext('2d');
|
||||||
if (selectionContext) {
|
if (selectionContext) {
|
||||||
selectionContext.globalAlpha = 0.1;
|
selectionContext.fillStyle = $mode === 'dark' ? 'white' : 'black';
|
||||||
|
selectionContext.globalAlpha = $mode === 'dark' ? 0.2 : 0.1;
|
||||||
selectionContext.clearRect(0, 0, overlay.width, overlay.height);
|
selectionContext.clearRect(0, 0, overlay.width, overlay.height);
|
||||||
|
|
||||||
let startPixel = chart.scales.x.getPixelForValue(
|
let startPixel = chart.scales.x.getPixelForValue(
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
import { SplitControls } from './SplitControls';
|
import { SplitControls } from './SplitControls';
|
||||||
|
|
||||||
let splitControls: SplitControls | undefined = undefined;
|
let splitControls: SplitControls | undefined = undefined;
|
||||||
|
let canCrop = false;
|
||||||
|
|
||||||
$: if ($map) {
|
$: if ($map) {
|
||||||
if (splitControls) {
|
if (splitControls) {
|
||||||
@@ -39,7 +40,9 @@
|
|||||||
let maxSliderValue = 100;
|
let maxSliderValue = 100;
|
||||||
let sliderValues = [0, 100];
|
let sliderValues = [0, 100];
|
||||||
|
|
||||||
$: canCrop = sliderValues[0] != 0 || sliderValues[1] != maxSliderValue;
|
function updateCanCrop() {
|
||||||
|
canCrop = sliderValues[0] != 0 || sliderValues[1] != maxSliderValue;
|
||||||
|
}
|
||||||
|
|
||||||
function updateSlicedGPXStatistics() {
|
function updateSlicedGPXStatistics() {
|
||||||
if (validSelection && canCrop) {
|
if (validSelection && canCrop) {
|
||||||
@@ -74,6 +77,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$: if (sliderValues) {
|
$: if (sliderValues) {
|
||||||
|
updateCanCrop();
|
||||||
updateSlicedGPXStatistics();
|
updateSlicedGPXStatistics();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +86,7 @@
|
|||||||
($slicedGPXStatistics[1] !== sliderValues[0] || $slicedGPXStatistics[2] !== sliderValues[1])
|
($slicedGPXStatistics[1] !== sliderValues[0] || $slicedGPXStatistics[2] !== sliderValues[1])
|
||||||
) {
|
) {
|
||||||
updateSliderValues();
|
updateSliderValues();
|
||||||
|
updateCanCrop();
|
||||||
}
|
}
|
||||||
|
|
||||||
const splitTypes = [
|
const splitTypes = [
|
||||||
|
Reference in New Issue
Block a user