Skip to content

Event does not fire for target scale value when simulating pinching #5

Description

@jacksonrayhamilton

When I use Simulator.gestures.pinch, I expect a pinch event to eventually fire with the scale I specify as an option. So, in the following test case:

package.json:

{
  "dependencies": {
    "hammer-simulator": "0.0.1",
    "hammerjs": "2.0.8"
  }
}

index.html:

<body>
  <div class="test-element"></div>
  <script src="node_modules/hammerjs/hammer.js"></script>
  <script src="node_modules/hammer-simulator/index.js"></script>
  <script src="test.js"></script>
</body>

test.js:

(function () {

    'use strict';

    var element = document.querySelector('.test-element');

    var hammertime = new Hammer(element);
    hammertime.get('pinch').set({enable: true});

    hammertime.on('pinch', function (event) {
        console.log('event.scale', event.scale);
    });

    Simulator.gestures.pinch(element, {
        scale: 2.0
    });

}());

I expect that an event.scale of 2 will eventually be logged. However, the final value to be printed is only 1.9230769230769231. Is this expected or is it a bug?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions