From d0a8874ac8f73f1a568188c47e87c493b5dc6dfb Mon Sep 17 00:00:00 2001 From: Chase Porter Date: Mon, 18 Oct 2021 11:11:10 -0700 Subject: [PATCH] Uses new doubleclick callback creation method for timeSeries placing to make sure it works in ios. --- fdds/js/components/timeSeriesController.js | 5 +++-- fdds/js/util.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fdds/js/components/timeSeriesController.js b/fdds/js/components/timeSeriesController.js index c88d00f..971f0b2 100644 --- a/fdds/js/components/timeSeriesController.js +++ b/fdds/js/components/timeSeriesController.js @@ -4,7 +4,7 @@ import { simVars } from '../simVars.js'; import { map } from '../map.js'; import { TimeSeriesMarker } from './timeSeriesMarker.js'; import { TimeSeriesButton } from './timeSeriesButton.js'; -import { utcToLocal } from '../util.js'; +import { doubleClick, utcToLocal } from '../util.js'; /** This class extends LayerController and adds to it functionality for generating a timeseries * mapping a specific pixel value to its corresponing location on the colorbar over a certain time @@ -83,7 +83,7 @@ export class TimeSeriesController extends LayerController { var img = layer._image; const rasterColorbar = document.querySelector('#raster-colorbar'); if ('colorbar' in rastersNow[name]) { - img.ondblclick = (e) => { + let doubleClickCallback = (e) => { var latLon = map.mouseEventToLatLng(e); e.stopPropagation(); // needed because otherwise immediately closes the popup var xCoord = e.offsetX / img.width; @@ -91,6 +91,7 @@ export class TimeSeriesController extends LayerController { this.createNewMarker(latLon, xCoord, yCoord); this.timeSeriesButton.getButton().disabled = false; } + doubleClick(img, doubleClickCallback); img.onload = () => { controllers.syncImageLoad.increment(0); } diff --git a/fdds/js/util.js b/fdds/js/util.js index 7c75fce..3a8927a 100644 --- a/fdds/js/util.js +++ b/fdds/js/util.js @@ -150,12 +150,13 @@ export function linkSelects(selectStart, selectEnd) { /** A custom double click implementation needed to handle double clicking on ios. */ export function doubleClick(elmnt, doubleClickFunction) { - const DOUBLE_CLICK_MS = 100; + const DOUBLE_CLICK_MS = 200; let timeout = null; elmnt.onpointerdown = (e) => { e.stopPropagation(); - if (timeOutFunction != null) { + if (timeout != null) { clearTimeout(timeout); + timeout = null; doubleClickFunction(e); } else { timeout = setTimeout(() => { -- 2.11.4.GIT