cnr-isti-vclab/3DHOP

Trackballs dragging speed option

fq-selbach opened this issue · 3 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

I just noticed that there is a related issue: #23

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

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? ^^

Hi @fq-selbach,

many thanks for reporting this issue and for your tip. We just integrated into the DEVELOPMENT code (commit bae3e10) 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.