desandro / draggabilly

:point_down: Make that shiz draggable

Home Page:https://draggabilly.desandro.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2.2.0 does not work on safari 8

h4cj0b opened this issue · comments

Hello.

Last ver. 2.2.0 doesn't work in Safari 8, draggabilly object does not move or click:
console message: undefined is not an object (evaluating 'transform.indexOf')
(see attachment)

It happens in a function ._addTransformPosition:

// add transform: translate( x, y ) to position
proto._addTransformPosition = function( style ) {
  var transform = style.transform;
  // bail out if value is 'none'
  if ( transform.indexOf('matrix') !== 0 ) {
    return;
  }
  // split matrix(1, 0, 0, 1, x, y)
  var matrixValues = transform.split(',');
  // translate X value is in 12th or 4th position
  var xIndex = transform.indexOf('matrix3d') === 0 ? 12 : 4;
  var translateX = parseInt( matrixValues[ xIndex ], 10 );
  // translate Y value is in 13th or 5th position
  var translateY = parseInt( matrixValues[ xIndex + 1 ], 10 );
  this.position.x += translateX;
  this.position.y += translateY;
};

if make a transform variable check then it's work in safari 8:

if (transform) {...}

proto._addTransformPosition = function( style ) {
  var transform = style.transform;
  // bail out if value is 'none'
  if (transform) {
      if ( transform.indexOf('matrix') !== 0 ) {
        return;
      }
      // split matrix(1, 0, 0, 1, x, y)
      var matrixValues = transform.split(',');
      // translate X value is in 12th or 4th position
      var xIndex = transform.indexOf('matrix3d') === 0 ? 12 : 4;
      var translateX = parseInt( matrixValues[ xIndex ], 10 );
      // translate Y value is in 13th or 5th position
      var translateY = parseInt( matrixValues[ xIndex + 1 ], 10 );
      this.position.x += translateX;
      this.position.y += translateY;
  }
};

Could you fix it or it's not solves a problem or it's bad idea of resolve?

"It couldn't hurt / I think it will not be worse"
Thank you.

p.s.: sorry for my bad English

draggabilly-safari8

Thanks for reporting this issue. Safari v8 is over 3 years, and has less than 0.2% global browser usage. Draggabilly v2.2.0 will not support Safari 8.