Gitlab CSE Unil

Commit 4af7dbd0 authored by M. Chardon's avatar M. Chardon
Browse files

correction bug sauver après clickoutside

parent 2e7ee676
...@@ -1436,8 +1436,8 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1436,8 +1436,8 @@ Y.extend(ANNOTATION, Y.Base, {
this.oldx = point.x; this.oldx = point.x;
this.oldy = point.y; this.oldy = point.y;
/*var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge + "_cartridge"); /*var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge + "_cartridge");
divcartridge.on('mousemove', this.move_cartridge_continue, this); divcartridge.on('mousemove', this.move_cartridge_continue, this);
divcartridge.on('mouseup', this.move_cartridge_stop, this);*/ divcartridge.on('mouseup', this.move_cartridge_stop, this);*/
canvas.on('mousemove', this.move_cartridge_continue, this); canvas.on('mousemove', this.move_cartridge_continue, this);
canvas.on('mouseup', this.move_cartridge_stop, this); canvas.on('mouseup', this.move_cartridge_stop, this);
}, },
...@@ -1469,8 +1469,8 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1469,8 +1469,8 @@ Y.extend(ANNOTATION, Y.Base, {
e.preventDefault(); e.preventDefault();
/*var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge + "_cartridge"); /*var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge + "_cartridge");
divcartridge.detach('mousemove', this.move_cartridge_continue, this); divcartridge.detach('mousemove', this.move_cartridge_continue, this);
divcartridge.detach('mouseup', this.move_cartridge_stop, this);*/ divcartridge.detach('mouseup', this.move_cartridge_stop, this);*/
var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS); var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
//var drawingcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS); //var drawingcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
canvas.detach('mousemove', this.move_cartridge_continue, this); canvas.detach('mousemove', this.move_cartridge_continue, this);
...@@ -1478,7 +1478,7 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1478,7 +1478,7 @@ Y.extend(ANNOTATION, Y.Base, {
//var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS), //var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
var clientpoint = new M.assignfeedback_editpdfplus.point(e.clientX + canvas.get('docScrollX'), var clientpoint = new M.assignfeedback_editpdfplus.point(e.clientX + canvas.get('docScrollX'),
e.clientY + canvas.get('docScrollY')), e.clientY + canvas.get('docScrollY')),
point = this.editor.get_canvas_coordinates(clientpoint); point = this.editor.get_canvas_coordinates(clientpoint);
var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY(); var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY();
...@@ -1581,7 +1581,7 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1581,7 +1581,7 @@ Y.extend(ANNOTATION, Y.Base, {
input.set('focus', 'on'); input.set('focus', 'on');
} }
this.disabled_canvas_event(); this.disabled_canvas_event();
divprincipale.on('clickoutside', this.save_annot, this, 'clickoutside'); divprincipale.on('clickoutside', this.save_annot_clickout, this, 'clickoutside');
} }
}, },
/** /**
...@@ -1596,6 +1596,12 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1596,6 +1596,12 @@ Y.extend(ANNOTATION, Y.Base, {
} }
this.save_annot(unputtext); this.save_annot(unputtext);
}, },
save_annot_clickout: function (e, clickType) {
if (!(clickType === 'clickoutside' && this.editor.currentannotation === this)) {
this.save_annot(null);
}
return;
},
/** /**
* save text annotation * save text annotation
* @param {string} result * @param {string} result
...@@ -1694,8 +1700,8 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1694,8 +1700,8 @@ Y.extend(ANNOTATION, Y.Base, {
} }
if (divprincipale) { if (divprincipale) {
divprincipale.setStyle('z-index', 1); divprincipale.setStyle('z-index', 1);
divprincipale.detach();
if (this.editor.get('readonly')) { if (this.editor.get('readonly')) {
divprincipale.detach();
divprincipale.on('click', this.view_annot, this, 'click'); divprincipale.on('click', this.view_annot, this, 'click');
} }
} }
......
...@@ -1436,8 +1436,8 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1436,8 +1436,8 @@ Y.extend(ANNOTATION, Y.Base, {
this.oldx = point.x; this.oldx = point.x;
this.oldy = point.y; this.oldy = point.y;
/*var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge + "_cartridge"); /*var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge + "_cartridge");
divcartridge.on('mousemove', this.move_cartridge_continue, this); divcartridge.on('mousemove', this.move_cartridge_continue, this);
divcartridge.on('mouseup', this.move_cartridge_stop, this);*/ divcartridge.on('mouseup', this.move_cartridge_stop, this);*/
canvas.on('mousemove', this.move_cartridge_continue, this); canvas.on('mousemove', this.move_cartridge_continue, this);
canvas.on('mouseup', this.move_cartridge_stop, this); canvas.on('mouseup', this.move_cartridge_stop, this);
}, },
...@@ -1469,8 +1469,8 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1469,8 +1469,8 @@ Y.extend(ANNOTATION, Y.Base, {
e.preventDefault(); e.preventDefault();
/*var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge + "_cartridge"); /*var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge + "_cartridge");
divcartridge.detach('mousemove', this.move_cartridge_continue, this); divcartridge.detach('mousemove', this.move_cartridge_continue, this);
divcartridge.detach('mouseup', this.move_cartridge_stop, this);*/ divcartridge.detach('mouseup', this.move_cartridge_stop, this);*/
var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS); var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
//var drawingcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS); //var drawingcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
canvas.detach('mousemove', this.move_cartridge_continue, this); canvas.detach('mousemove', this.move_cartridge_continue, this);
...@@ -1478,7 +1478,7 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1478,7 +1478,7 @@ Y.extend(ANNOTATION, Y.Base, {
//var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS), //var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
var clientpoint = new M.assignfeedback_editpdfplus.point(e.clientX + canvas.get('docScrollX'), var clientpoint = new M.assignfeedback_editpdfplus.point(e.clientX + canvas.get('docScrollX'),
e.clientY + canvas.get('docScrollY')), e.clientY + canvas.get('docScrollY')),
point = this.editor.get_canvas_coordinates(clientpoint); point = this.editor.get_canvas_coordinates(clientpoint);
var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY(); var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY();
...@@ -1581,7 +1581,7 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1581,7 +1581,7 @@ Y.extend(ANNOTATION, Y.Base, {
input.set('focus', 'on'); input.set('focus', 'on');
} }
this.disabled_canvas_event(); this.disabled_canvas_event();
divprincipale.on('clickoutside', this.save_annot, this, 'clickoutside'); divprincipale.on('clickoutside', this.save_annot_clickout, this, 'clickoutside');
} }
}, },
/** /**
...@@ -1596,6 +1596,12 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1596,6 +1596,12 @@ Y.extend(ANNOTATION, Y.Base, {
} }
this.save_annot(unputtext); this.save_annot(unputtext);
}, },
save_annot_clickout: function (e, clickType) {
if (!(clickType === 'clickoutside' && this.editor.currentannotation === this)) {
this.save_annot(null);
}
return;
},
/** /**
* save text annotation * save text annotation
* @param {string} result * @param {string} result
...@@ -1694,8 +1700,8 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1694,8 +1700,8 @@ Y.extend(ANNOTATION, Y.Base, {
} }
if (divprincipale) { if (divprincipale) {
divprincipale.setStyle('z-index', 1); divprincipale.setStyle('z-index', 1);
divprincipale.detach();
if (this.editor.get('readonly')) { if (this.editor.get('readonly')) {
divprincipale.detach();
divprincipale.on('click', this.view_annot, this, 'click'); divprincipale.on('click', this.view_annot, this, 'click');
} }
} }
......
...@@ -888,8 +888,8 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -888,8 +888,8 @@ Y.extend(ANNOTATION, Y.Base, {
this.oldx = point.x; this.oldx = point.x;
this.oldy = point.y; this.oldy = point.y;
/*var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge + "_cartridge"); /*var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge + "_cartridge");
divcartridge.on('mousemove', this.move_cartridge_continue, this); divcartridge.on('mousemove', this.move_cartridge_continue, this);
divcartridge.on('mouseup', this.move_cartridge_stop, this);*/ divcartridge.on('mouseup', this.move_cartridge_stop, this);*/
canvas.on('mousemove', this.move_cartridge_continue, this); canvas.on('mousemove', this.move_cartridge_continue, this);
canvas.on('mouseup', this.move_cartridge_stop, this); canvas.on('mouseup', this.move_cartridge_stop, this);
}, },
...@@ -921,8 +921,8 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -921,8 +921,8 @@ Y.extend(ANNOTATION, Y.Base, {
e.preventDefault(); e.preventDefault();
/*var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge + "_cartridge"); /*var divcartridge = this.editor.get_dialogue_element('#' + this.divcartridge + "_cartridge");
divcartridge.detach('mousemove', this.move_cartridge_continue, this); divcartridge.detach('mousemove', this.move_cartridge_continue, this);
divcartridge.detach('mouseup', this.move_cartridge_stop, this);*/ divcartridge.detach('mouseup', this.move_cartridge_stop, this);*/
var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS); var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
//var drawingcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS); //var drawingcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
canvas.detach('mousemove', this.move_cartridge_continue, this); canvas.detach('mousemove', this.move_cartridge_continue, this);
...@@ -930,7 +930,7 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -930,7 +930,7 @@ Y.extend(ANNOTATION, Y.Base, {
//var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS), //var canvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
var clientpoint = new M.assignfeedback_editpdfplus.point(e.clientX + canvas.get('docScrollX'), var clientpoint = new M.assignfeedback_editpdfplus.point(e.clientX + canvas.get('docScrollX'),
e.clientY + canvas.get('docScrollY')), e.clientY + canvas.get('docScrollY')),
point = this.editor.get_canvas_coordinates(clientpoint); point = this.editor.get_canvas_coordinates(clientpoint);
var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY(); var offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY();
...@@ -1033,7 +1033,7 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1033,7 +1033,7 @@ Y.extend(ANNOTATION, Y.Base, {
input.set('focus', 'on'); input.set('focus', 'on');
} }
this.disabled_canvas_event(); this.disabled_canvas_event();
divprincipale.on('clickoutside', this.save_annot, this, 'clickoutside'); divprincipale.on('clickoutside', this.save_annot_clickout, this, 'clickoutside');
} }
}, },
/** /**
...@@ -1048,6 +1048,12 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1048,6 +1048,12 @@ Y.extend(ANNOTATION, Y.Base, {
} }
this.save_annot(unputtext); this.save_annot(unputtext);
}, },
save_annot_clickout: function (e, clickType) {
if (!(clickType === 'clickoutside' && this.editor.currentannotation === this)) {
this.save_annot(null);
}
return;
},
/** /**
* save text annotation * save text annotation
* @param {string} result * @param {string} result
...@@ -1146,8 +1152,8 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1146,8 +1152,8 @@ Y.extend(ANNOTATION, Y.Base, {
} }
if (divprincipale) { if (divprincipale) {
divprincipale.setStyle('z-index', 1); divprincipale.setStyle('z-index', 1);
divprincipale.detach();
if (this.editor.get('readonly')) { if (this.editor.get('readonly')) {
divprincipale.detach();
divprincipale.on('click', this.view_annot, this, 'click'); divprincipale.on('click', this.view_annot, this, 'click');
} }
} }
......
Supports Markdown
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