{"action":"created","comment":{"url":"https://api.github.com/repos/palantir/plottable/pulls/comments/29394087","id":29394087,"diff_hunk":"@@ -0,0 +1,113 @@\n+///<reference path=\"../testReference.ts\" />\n+\n+var assert = chai.assert;\n+\n+describe(\"Interactions\", () => {\n+  describe(\"PanZoomInteraction\", () => {\n+    var svg: D3.Selection;\n+    var SVG_WIDTH = 400;\n+    var SVG_HEIGHT = 500;\n+\n+    var eventTarget: D3.Selection;\n+\n+    var xScale: Plottable.Scale.AbstractQuantitative<number>;\n+    var yScale: Plottable.Scale.AbstractQuantitative<number>;\n+\n+    beforeEach(() => {\n+      svg = generateSVG(SVG_WIDTH, SVG_HEIGHT);\n+\n+      var component = new Plottable.Component.AbstractComponent();\n+      component.renderTo(svg);\n+\n+      xScale = new Plottable.Scale.Linear();\n+      xScale.domain([0, SVG_WIDTH / 2]).range([0, SVG_WIDTH]);\n+      yScale = new Plottable.Scale.Linear();\n+      yScale.domain([0, SVG_HEIGHT / 2]).range([0, SVG_HEIGHT]);\n+      component.registerInteraction(new Plottable.Interaction.PanZoom(xScale, yScale));\n+\n+      eventTarget = component.background();\n+    });\n+\n+    describe(\"Panning\", () => {\n+\n+      it(\"dragging a certain amount will translate the scale correctly (mouse)\", () => {\n+        var startPoint = { x: SVG_WIDTH / 4, y: SVG_HEIGHT / 4 };\n+        var endPoint = { x: SVG_WIDTH / 2, y: SVG_HEIGHT * 3 / 4 };\n+        triggerFakeMouseEvent(\"mousedown\", eventTarget, startPoint.x, startPoint.y);\n+        triggerFakeMouseEvent(\"mousemove\", eventTarget, endPoint.x, endPoint.y);\n+        triggerFakeMouseEvent(\"mouseend\", eventTarget, endPoint.x, endPoint.y);\n+        assert.deepEqual(xScale.domain(), [-SVG_WIDTH / 8, SVG_WIDTH * 3 / 8], \"xScale pans to the correct domain via drag (mouse)\");\n+        assert.deepEqual(yScale.domain(), [-SVG_HEIGHT / 4, SVG_HEIGHT / 4], \"yScale pans to the correct domain via drag (mouse)\");\n+        svg.remove();\n+      });\n+\n+      it(\"dragging a certain amount will translate the scale correctly (touch)\", () => {\n+        // HACKHACK PhantomJS doesn't implement fake creation of WheelEvents\n+        // https://github.com/ariya/phantomjs/issues/11289\n+        if ( window.PHANTOMJS ) {\n+          svg.remove();\n+          return;\n+        }\n+\n+        var startPoint = { x: SVG_WIDTH / 4, y: SVG_HEIGHT / 4 };\n+        var endPoint = { x: SVG_WIDTH / 2, y: SVG_HEIGHT * 3 / 4 };\n+        triggerFakeTouchEvent(\"touchstart\", eventTarget, [startPoint]);\n+        triggerFakeTouchEvent(\"touchmove\", eventTarget, [endPoint]);\n+        triggerFakeTouchEvent(\"touchend\", eventTarget, [endPoint]);\n+        assert.deepEqual(xScale.domain(), [-SVG_WIDTH / 8, SVG_WIDTH * 3 / 8], \"xScale pans to the correct domain via drag (touch)\");\n+        assert.deepEqual(yScale.domain(), [-SVG_HEIGHT / 4, SVG_HEIGHT / 4], \"yScale pans to the correct domain via drag (touch)\");\n+        svg.remove();\n+      });\n+\n+      it(\"dragging to outside the component will translate the scale correctly (touch)\", () => {","path":"test/interactions/panZoomInteractionTests.ts","position":62,"original_position":62,"commit_id":"4b191f652c009e5b09be06098238df210ae8d2ca","original_commit_id":"4b191f652c009e5b09be06098238df210ae8d2ca","user":{"login":"jtlan","id":1440449,"avatar_url":"https://avatars.githubusercontent.com/u/1440449?v=3","gravatar_id":"","url":"https://api.github.com/users/jtlan","html_url":"https://github.com/jtlan","followers_url":"https://api.github.com/users/jtlan/followers","following_url":"https://api.github.com/users/jtlan/following{/other_user}","gists_url":"https://api.github.com/users/jtlan/gists{/gist_id}","starred_url":"https://api.github.com/users/jtlan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtlan/subscriptions","organizations_url":"https://api.github.com/users/jtlan/orgs","repos_url":"https://api.github.com/users/jtlan/repos","events_url":"https://api.github.com/users/jtlan/events{/privacy}","received_events_url":"https://api.github.com/users/jtlan/received_events","type":"User","site_admin":false},"body":"No equivalent test for mouse?","created_at":"2015-04-30T00:03:40Z","updated_at":"2015-04-30T00:03:40Z","html_url":"https://github.com/palantir/plottable/pull/1896#discussion_r29394087","pull_request_url":"https://api.github.com/repos/palantir/plottable/pulls/1896","_links":{"self":{"href":"https://api.github.com/repos/palantir/plottable/pulls/comments/29394087"},"html":{"href":"https://github.com/palantir/plottable/pull/1896#discussion_r29394087"},"pull_request":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1896"}}},"pull_request":{"url":"https://api.github.com/repos/palantir/plottable/pulls/1896","id":34021188,"html_url":"https://github.com/palantir/plottable/pull/1896","diff_url":"https://github.com/palantir/plottable/pull/1896.diff","patch_url":"https://github.com/palantir/plottable/pull/1896.patch","issue_url":"https://api.github.com/repos/palantir/plottable/issues/1896","number":1896,"state":"open","locked":false,"title":"Pan zoom interaction","user":{"login":"bluong","id":1448299,"avatar_url":"https://avatars.githubusercontent.com/u/1448299?v=3","gravatar_id":"","url":"https://api.github.com/users/bluong","html_url":"https://github.com/bluong","followers_url":"https://api.github.com/users/bluong/followers","following_url":"https://api.github.com/users/bluong/following{/other_user}","gists_url":"https://api.github.com/users/bluong/gists{/gist_id}","starred_url":"https://api.github.com/users/bluong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluong/subscriptions","organizations_url":"https://api.github.com/users/bluong/orgs","repos_url":"https://api.github.com/users/bluong/repos","events_url":"https://api.github.com/users/bluong/events{/privacy}","received_events_url":"https://api.github.com/users/bluong/received_events","type":"User","site_admin":false},"body":"`Interaction.PanZoom` has been completely reworked and rearchitected to follow the new architecture we have for `Interaction`s.\r\n\r\nExample JSFiddle: http://jsfiddle.net/bluong63/s2pzbx4p/1/\r\n\r\nUsage of `Interaction.PanZoom` should still be the same:\r\n```typescript\r\nvar xScale;\r\nvar yScale;\r\nvar plot;\r\n\r\n// xScale and yScale are optional if a user does not want to have panning/zooming on those scales\r\nvar panZoomInteraction = new Plottable.Interaction.PanZoom(xScale, yScale);\r\n\r\nplot.registerInteraction(panZoomInteraction);\r\n```\r\n\r\nNote that this reworking and rearchitecting means that `Interaction.PanZoom` is a lot more integrated with our codebase so its interaction with scales should be a lot less buggy.\r\n\r\nUpgrades in behavior:\r\n* `Interaction.PanZoom` will now work with `Scale.ModifiedLog`s neatly.\r\n* `Interaction.PanZoom` does not have to be registered after the plot is rendered.\r\n\r\nCloses #1727 \r\nCloses #1581 \r\nCloses #1502 \r\nCloses #1434 ","created_at":"2015-04-24T06:09:49Z","updated_at":"2015-04-30T00:03:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9a3bb5512f0a17a72329957d0a4d051eaacc41fe","assignee":{"login":"jtlan","id":1440449,"avatar_url":"https://avatars.githubusercontent.com/u/1440449?v=3","gravatar_id":"","url":"https://api.github.com/users/jtlan","html_url":"https://github.com/jtlan","followers_url":"https://api.github.com/users/jtlan/followers","following_url":"https://api.github.com/users/jtlan/following{/other_user}","gists_url":"https://api.github.com/users/jtlan/gists{/gist_id}","starred_url":"https://api.github.com/users/jtlan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtlan/subscriptions","organizations_url":"https://api.github.com/users/jtlan/orgs","repos_url":"https://api.github.com/users/jtlan/repos","events_url":"https://api.github.com/users/jtlan/events{/privacy}","received_events_url":"https://api.github.com/users/jtlan/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/palantir/plottable/pulls/1896/commits","review_comments_url":"https://api.github.com/repos/palantir/plottable/pulls/1896/comments","review_comment_url":"https://api.github.com/repos/palantir/plottable/pulls/comments{/number}","comments_url":"https://api.github.com/repos/palantir/plottable/issues/1896/comments","statuses_url":"https://api.github.com/repos/palantir/plottable/statuses/4b191f652c009e5b09be06098238df210ae8d2ca","head":{"label":"palantir:panZoomInteraction","ref":"panZoomInteraction","sha":"4b191f652c009e5b09be06098238df210ae8d2ca","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":16149854,"name":"plottable","full_name":"palantir/plottable","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/plottable","description":"A library of modular chart components, built on D3","fork":false,"url":"https://api.github.com/repos/palantir/plottable","forks_url":"https://api.github.com/repos/palantir/plottable/forks","keys_url":"https://api.github.com/repos/palantir/plottable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/plottable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/plottable/teams","hooks_url":"https://api.github.com/repos/palantir/plottable/hooks","issue_events_url":"https://api.github.com/repos/palantir/plottable/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/plottable/events","assignees_url":"https://api.github.com/repos/palantir/plottable/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/plottable/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/plottable/tags","blobs_url":"https://api.github.com/repos/palantir/plottable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/plottable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/plottable/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/plottable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/plottable/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/plottable/languages","stargazers_url":"https://api.github.com/repos/palantir/plottable/stargazers","contributors_url":"https://api.github.com/repos/palantir/plottable/contributors","subscribers_url":"https://api.github.com/repos/palantir/plottable/subscribers","subscription_url":"https://api.github.com/repos/palantir/plottable/subscription","commits_url":"https://api.github.com/repos/palantir/plottable/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/plottable/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/plottable/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/plottable/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/plottable/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/plottable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/plottable/merges","archive_url":"https://api.github.com/repos/palantir/plottable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/plottable/downloads","issues_url":"https://api.github.com/repos/palantir/plottable/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/plottable/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/plottable/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/plottable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/plottable/labels{/name}","releases_url":"https://api.github.com/repos/palantir/plottable/releases{/id}","created_at":"2014-01-22T19:29:19Z","updated_at":"2015-04-28T00:14:43Z","pushed_at":"2015-04-29T23:45:42Z","git_url":"git://github.com/palantir/plottable.git","ssh_url":"git@github.com:palantir/plottable.git","clone_url":"https://github.com/palantir/plottable.git","svn_url":"https://github.com/palantir/plottable","homepage":"plottablejs.org","size":76045,"stargazers_count":454,"watchers_count":454,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"open_issues_count":146,"forks":39,"open_issues":146,"watchers":454,"default_branch":"develop"}},"base":{"label":"palantir:develop","ref":"develop","sha":"0450a9aa28f6b651fda65dd45716151fe096a446","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":16149854,"name":"plottable","full_name":"palantir/plottable","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/plottable","description":"A library of modular chart components, built on D3","fork":false,"url":"https://api.github.com/repos/palantir/plottable","forks_url":"https://api.github.com/repos/palantir/plottable/forks","keys_url":"https://api.github.com/repos/palantir/plottable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/plottable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/plottable/teams","hooks_url":"https://api.github.com/repos/palantir/plottable/hooks","issue_events_url":"https://api.github.com/repos/palantir/plottable/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/plottable/events","assignees_url":"https://api.github.com/repos/palantir/plottable/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/plottable/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/plottable/tags","blobs_url":"https://api.github.com/repos/palantir/plottable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/plottable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/plottable/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/plottable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/plottable/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/plottable/languages","stargazers_url":"https://api.github.com/repos/palantir/plottable/stargazers","contributors_url":"https://api.github.com/repos/palantir/plottable/contributors","subscribers_url":"https://api.github.com/repos/palantir/plottable/subscribers","subscription_url":"https://api.github.com/repos/palantir/plottable/subscription","commits_url":"https://api.github.com/repos/palantir/plottable/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/plottable/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/plottable/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/plottable/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/plottable/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/plottable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/plottable/merges","archive_url":"https://api.github.com/repos/palantir/plottable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/plottable/downloads","issues_url":"https://api.github.com/repos/palantir/plottable/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/plottable/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/plottable/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/plottable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/plottable/labels{/name}","releases_url":"https://api.github.com/repos/palantir/plottable/releases{/id}","created_at":"2014-01-22T19:29:19Z","updated_at":"2015-04-28T00:14:43Z","pushed_at":"2015-04-29T23:45:42Z","git_url":"git://github.com/palantir/plottable.git","ssh_url":"git@github.com:palantir/plottable.git","clone_url":"https://github.com/palantir/plottable.git","svn_url":"https://github.com/palantir/plottable","homepage":"plottablejs.org","size":76045,"stargazers_count":454,"watchers_count":454,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"open_issues_count":146,"forks":39,"open_issues":146,"watchers":454,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1896"},"html":{"href":"https://github.com/palantir/plottable/pull/1896"},"issue":{"href":"https://api.github.com/repos/palantir/plottable/issues/1896"},"comments":{"href":"https://api.github.com/repos/palantir/plottable/issues/1896/comments"},"review_comments":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1896/comments"},"review_comment":{"href":"https://api.github.com/repos/palantir/plottable/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/palantir/plottable/pulls/1896/commits"},"statuses":{"href":"https://api.github.com/repos/palantir/plottable/statuses/4b191f652c009e5b09be06098238df210ae8d2ca"}}}}