-
-
Notifications
You must be signed in to change notification settings - Fork 981
Hotfix OSD Drag\Drop for multiline elements #1165
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good except for the stray spaces.
src/js/tabs/osd.js
Outdated
@@ -1391,17 +1391,25 @@ OSD.GUI.preview = { | |||
}, | |||
onDragStart: function(e) { | |||
var ev = e.originalEvent; | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stray space.
src/js/tabs/osd.js
Outdated
@@ -1428,16 +1441,16 @@ OSD.GUI.preview = { | |||
overflows_line = FONT.constants.SIZES.LINE - ((position % FONT.constants.SIZES.LINE) + display_item.preview.length); | |||
if (overflows_line < 0) { | |||
position += overflows_line; | |||
} | |||
|
|||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'd think I'd know better having developed python for several years!
Hmm, this improves it, but I am not sure that it is completely the way it should be. When grabbing a large element on a side, the element will jump to be centered around the mouse cursor once the grabbing has completed, which is unintuitive: I think that instead of this, the mouse cursor should stay on whatever position on the element it is on when the element is grabbed. |
@mikeller I thought I'd fixed that - are you using the standalone or chrome app - and what OS? Basically most of the code in onDragStart is working out the pixel offset so this doesn't happen. I'm using the standalone app on Windows 10 64Bit and it's working OK, I'm assuming this is an OS difference. onDragStart: function(e) {
var ev = e.originalEvent;
var display_item = OSD.data.display_items[$(ev.target).data('field').index];
var xPos = ev.currentTarget.dataset.x;
var yPos = ev.currentTarget.dataset.y;
var offsetX = 6;
var offsetY = 9;
if (display_item.preview.constructor === Array) {
var arrayElements = display_item.preview;
var limits = OSD.searchLimitsElement(arrayElements);
xPos -= limits.minX;
yPos -= limits.minY;
offsetX += (xPos) * 12;
offsetY += (yPos) * 18;
}
ev.dataTransfer.setDragImage($(this).data('field').preview_img, offsetX, offsetY);
}, |
Tried another time, to check if there was console output. This time it worked fine. No idea what was wrong the last time, but it's all good now, thanks! |
Fixes #1159
Please test...