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

Legend: fix drag movement when editable: true #487

Merged
merged 4 commits into from Apr 29, 2016
Merged

Conversation

mdtusz
Copy link
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.

// 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
Contributor

Choose a reason for hiding this comment

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

nice move.

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`.
y0,
lw,
lh;
var xf, yf, x0, y0;
Copy link
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
afterEach(destroyGraphDiv);

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

Choose a reason for hiding this comment

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

@etpinard
Copy link
Contributor

nicely done 💃 after ⚡ ing that console.log

@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants