Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

Fix pan issue #657 #2617

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Next Next commit
support rtl
  • Loading branch information
mosheDa committed Jan 17, 2017
commit 2fd5027d365f0728f506525429c4ccb282e171a2
43 changes: 25 additions & 18 deletions lib/timeline/component/ItemSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -1434,16 +1434,18 @@ ItemSet.prototype._onDrag = function (event) {
var interval = end - start;

var distance = (interval * 2) / 100;
// console.log("drag on")

if(this.body.mouseLocation.mouseOnLeft){
var newStart = start - distance;
var newEnd = end - distance;
}
else{
if ((this.options.rtl && this.body.mouseLocation.mouseOnLeft)||
(!this.options.rtl && this.body.mouseLocation.mouseOnRight))
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for new line

var newStart = start + distance;
var newEnd = end + distance;
}
else
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brackets don't need a new line. should be } else {

var newStart = start - distance;
var newEnd = end - distance;
}

this.body.range._applyRange(newStart, newEnd);

Expand Down Expand Up @@ -1557,19 +1559,24 @@ ItemSet.prototype._onDrag = function (event) {
// moshe's code


if(this.body.mouseLocation.mouseOnLeft || this.body.mouseLocation.mouseOnRight){
var range = this.body.getWindow();
var windowStart = range.start.valueOf();
var windowEnd = range.end.valueOf();

if(this.body.mouseLocation.mouseOnLeft){

start = windowStart;
} else {
var itemWidth = props.item.data.end.valueOf() - props.item.data.start.valueOf();
start = windowEnd - itemWidth;
if(this.body.mouseLocation.mouseOnLeft || this.body.mouseLocation.mouseOnRight){
var range = this.body.getWindow();
var windowStart = range.start.valueOf();
var windowEnd = range.end.valueOf();


if ((this.options.rtl && this.body.mouseLocation.mouseOnLeft)||
(!this.options.rtl && this.body.mouseLocation.mouseOnRight))
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for new line

var itemWidth = props.item.data.end.valueOf() - props.item.data.start.valueOf();
start = windowEnd - itemWidth;


} else
{
start = windowStart;
}
}
}

//

Expand Down