mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 09:56:38 +02:00
MDL-42366 assignfeedback_editpdf: Improve meaningfulness of cursor image
Various improvements to make the cursor image more accurately reflect the currently selected editing tool or action: * Replace crosshair with default cursor for read-only student view * Use currently selected stamp image as cursor when using stamp tool * Use text cursor for text higlighter tool and improve its accuracy * Use default cursor for select tool (as indicated by its button icon)
This commit is contained in:
parent
6b2e04676a
commit
166ac972c3
6 changed files with 80 additions and 32 deletions
|
@ -10,7 +10,6 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
min-width: 817px;
|
min-width: 817px;
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
cursor: crosshair;
|
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-color: #ccc;
|
background-color: #ccc;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
|
@ -22,14 +21,6 @@
|
||||||
position: inherit;
|
position: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.assignfeedback_editpdf_widget .drawingregion[data-currenttool=drag] .drawingcanvas {
|
|
||||||
cursor: move;
|
|
||||||
}
|
|
||||||
|
|
||||||
.assignfeedback_editpdf_widget .drawingregion[data-currenttool=select] .drawingcanvas {
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
.assignfeedback_editpdf_widget .drawingregion[data-currenttool=select] .commentdrawable textarea,
|
.assignfeedback_editpdf_widget .drawingregion[data-currenttool=select] .commentdrawable textarea,
|
||||||
.assignfeedback_editpdf_widget .drawingregion[data-currenttool=select] .commentdrawable svg {
|
.assignfeedback_editpdf_widget .drawingregion[data-currenttool=select] .commentdrawable svg {
|
||||||
cursor: move;
|
cursor: move;
|
||||||
|
|
|
@ -1478,13 +1478,13 @@ Y.extend(ANNOTATIONHIGHLIGHT, M.assignfeedback_editpdf.annotation, {
|
||||||
shape = this.editor.graphic.addShape({
|
shape = this.editor.graphic.addShape({
|
||||||
type: Y.Rect,
|
type: Y.Rect,
|
||||||
width: bounds.width,
|
width: bounds.width,
|
||||||
height: 16,
|
height: 20,
|
||||||
stroke: false,
|
stroke: false,
|
||||||
fill: {
|
fill: {
|
||||||
color: highlightcolour
|
color: highlightcolour
|
||||||
},
|
},
|
||||||
x: bounds.x,
|
x: bounds.x,
|
||||||
y: edit.start.y
|
y: edit.start.y - 10
|
||||||
});
|
});
|
||||||
|
|
||||||
drawable.shapes.push(shape);
|
drawable.shapes.push(shape);
|
||||||
|
@ -1507,9 +1507,9 @@ Y.extend(ANNOTATIONHIGHLIGHT, M.assignfeedback_editpdf.annotation, {
|
||||||
this.gradeid = this.editor.get('gradeid');
|
this.gradeid = this.editor.get('gradeid');
|
||||||
this.pageno = this.editor.currentpage;
|
this.pageno = this.editor.currentpage;
|
||||||
this.x = bounds.x;
|
this.x = bounds.x;
|
||||||
this.y = edit.start.y;
|
this.y = edit.start.y - 10;
|
||||||
this.endx = bounds.x + bounds.width;
|
this.endx = bounds.x + bounds.width;
|
||||||
this.endy = edit.start.y + 16;
|
this.endy = edit.start.y + 10;
|
||||||
this.colour = edit.annotationcolour;
|
this.colour = edit.annotationcolour;
|
||||||
this.page = '';
|
this.page = '';
|
||||||
|
|
||||||
|
@ -3539,7 +3539,7 @@ EDITOR.prototype = {
|
||||||
* @method refresh_button_state
|
* @method refresh_button_state
|
||||||
*/
|
*/
|
||||||
refresh_button_state: function() {
|
refresh_button_state: function() {
|
||||||
var button, currenttoolnode, imgurl, drawingregion;
|
var button, currenttoolnode, imgurl, drawingregion, stampimgurl, drawingcanvas;
|
||||||
|
|
||||||
// Initalise the colour buttons.
|
// Initalise the colour buttons.
|
||||||
button = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
|
button = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
|
||||||
|
@ -3564,9 +3564,28 @@ EDITOR.prototype = {
|
||||||
drawingregion.setAttribute('data-currenttool', this.currentedit.tool);
|
drawingregion.setAttribute('data-currenttool', this.currentedit.tool);
|
||||||
|
|
||||||
button = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
|
button = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
|
||||||
button.one('img').setAttrs({'src': this.get_stamp_image_url(this.currentedit.stamp),
|
stampimgurl = this.get_stamp_image_url(this.currentedit.stamp);
|
||||||
|
button.one('img').setAttrs({'src': stampimgurl,
|
||||||
'height': '16',
|
'height': '16',
|
||||||
'width': '16'});
|
'width': '16'});
|
||||||
|
|
||||||
|
drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
|
||||||
|
switch (this.currentedit.tool) {
|
||||||
|
case 'drag':
|
||||||
|
drawingcanvas.setStyle('cursor', 'move');
|
||||||
|
break;
|
||||||
|
case 'highlight':
|
||||||
|
drawingcanvas.setStyle('cursor', 'text');
|
||||||
|
break;
|
||||||
|
case 'select':
|
||||||
|
drawingcanvas.setStyle('cursor', 'default');
|
||||||
|
break;
|
||||||
|
case 'stamp':
|
||||||
|
drawingcanvas.setStyle('cursor', 'url(' + stampimgurl + '), crosshair');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
drawingcanvas.setStyle('cursor', 'crosshair');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1478,13 +1478,13 @@ Y.extend(ANNOTATIONHIGHLIGHT, M.assignfeedback_editpdf.annotation, {
|
||||||
shape = this.editor.graphic.addShape({
|
shape = this.editor.graphic.addShape({
|
||||||
type: Y.Rect,
|
type: Y.Rect,
|
||||||
width: bounds.width,
|
width: bounds.width,
|
||||||
height: 16,
|
height: 20,
|
||||||
stroke: false,
|
stroke: false,
|
||||||
fill: {
|
fill: {
|
||||||
color: highlightcolour
|
color: highlightcolour
|
||||||
},
|
},
|
||||||
x: bounds.x,
|
x: bounds.x,
|
||||||
y: edit.start.y
|
y: edit.start.y - 10
|
||||||
});
|
});
|
||||||
|
|
||||||
drawable.shapes.push(shape);
|
drawable.shapes.push(shape);
|
||||||
|
@ -1507,9 +1507,9 @@ Y.extend(ANNOTATIONHIGHLIGHT, M.assignfeedback_editpdf.annotation, {
|
||||||
this.gradeid = this.editor.get('gradeid');
|
this.gradeid = this.editor.get('gradeid');
|
||||||
this.pageno = this.editor.currentpage;
|
this.pageno = this.editor.currentpage;
|
||||||
this.x = bounds.x;
|
this.x = bounds.x;
|
||||||
this.y = edit.start.y;
|
this.y = edit.start.y - 10;
|
||||||
this.endx = bounds.x + bounds.width;
|
this.endx = bounds.x + bounds.width;
|
||||||
this.endy = edit.start.y + 16;
|
this.endy = edit.start.y + 10;
|
||||||
this.colour = edit.annotationcolour;
|
this.colour = edit.annotationcolour;
|
||||||
this.page = '';
|
this.page = '';
|
||||||
|
|
||||||
|
@ -3539,7 +3539,7 @@ EDITOR.prototype = {
|
||||||
* @method refresh_button_state
|
* @method refresh_button_state
|
||||||
*/
|
*/
|
||||||
refresh_button_state: function() {
|
refresh_button_state: function() {
|
||||||
var button, currenttoolnode, imgurl, drawingregion;
|
var button, currenttoolnode, imgurl, drawingregion, stampimgurl, drawingcanvas;
|
||||||
|
|
||||||
// Initalise the colour buttons.
|
// Initalise the colour buttons.
|
||||||
button = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
|
button = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
|
||||||
|
@ -3564,9 +3564,28 @@ EDITOR.prototype = {
|
||||||
drawingregion.setAttribute('data-currenttool', this.currentedit.tool);
|
drawingregion.setAttribute('data-currenttool', this.currentedit.tool);
|
||||||
|
|
||||||
button = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
|
button = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
|
||||||
button.one('img').setAttrs({'src': this.get_stamp_image_url(this.currentedit.stamp),
|
stampimgurl = this.get_stamp_image_url(this.currentedit.stamp);
|
||||||
|
button.one('img').setAttrs({'src': stampimgurl,
|
||||||
'height': '16',
|
'height': '16',
|
||||||
'width': '16'});
|
'width': '16'});
|
||||||
|
|
||||||
|
drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
|
||||||
|
switch (this.currentedit.tool) {
|
||||||
|
case 'drag':
|
||||||
|
drawingcanvas.setStyle('cursor', 'move');
|
||||||
|
break;
|
||||||
|
case 'highlight':
|
||||||
|
drawingcanvas.setStyle('cursor', 'text');
|
||||||
|
break;
|
||||||
|
case 'select':
|
||||||
|
drawingcanvas.setStyle('cursor', 'default');
|
||||||
|
break;
|
||||||
|
case 'stamp':
|
||||||
|
drawingcanvas.setStyle('cursor', 'url(' + stampimgurl + '), crosshair');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
drawingcanvas.setStyle('cursor', 'crosshair');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -110,13 +110,13 @@ Y.extend(ANNOTATIONHIGHLIGHT, M.assignfeedback_editpdf.annotation, {
|
||||||
shape = this.editor.graphic.addShape({
|
shape = this.editor.graphic.addShape({
|
||||||
type: Y.Rect,
|
type: Y.Rect,
|
||||||
width: bounds.width,
|
width: bounds.width,
|
||||||
height: 16,
|
height: 20,
|
||||||
stroke: false,
|
stroke: false,
|
||||||
fill: {
|
fill: {
|
||||||
color: highlightcolour
|
color: highlightcolour
|
||||||
},
|
},
|
||||||
x: bounds.x,
|
x: bounds.x,
|
||||||
y: edit.start.y
|
y: edit.start.y - 10
|
||||||
});
|
});
|
||||||
|
|
||||||
drawable.shapes.push(shape);
|
drawable.shapes.push(shape);
|
||||||
|
@ -139,9 +139,9 @@ Y.extend(ANNOTATIONHIGHLIGHT, M.assignfeedback_editpdf.annotation, {
|
||||||
this.gradeid = this.editor.get('gradeid');
|
this.gradeid = this.editor.get('gradeid');
|
||||||
this.pageno = this.editor.currentpage;
|
this.pageno = this.editor.currentpage;
|
||||||
this.x = bounds.x;
|
this.x = bounds.x;
|
||||||
this.y = edit.start.y;
|
this.y = edit.start.y - 10;
|
||||||
this.endx = bounds.x + bounds.width;
|
this.endx = bounds.x + bounds.width;
|
||||||
this.endy = edit.start.y + 16;
|
this.endy = edit.start.y + 10;
|
||||||
this.colour = edit.annotationcolour;
|
this.colour = edit.annotationcolour;
|
||||||
this.page = '';
|
this.page = '';
|
||||||
|
|
||||||
|
|
|
@ -266,7 +266,7 @@ EDITOR.prototype = {
|
||||||
* @method refresh_button_state
|
* @method refresh_button_state
|
||||||
*/
|
*/
|
||||||
refresh_button_state: function() {
|
refresh_button_state: function() {
|
||||||
var button, currenttoolnode, imgurl, drawingregion;
|
var button, currenttoolnode, imgurl, drawingregion, stampimgurl, drawingcanvas;
|
||||||
|
|
||||||
// Initalise the colour buttons.
|
// Initalise the colour buttons.
|
||||||
button = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
|
button = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
|
||||||
|
@ -291,9 +291,28 @@ EDITOR.prototype = {
|
||||||
drawingregion.setAttribute('data-currenttool', this.currentedit.tool);
|
drawingregion.setAttribute('data-currenttool', this.currentedit.tool);
|
||||||
|
|
||||||
button = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
|
button = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
|
||||||
button.one('img').setAttrs({'src': this.get_stamp_image_url(this.currentedit.stamp),
|
stampimgurl = this.get_stamp_image_url(this.currentedit.stamp);
|
||||||
|
button.one('img').setAttrs({'src': stampimgurl,
|
||||||
'height': '16',
|
'height': '16',
|
||||||
'width': '16'});
|
'width': '16'});
|
||||||
|
|
||||||
|
drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
|
||||||
|
switch (this.currentedit.tool) {
|
||||||
|
case 'drag':
|
||||||
|
drawingcanvas.setStyle('cursor', 'move');
|
||||||
|
break;
|
||||||
|
case 'highlight':
|
||||||
|
drawingcanvas.setStyle('cursor', 'text');
|
||||||
|
break;
|
||||||
|
case 'select':
|
||||||
|
drawingcanvas.setStyle('cursor', 'default');
|
||||||
|
break;
|
||||||
|
case 'stamp':
|
||||||
|
drawingcanvas.setStyle('cursor', 'url(' + stampimgurl + '), crosshair');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
drawingcanvas.setStyle('cursor', 'crosshair');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue