From 56c0f2601d74ecda2a2ab917d8950b01b95df14c Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Tue, 17 Sep 2024 13:46:42 -0600 Subject: [PATCH] add scaling factor for draging --- src/disagg/DisaggGraphView.js | 6 ++++-- types/disagg/DisaggGraphViewOptions.d.ts | 16 +++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/disagg/DisaggGraphView.js b/src/disagg/DisaggGraphView.js index afea763..07f6dbd 100644 --- a/src/disagg/DisaggGraphView.js +++ b/src/disagg/DisaggGraphView.js @@ -15,6 +15,8 @@ var _DEFAULTS; _DEFAULTS = { allowDrag: true, + dragXScale: 3.5, + dragZScale: 3.0 }; var __calculateBounds; @@ -153,8 +155,8 @@ var DisaggGraphView = function (options) { }) .on('mousemove', event => { if (dragging) { - var dx = event.clientX - origin.x; - var dz = event.clientY - origin.y; + var dx = (event.clientX - origin.x) * options.dragXScale; + var dz = (event.clientY - origin.y) * options.dragZScale; var [x, y ,z] = _this.d33d.model.get('origin'); _this.setOrigin(x - dx, y, z + dz) origin.x = event.clientX; diff --git a/types/disagg/DisaggGraphViewOptions.d.ts b/types/disagg/DisaggGraphViewOptions.d.ts index 3d9e236..e498195 100644 --- a/types/disagg/DisaggGraphViewOptions.d.ts +++ b/types/disagg/DisaggGraphViewOptions.d.ts @@ -3,6 +3,12 @@ import {Disaggregation} from './Disaggregation'; export interface DisaggGraphViewOptions extends SelectedCollectionViewOptions<Disaggregation> { + /** + * Collection with data to display. + * Selected Disaggregation object is displayed. + */ + collection: Collection<Disaggregation>; + /** * Whether to allow drag and rotate of graph. */ @@ -14,9 +20,9 @@ export interface DisaggGraphViewOptions */ bounds?: number[][]; - /** - * Collection with data to display. - * Selected Disaggregation object is displayed. - */ - collection: Collection<Disaggregation>; + /** Scale factor for mouse movement to plot movement in X axis of plot */ + dragXScale?: number; + + /** Scale factor for mouse movement to plot movement in Z axis of plot */ + dragZScale?: number; } -- GitLab