Skip to content

Legend: fix drag movement when editable: true#487

Merged
mdtusz merged 4 commits into
masterfrom
editable-drag-bugs
Apr 29, 2016
Merged

Legend: fix drag movement when editable: true#487
mdtusz merged 4 commits into
masterfrom
editable-drag-bugs

Conversation

@mdtusz
Copy link
Copy Markdown
Contributor

@mdtusz mdtusz commented Apr 28, 2016

Legends were changed to use a <g>, so the drag function now needs to use translate for positioning.

The cursor classes don't seem to work when in the middle of a click-drag, so instead we add the move cursor to the entire legend element when editable.

@mdtusz mdtusz force-pushed the editable-drag-bugs branch from 430986b to ab751c2 Compare April 28, 2016 14:49
@mdtusz mdtusz added bug something broken status: reviewable labels Apr 28, 2016
Comment thread src/components/legend/draw.js Outdated
// regex pattern for 'translate(123.45px, 543.21px)'
var re = /(.*\()(\d*\.?\d*)([^\d]*)(\d*\.?\d*)([^\d]*)/,
transform = legend.attr('transform')
.replace(re, function(match, p1, p2, p3, p4) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice move.

mdtusz added 3 commits April 28, 2016 16:17
The legend container is now a `<g>` and position must be set using `translate`
instead of `x` and `y` coordinates. The cursor is set to always be `move`.
@mdtusz mdtusz force-pushed the editable-drag-bugs branch from ab751c2 to 7269c33 Compare April 28, 2016 21:56
y0,
lw,
lh;
var xf, yf, x0, y0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mdtusz if you feel adventurous, maybe you add our first editable: true jasmine test ...

@mdtusz mdtusz force-pushed the editable-drag-bugs branch 2 times, most recently from 0c3fc59 to 7f3392f Compare April 29, 2016 20:53
Comment thread test/jasmine/tests/config_test.js Outdated
afterEach(destroyGraphDiv);

function checkIfEditable(elClass, text) {
console.log('checking editable', elClass);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@etpinard
Copy link
Copy Markdown
Contributor

nicely done 💃 after ⚡ ing that console.log

@mdtusz mdtusz force-pushed the editable-drag-bugs branch from 7f3392f to ee0b452 Compare April 29, 2016 21:10
@mdtusz mdtusz merged commit c662738 into master Apr 29, 2016
@mdtusz mdtusz deleted the editable-drag-bugs branch April 29, 2016 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug something broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants