mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-42351 EditPDF: Fix jiggling of relatively positioned elements
When calling setX/setY with YUI - YUI takes into account the position style of the element. If none is set it assumes position relative. Position relative is bad because relatively positioned elements still take up space in the page, and all the elements after that node are positioned, taking into account the size of that node. So when a node is resized or deleted, all nodes after that one in the list of drawables are affected. The magic fix - is just to set position: absolute on the drawables before calling setX/setY.
This commit is contained in:
parent
d147e833c0
commit
d79d1bd8fa
@ -1410,6 +1410,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
|
||||
position = this.editor.get_window_coordinates(new M.assignfeedback_editpdf.point(this.x, this.y));
|
||||
node = Y.Node.create('<div/>');
|
||||
node.setStyles({
|
||||
'position': 'absolute',
|
||||
'display': 'inline-block',
|
||||
'backgroundImage': 'url(' + this.editor.get_stamp_image_url(this.path) + ')',
|
||||
'width': (this.endx - this.x),
|
||||
@ -1452,6 +1453,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
|
||||
|
||||
node = Y.Node.create('<div/>');
|
||||
node.setStyles({
|
||||
'position': 'absolute',
|
||||
'display': 'inline-block',
|
||||
'backgroundImage': 'url(' + this.editor.get_stamp_image_url(edit.stamp) + ')',
|
||||
'width': bounds.width,
|
||||
@ -2308,6 +2310,7 @@ COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
|
||||
});
|
||||
|
||||
drawingregion.append(container);
|
||||
container.setStyle('position', 'absolute');
|
||||
container.setX(position.x);
|
||||
container.setY(position.y);
|
||||
drawable.nodes.push(container);
|
||||
|
File diff suppressed because one or more lines are too long
@ -1410,6 +1410,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
|
||||
position = this.editor.get_window_coordinates(new M.assignfeedback_editpdf.point(this.x, this.y));
|
||||
node = Y.Node.create('<div/>');
|
||||
node.setStyles({
|
||||
'position': 'absolute',
|
||||
'display': 'inline-block',
|
||||
'backgroundImage': 'url(' + this.editor.get_stamp_image_url(this.path) + ')',
|
||||
'width': (this.endx - this.x),
|
||||
@ -1452,6 +1453,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
|
||||
|
||||
node = Y.Node.create('<div/>');
|
||||
node.setStyles({
|
||||
'position': 'absolute',
|
||||
'display': 'inline-block',
|
||||
'backgroundImage': 'url(' + this.editor.get_stamp_image_url(edit.stamp) + ')',
|
||||
'width': bounds.width,
|
||||
@ -2308,6 +2310,7 @@ COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
|
||||
});
|
||||
|
||||
drawingregion.append(container);
|
||||
container.setStyle('position', 'absolute');
|
||||
container.setX(position.x);
|
||||
container.setY(position.y);
|
||||
drawable.nodes.push(container);
|
||||
|
@ -44,6 +44,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
|
||||
position = this.editor.get_window_coordinates(new M.assignfeedback_editpdf.point(this.x, this.y));
|
||||
node = Y.Node.create('<div/>');
|
||||
node.setStyles({
|
||||
'position': 'absolute',
|
||||
'display': 'inline-block',
|
||||
'backgroundImage': 'url(' + this.editor.get_stamp_image_url(this.path) + ')',
|
||||
'width': (this.endx - this.x),
|
||||
@ -86,6 +87,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
|
||||
|
||||
node = Y.Node.create('<div/>');
|
||||
node.setStyles({
|
||||
'position': 'absolute',
|
||||
'display': 'inline-block',
|
||||
'backgroundImage': 'url(' + this.editor.get_stamp_image_url(edit.stamp) + ')',
|
||||
'width': bounds.width,
|
||||
|
@ -189,6 +189,7 @@ COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
|
||||
});
|
||||
|
||||
drawingregion.append(container);
|
||||
container.setStyle('position', 'absolute');
|
||||
container.setX(position.x);
|
||||
container.setY(position.y);
|
||||
drawable.nodes.push(container);
|
||||
|
Loading…
x
Reference in New Issue
Block a user