3DHOP icon indicating copy to clipboard operation
3DHOP copied to clipboard

'SphereTrackball' rotation speed option?

Open fq-selbach opened this issue 2 years ago • 2 comments

First of all thanks for this nice tool! Its working pretty well for our project there is just some little inconvenience I have with the rotation speed while using the mouse to drag the 3D model. See below please.
I was thinking to look into the code to fix this myself but wanted to ask for an opinion first :-).

Is your feature request related to a problem? Please describe. When using the 'SphereTrackball' the rotation speed using the mouse is a bit too slow.

Describe the solution you'd like Add an option to presenter scene setup, e.g.:

presenter.setScene({
  ...
  trackball: {
	  type : SphereTrackball,
	  trackOptions : {
		  ...,
		  dragRotationSpeed: 1.2
	  }
  }
});

Ty, Florian

fq-selbach avatar Aug 30 '21 09:08 fq-selbach

I just noticed that there is a related issue: https://github.com/cnr-isti-vclab/3DHOP/issues/23

Would you be interested in a PR to add the described solution as presenter option?

fq-selbach avatar Aug 30 '21 09:08 fq-selbach

I've quickly implemented a speed scaling factor:

presenter.js:

var dragSpeedFactor = this._scene.config.dragSpeedFactor || 1.0;
if(ui.dragDeltaX(button) != 0) this.x += (ui.cursorDeltaX/(500 / dragSpeedFactor));
if(ui.dragDeltaY(button) != 0) this.y += (ui.cursorDeltaY/(500 / dragSpeedFactor));

index.html:

presenter.setScene({
  ...,
  config: {
	  dragSpeedFactor: 2.0
  }
});

Works pretty well :-). I'm not sure about the name ('dragSpeedFactor') and the option section ('config') yet. Any ideas? ^^

fq-selbach avatar Aug 30 '21 10:08 fq-selbach

Hi @fq-selbach,

many thanks for reporting this issue and for your tip. We just integrated into the DEVELOPMENT code (commit https://github.com/cnr-isti-vclab/3DHOP/commit/bae3e10eef70aeec3609976d2da5d1f9fb1a2bfd) a similar solution (a multiplicative factor for customizing trackballs' dragging speed). You can control this interaction from the trackballs declaration in setScene, specifying the optional dragSpeed parameter, in this way:

presenter.setScene({
  ...
  trackball: {
    type : ...,
    trackOptions : {
      ...
    },
    dragSpeed: 1.0
  }
});

Default value is 1.0; any bigger number means a faster-dragging interaction, while smaller means a slower one.

potenziani avatar Mar 10 '23 13:03 potenziani