From 494728e20f3d530bb77e2b0be3940ee2887b888d Mon Sep 17 00:00:00 2001 From: David Sehnal <david.sehnal@gmail.com> Date: Mon, 30 Jul 2018 19:07:07 +0200 Subject: [PATCH] Fixed select highlight (?), only do picking if no buttons are involved (makes rotation/zoom much faster) --- src/mol-app/ui/visualization/viewport.tsx | 10 ++++++---- src/mol-gl/shader/chunks/apply-marker-color.glsl | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mol-app/ui/visualization/viewport.tsx b/src/mol-app/ui/visualization/viewport.tsx index 11fef7e54..ba402a6d7 100644 --- a/src/mol-app/ui/visualization/viewport.tsx +++ b/src/mol-app/ui/visualization/viewport.tsx @@ -158,19 +158,21 @@ export class Viewport extends View<ViewportController, ViewportState, { noWebGl? viewer.input.resize.subscribe(() => this.handleResize()) - viewer.input.move.subscribe(({x, y, inside}) => { - if (!inside) return + // TODO: clear highlight on mouse/touch down? + + viewer.input.move.subscribe(({x, y, inside, buttons}) => { + if (!inside || buttons) return const p = viewer.identify(x, y) const loci = viewer.getLoci(p) InteractivityEvents.HighlightLoci.dispatch(this.controller.context, loci); - + // TODO use LabelLoci event and make configurable const label = labelFirst(loci) const info = `Object: ${p.objectId}, Instance: ${p.instanceId}, Element: ${p.elementId}, Label: ${label}` this.setState({ info }) }) - // TODO filter only for left button? + // TODO filter only for left button/single finger touch? viewer.input.click.subscribe(({x, y}) => { const loci = viewer.getLoci(viewer.identify(x, y)) InteractivityEvents.SelectLoci.dispatch(this.controller.context, loci); diff --git a/src/mol-gl/shader/chunks/apply-marker-color.glsl b/src/mol-gl/shader/chunks/apply-marker-color.glsl index c457e1b75..0c73020b0 100644 --- a/src/mol-gl/shader/chunks/apply-marker-color.glsl +++ b/src/mol-gl/shader/chunks/apply-marker-color.glsl @@ -1,4 +1,4 @@ -float marker = vMarker * 255.0; +float marker = vMarker * 256.0; if (marker > 0.1) { if (mod(marker, 2.0) < 0.1) { gl_FragColor.rgb = mix(uHighlightColor, gl_FragColor.rgb, 0.3); -- GitLab