Skip to content

Commit

Permalink
fix bug for click and drag.
Browse files Browse the repository at this point in the history
clickAndDrag disable by default, but enable if it's a 180 video.
clickToToggle enable by default
  • Loading branch information
wensheng-yan committed Jun 29, 2017
1 parent ae90459 commit d8ecdaa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
15 changes: 6 additions & 9 deletions src/scripts/Components/BaseCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,12 @@ class BaseCanvas extends Component{
const clientY = event.clientY || event.touches && event.touches[0].clientY;

if(this.options.MouseEnable && typeof clientX !== "undefined" && typeof clientY !== "undefined") {
if(this.options.clickAndDrag){
if(this._mouseDown){
this._lon = ( this._mouseDownPointer.x - clientX ) * 0.2 + this._mouseDownLocation.Lon;
this._lat = ( clientY - this._mouseDownPointer.y ) * 0.2 + this._mouseDownLocation.Lat;
this._accelector.x = 0;
this._accelector.y = 0;
}
//do nothing if mouse down is not detected.
}else{
if(this._mouseDown){
this._lon = ( this._mouseDownPointer.x - clientX ) * 0.2 + this._mouseDownLocation.Lon;
this._lat = ( clientY - this._mouseDownPointer.y ) * 0.2 + this._mouseDownLocation.Lat;
this._accelector.x = 0;
this._accelector.y = 0;
}else if(!this.options.clickAndDrag){
var rect = this.el().getBoundingClientRect();
const x = clientX - this._width / 2 - rect.left;
const y = this._height / 2 - (clientY - rect.top);
Expand Down
6 changes: 4 additions & 2 deletions src/scripts/Panorama.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ const videoTypes = ["equirectangular", "fisheye", "dual_fisheye", "VR1803D", "VR
export const defaults: Settings = {
videoType: "equirectangular",
MouseEnable: true,
clickAndDrag: true,
clickAndDrag: false,
movingSpeed: {
x: 0.0005,
y: 0.0005
},
clickToToggle: false,
clickToToggle: true,
scrollable: true,
resizable: true,
useHelperCanvas: "auto",
Expand Down Expand Up @@ -110,6 +110,8 @@ export const VR180Defaults: any = {

minLon: 50,
maxLon: 130,

clickAndDrag: true
};

/**
Expand Down

0 comments on commit d8ecdaa

Please sign in to comment.