Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed prevent default interaction in mobile mode for drag interaction #3585

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "plottable",
"name": "@texx/plottable",
"description": "A modular charting library built on D3",
"version": "3.13.0",
"version": "3.14.0",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/palantir/plottable.git"
"url": "https://github.com/7eXx/plottable.git"
},
"author": "Palantir Technologies",
"main": "build/src/index.js",
Expand Down
1 change: 0 additions & 1 deletion src/interactions/dragInteraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export class Drag extends Interaction {
}
const translatedP = this._translateToComponentSpace(point);
if (this._isInsideComponent(translatedP)) {
event.preventDefault();
this._dragging = true;
this._dragOrigin = translatedP;
this._dragStartCallbacks.callCallbacks(this._dragOrigin);
Expand Down
41 changes: 41 additions & 0 deletions test/utils/domUtilsTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,45 @@ describe("Utils.DOM", () => {
child.remove();
});
});

describe("elementWidth(), elementHeight() for display none element", () => {
it("can get a display none element's size", () => {
const parent = TestMethods.getElementParent();
parent.style("display", "none");
parent.style("width", "600px");
parent.style("height", "400px");
const parentElem = <Element> parent.node();

const width = Plottable.Utils.DOM.elementWidth(parentElem);
assert.strictEqual(width, 600, "measured width matches set width");
const height = Plottable.Utils.DOM.elementHeight(parentElem);
assert.strictEqual(height, 400, "measured height matches set height");
});

it("can get a div display none element's size", () => {
const div = TestMethods.generateDiv(300, 200);
div.style("display", "none");
const divElement = <Element> div.node();

const width = Plottable.Utils.DOM.elementWidth(divElement);
assert.strictEqual(width, 300, "measured width matches set width");
const height = Plottable.Utils.DOM.elementHeight(divElement);
assert.strictEqual(height, 200, "measured height matches set height");
div.remove();
});

it("can get a div display element's size inside parent display none", () => {
const parent = TestMethods.getElementParent();
parent.attr("display", "none");

const div = TestMethods.generateDiv(300, 200);
const divElement = <Element> div.node();

const width = Plottable.Utils.DOM.elementWidth(divElement);
assert.strictEqual(width, 300, "measured width matches set width");
const height = Plottable.Utils.DOM.elementHeight(divElement);
assert.strictEqual(height, 200, "measured height matches set height");
div.remove();
});
});
});