Gitlab CSE Unil

Commit 38250c50 authored by M. Chardon's avatar M. Chardon
Browse files

correctif taille resize area verticalline annotation

parent e1bbcad8
...@@ -1642,7 +1642,7 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1642,7 +1642,7 @@ Y.extend(ANNOTATION, Y.Base, {
* @param {string} colorcartridge * @param {string} colorcartridge
* @return node * @return node
*/ */
get_div_resizearea: function (direction) { get_div_resizearea: function (direction, minwidth, minheight) {
var plane = "horizontal"; var plane = "horizontal";
if (direction === "up" || direction === "down") { if (direction === "up" || direction === "down") {
plane = "vertical"; plane = "vertical";
...@@ -1652,9 +1652,15 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1652,9 +1652,15 @@ Y.extend(ANNOTATION, Y.Base, {
+ "class='assignfeedback_editpdfplus_resize assignfeedback_editpdfplus_resize_" + plane + "' "; + "class='assignfeedback_editpdfplus_resize assignfeedback_editpdfplus_resize_" + plane + "' ";
if (plane === "horizontal") { if (plane === "horizontal") {
var intery = Math.max(this.endy - this.y, 7); var intery = Math.max(this.endy - this.y, 7);
if (minheight) {
intery = minheight;
}
div += "style='min-width:7px;min-height:" + intery + "px;' "; div += "style='min-width:7px;min-height:" + intery + "px;' ";
} else { } else {
var interx = Math.max(this.endx - this.x, 7); var interx = Math.max(this.endx - this.x, 7);
if (minwidth) {
interx = minwidth;
}
div += "style='min-height:7px;min-width:" + interx + "px;' "; div += "style='min-height:7px;min-width:" + interx + "px;' ";
} }
div += "data-direction='" + direction + "' " div += "data-direction='" + direction + "' "
...@@ -1675,13 +1681,13 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1675,13 +1681,13 @@ Y.extend(ANNOTATION, Y.Base, {
* @param {int} x left position of the resize area * @param {int} x left position of the resize area
* @param {int} y top position of the resize area * @param {int} y top position of the resize area
*/ */
push_div_resizearea: function (direction, x, y) { push_div_resizearea: function (direction, x, y, minwidth, minheight) {
var drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS); var drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
var div = this.editor.get_dialogue_element('#' + this.divcartridge + "_resize_" + direction); var div = this.editor.get_dialogue_element('#' + this.divcartridge + "_resize_" + direction);
if (div) { if (div) {
return; return;
} }
var divresize = this.get_div_resizearea(direction); var divresize = this.get_div_resizearea(direction, minwidth, minheight);
if (!divresize) { if (!divresize) {
return; return;
} }
...@@ -3873,8 +3879,8 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, { ...@@ -3873,8 +3879,8 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
* Draw empty resize area on left and right * Draw empty resize area on left and right
*/ */
draw_resizeAreas: function () { draw_resizeAreas: function () {
this.push_div_resizearea('left', this.x - 2, this.y); this.push_div_resizearea('left', this.x - this.marginDivResize, this.y);
this.push_div_resizearea('right', this.endx - 2, this.y); this.push_div_resizearea('right', this.endx - this.marginDivResize, this.y);
}, },
/** /**
* Actions when resizing a shape: * Actions when resizing a shape:
...@@ -4228,11 +4234,23 @@ ANNOTATIONVERTICALLINE.ATTRS = {}; ...@@ -4228,11 +4234,23 @@ ANNOTATIONVERTICALLINE.ATTRS = {};
Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, { Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
/** /**
* Margin to let for resize area * Margin to let for resize area on top and down
* @type Number
* @protected
*/
marginyDivResize: 2,
/**
* Margin to let for resize area on left and right
* @type Number
* @protected
*/
marginxDivResize: 7,
/**
* Min width for resize area
* @type Number * @type Number
* @protected * @protected
*/ */
marginDivResize: 2, minWidthDivResize: 15,
/** /**
* Draw a verticalline annotation * Draw a verticalline annotation
* @protected * @protected
...@@ -4412,8 +4430,8 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, { ...@@ -4412,8 +4430,8 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
* Draw empty resize area on top and down * Draw empty resize area on top and down
*/ */
draw_resizeAreas: function () { draw_resizeAreas: function () {
this.push_div_resizearea('up', this.x - 7, this.y - this.marginDivResize); this.push_div_resizearea('up', this.x - this.marginxDivResize, this.y - this.marginyDivResize, this.minWidthDivResize);
this.push_div_resizearea('down', this.x - 7, this.endy - this.marginDivResize); this.push_div_resizearea('down', this.x - this.marginxDivResize, this.endy - this.marginyDivResize, this.minWidthDivResize);
}, },
/** /**
* Actions when resizing a shape: * Actions when resizing a shape:
...@@ -4449,14 +4467,14 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, { ...@@ -4449,14 +4467,14 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
shape.moveTo(this.x, Math.min(newpointy, this.endy - this.minresizewidth)); shape.moveTo(this.x, Math.min(newpointy, this.endy - this.minresizewidth));
shape.lineTo(this.x, this.endy); shape.lineTo(this.x, this.endy);
shape.end(); shape.end();
divresize.setY(this.endy - height + decalage - this.marginDivResize); divresize.setY(this.endy - height + decalage - this.marginyDivResize);
} else if (direction === 'down') { } else if (direction === 'down') {
height = Math.max(newpointy - this.y, this.minresizewidth); height = Math.max(newpointy - this.y, this.minresizewidth);
shape.clear(); shape.clear();
shape.moveTo(this.x, this.y); shape.moveTo(this.x, this.y);
shape.lineTo(this.x, this.y + height); shape.lineTo(this.x, this.y + height);
shape.end(); shape.end();
divresize.setY(this.y + height + decalage - this.marginDivResize); divresize.setY(this.y + height + decalage - this.marginyDivResize);
} }
}, },
/** /**
......
...@@ -1642,7 +1642,7 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1642,7 +1642,7 @@ Y.extend(ANNOTATION, Y.Base, {
* @param {string} colorcartridge * @param {string} colorcartridge
* @return node * @return node
*/ */
get_div_resizearea: function (direction) { get_div_resizearea: function (direction, minwidth, minheight) {
var plane = "horizontal"; var plane = "horizontal";
if (direction === "up" || direction === "down") { if (direction === "up" || direction === "down") {
plane = "vertical"; plane = "vertical";
...@@ -1652,9 +1652,15 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1652,9 +1652,15 @@ Y.extend(ANNOTATION, Y.Base, {
+ "class='assignfeedback_editpdfplus_resize assignfeedback_editpdfplus_resize_" + plane + "' "; + "class='assignfeedback_editpdfplus_resize assignfeedback_editpdfplus_resize_" + plane + "' ";
if (plane === "horizontal") { if (plane === "horizontal") {
var intery = Math.max(this.endy - this.y, 7); var intery = Math.max(this.endy - this.y, 7);
if (minheight) {
intery = minheight;
}
div += "style='min-width:7px;min-height:" + intery + "px;' "; div += "style='min-width:7px;min-height:" + intery + "px;' ";
} else { } else {
var interx = Math.max(this.endx - this.x, 7); var interx = Math.max(this.endx - this.x, 7);
if (minwidth) {
interx = minwidth;
}
div += "style='min-height:7px;min-width:" + interx + "px;' "; div += "style='min-height:7px;min-width:" + interx + "px;' ";
} }
div += "data-direction='" + direction + "' " div += "data-direction='" + direction + "' "
...@@ -1675,13 +1681,13 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1675,13 +1681,13 @@ Y.extend(ANNOTATION, Y.Base, {
* @param {int} x left position of the resize area * @param {int} x left position of the resize area
* @param {int} y top position of the resize area * @param {int} y top position of the resize area
*/ */
push_div_resizearea: function (direction, x, y) { push_div_resizearea: function (direction, x, y, minwidth, minheight) {
var drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS); var drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
var div = this.editor.get_dialogue_element('#' + this.divcartridge + "_resize_" + direction); var div = this.editor.get_dialogue_element('#' + this.divcartridge + "_resize_" + direction);
if (div) { if (div) {
return; return;
} }
var divresize = this.get_div_resizearea(direction); var divresize = this.get_div_resizearea(direction, minwidth, minheight);
if (!divresize) { if (!divresize) {
return; return;
} }
...@@ -3873,8 +3879,8 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, { ...@@ -3873,8 +3879,8 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
* Draw empty resize area on left and right * Draw empty resize area on left and right
*/ */
draw_resizeAreas: function () { draw_resizeAreas: function () {
this.push_div_resizearea('left', this.x - 2, this.y); this.push_div_resizearea('left', this.x - this.marginDivResize, this.y);
this.push_div_resizearea('right', this.endx - 2, this.y); this.push_div_resizearea('right', this.endx - this.marginDivResize, this.y);
}, },
/** /**
* Actions when resizing a shape: * Actions when resizing a shape:
...@@ -4228,11 +4234,23 @@ ANNOTATIONVERTICALLINE.ATTRS = {}; ...@@ -4228,11 +4234,23 @@ ANNOTATIONVERTICALLINE.ATTRS = {};
Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, { Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
/** /**
* Margin to let for resize area * Margin to let for resize area on top and down
* @type Number
* @protected
*/
marginyDivResize: 2,
/**
* Margin to let for resize area on left and right
* @type Number
* @protected
*/
marginxDivResize: 7,
/**
* Min width for resize area
* @type Number * @type Number
* @protected * @protected
*/ */
marginDivResize: 2, minWidthDivResize: 15,
/** /**
* Draw a verticalline annotation * Draw a verticalline annotation
* @protected * @protected
...@@ -4412,8 +4430,8 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, { ...@@ -4412,8 +4430,8 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
* Draw empty resize area on top and down * Draw empty resize area on top and down
*/ */
draw_resizeAreas: function () { draw_resizeAreas: function () {
this.push_div_resizearea('up', this.x - 7, this.y - this.marginDivResize); this.push_div_resizearea('up', this.x - this.marginxDivResize, this.y - this.marginyDivResize, this.minWidthDivResize);
this.push_div_resizearea('down', this.x - 7, this.endy - this.marginDivResize); this.push_div_resizearea('down', this.x - this.marginxDivResize, this.endy - this.marginyDivResize, this.minWidthDivResize);
}, },
/** /**
* Actions when resizing a shape: * Actions when resizing a shape:
...@@ -4449,14 +4467,14 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, { ...@@ -4449,14 +4467,14 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
shape.moveTo(this.x, Math.min(newpointy, this.endy - this.minresizewidth)); shape.moveTo(this.x, Math.min(newpointy, this.endy - this.minresizewidth));
shape.lineTo(this.x, this.endy); shape.lineTo(this.x, this.endy);
shape.end(); shape.end();
divresize.setY(this.endy - height + decalage - this.marginDivResize); divresize.setY(this.endy - height + decalage - this.marginyDivResize);
} else if (direction === 'down') { } else if (direction === 'down') {
height = Math.max(newpointy - this.y, this.minresizewidth); height = Math.max(newpointy - this.y, this.minresizewidth);
shape.clear(); shape.clear();
shape.moveTo(this.x, this.y); shape.moveTo(this.x, this.y);
shape.lineTo(this.x, this.y + height); shape.lineTo(this.x, this.y + height);
shape.end(); shape.end();
divresize.setY(this.y + height + decalage - this.marginDivResize); divresize.setY(this.y + height + decalage - this.marginyDivResize);
} }
}, },
/** /**
......
...@@ -1110,7 +1110,7 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1110,7 +1110,7 @@ Y.extend(ANNOTATION, Y.Base, {
* @param {string} colorcartridge * @param {string} colorcartridge
* @return node * @return node
*/ */
get_div_resizearea: function (direction) { get_div_resizearea: function (direction, minwidth, minheight) {
var plane = "horizontal"; var plane = "horizontal";
if (direction === "up" || direction === "down") { if (direction === "up" || direction === "down") {
plane = "vertical"; plane = "vertical";
...@@ -1120,9 +1120,15 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1120,9 +1120,15 @@ Y.extend(ANNOTATION, Y.Base, {
+ "class='assignfeedback_editpdfplus_resize assignfeedback_editpdfplus_resize_" + plane + "' "; + "class='assignfeedback_editpdfplus_resize assignfeedback_editpdfplus_resize_" + plane + "' ";
if (plane === "horizontal") { if (plane === "horizontal") {
var intery = Math.max(this.endy - this.y, 7); var intery = Math.max(this.endy - this.y, 7);
if (minheight) {
intery = minheight;
}
div += "style='min-width:7px;min-height:" + intery + "px;' "; div += "style='min-width:7px;min-height:" + intery + "px;' ";
} else { } else {
var interx = Math.max(this.endx - this.x, 7); var interx = Math.max(this.endx - this.x, 7);
if (minwidth) {
interx = minwidth;
}
div += "style='min-height:7px;min-width:" + interx + "px;' "; div += "style='min-height:7px;min-width:" + interx + "px;' ";
} }
div += "data-direction='" + direction + "' " div += "data-direction='" + direction + "' "
...@@ -1143,13 +1149,13 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1143,13 +1149,13 @@ Y.extend(ANNOTATION, Y.Base, {
* @param {int} x left position of the resize area * @param {int} x left position of the resize area
* @param {int} y top position of the resize area * @param {int} y top position of the resize area
*/ */
push_div_resizearea: function (direction, x, y) { push_div_resizearea: function (direction, x, y, minwidth, minheight) {
var drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS); var drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
var div = this.editor.get_dialogue_element('#' + this.divcartridge + "_resize_" + direction); var div = this.editor.get_dialogue_element('#' + this.divcartridge + "_resize_" + direction);
if (div) { if (div) {
return; return;
} }
var divresize = this.get_div_resizearea(direction); var divresize = this.get_div_resizearea(direction, minwidth, minheight);
if (!divresize) { if (!divresize) {
return; return;
} }
......
...@@ -391,8 +391,8 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, { ...@@ -391,8 +391,8 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
* Draw empty resize area on left and right * Draw empty resize area on left and right
*/ */
draw_resizeAreas: function () { draw_resizeAreas: function () {
this.push_div_resizearea('left', this.x - 2, this.y); this.push_div_resizearea('left', this.x - this.marginDivResize, this.y);
this.push_div_resizearea('right', this.endx - 2, this.y); this.push_div_resizearea('right', this.endx - this.marginDivResize, this.y);
}, },
/** /**
* Actions when resizing a shape: * Actions when resizing a shape:
......
...@@ -39,11 +39,23 @@ ANNOTATIONVERTICALLINE.ATTRS = {}; ...@@ -39,11 +39,23 @@ ANNOTATIONVERTICALLINE.ATTRS = {};
Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, { Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
/** /**
* Margin to let for resize area * Margin to let for resize area on top and down
* @type Number * @type Number
* @protected * @protected
*/ */
marginDivResize: 2, marginyDivResize: 2,
/**
* Margin to let for resize area on left and right
* @type Number
* @protected
*/
marginxDivResize: 7,
/**
* Min width for resize area
* @type Number
* @protected
*/
minWidthDivResize: 15,
/** /**
* Draw a verticalline annotation * Draw a verticalline annotation
* @protected * @protected
...@@ -223,8 +235,8 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, { ...@@ -223,8 +235,8 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
* Draw empty resize area on top and down * Draw empty resize area on top and down
*/ */
draw_resizeAreas: function () { draw_resizeAreas: function () {
this.push_div_resizearea('up', this.x - 7, this.y - this.marginDivResize); this.push_div_resizearea('up', this.x - this.marginxDivResize, this.y - this.marginyDivResize, this.minWidthDivResize);
this.push_div_resizearea('down', this.x - 7, this.endy - this.marginDivResize); this.push_div_resizearea('down', this.x - this.marginxDivResize, this.endy - this.marginyDivResize, this.minWidthDivResize);
}, },
/** /**
* Actions when resizing a shape: * Actions when resizing a shape:
...@@ -260,14 +272,14 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, { ...@@ -260,14 +272,14 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
shape.moveTo(this.x, Math.min(newpointy, this.endy - this.minresizewidth)); shape.moveTo(this.x, Math.min(newpointy, this.endy - this.minresizewidth));
shape.lineTo(this.x, this.endy); shape.lineTo(this.x, this.endy);
shape.end(); shape.end();
divresize.setY(this.endy - height + decalage - this.marginDivResize); divresize.setY(this.endy - height + decalage - this.marginyDivResize);
} else if (direction === 'down') { } else if (direction === 'down') {
height = Math.max(newpointy - this.y, this.minresizewidth); height = Math.max(newpointy - this.y, this.minresizewidth);
shape.clear(); shape.clear();
shape.moveTo(this.x, this.y); shape.moveTo(this.x, this.y);
shape.lineTo(this.x, this.y + height); shape.lineTo(this.x, this.y + height);
shape.end(); shape.end();
divresize.setY(this.y + height + decalage - this.marginDivResize); divresize.setY(this.y + height + decalage - this.marginyDivResize);
} }
}, },
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment