Gitlab CSE Unil
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
M. Chardon
moodle-assignfeedback_editpdfplus
Commits
03bd1445
Commit
03bd1445
authored
May 31, 2019
by
M. Chardon
Browse files
maj readme + ménage
parent
cd172d5f
Changes
2
Show whitespace changes
Inline
Side-by-side
README.md
View file @
03bd1445
...
...
@@ -4,7 +4,11 @@ This plugin is a fork of assignfeedback_editpdf, and is developed and maintained
Author: Marion Chardon,
<marion.chardon@unil.ch>
Compatible with Moodle versions: 3.3, 3.5
Compatible with Moodle versions: 3.3, 3.5, 3.7
Note:
-
for 3.3, please check tag "3.3", not master version.
-
for 3.5, please check branch "mdl_3.5", not master version.
## Description
...
...
yui/src/editor/js/annotationstamp.js
deleted
100644 → 0
View file @
cd172d5f
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* global SELECTOR */
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdfplus-editor
*/
/**
* Class representing a stamp.
*
* @namespace M.assignfeedback_editpdfplus
* @class annotationstamp
* @extends M.assignfeedback_editpdfplus.annotation
*/
var
ANNOTATIONSTAMP
=
function
(
config
)
{
ANNOTATIONSTAMP
.
superclass
.
constructor
.
apply
(
this
,
[
config
]);
};
ANNOTATIONSTAMP
.
NAME
=
"
annotationstamp
"
;
ANNOTATIONSTAMP
.
ATTRS
=
{};
Y
.
extend
(
ANNOTATIONSTAMP
,
M
.
assignfeedback_editpdfplus
.
annotation
,
{
/**
* Draw a stamp annotation
* @protected
* @method draw
* @return M.assignfeedback_editpdfplus.drawable
*/
draw
:
function
()
{
var
drawable
=
new
M
.
assignfeedback_editpdfplus
.
drawable
(
this
.
editor
),
drawingcanvas
=
this
.
editor
.
get_dialogue_element
(
SELECTOR
.
DRAWINGCANVAS
),
node
,
position
;
position
=
this
.
editor
.
get_window_coordinates
(
new
M
.
assignfeedback_editpdfplus
.
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
),
'
height
'
:
(
this
.
endy
-
this
.
y
),
'
backgroundSize
'
:
'
100% 100%
'
,
'
zIndex
'
:
50
});
drawingcanvas
.
append
(
node
);
node
.
setX
(
position
.
x
);
node
.
setY
(
position
.
y
);
drawable
.
store_position
(
node
,
position
.
x
,
position
.
y
);
drawable
.
nodes
.
push
(
node
);
this
.
drawable
=
drawable
;
return
ANNOTATIONSTAMP
.
superclass
.
draw
.
apply
(
this
);
},
/**
* Draw the in progress edit.
*
* @public
* @method draw_current_edit
* @param M.assignfeedback_editpdfplus.edit edit
*/
draw_current_edit
:
function
(
edit
)
{
var
bounds
=
new
M
.
assignfeedback_editpdfplus
.
rect
(),
drawable
=
new
M
.
assignfeedback_editpdfplus
.
drawable
(
this
.
editor
),
drawingregion
=
this
.
editor
.
get_dialogue_element
(
SELECTOR
.
DRAWINGREGION
),
node
,
position
;
bounds
.
bound
([
edit
.
start
,
edit
.
end
]);
position
=
this
.
editor
.
get_window_coordinates
(
new
M
.
assignfeedback_editpdfplus
.
point
(
bounds
.
x
,
bounds
.
y
));
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
,
'
height
'
:
bounds
.
height
,
'
backgroundSize
'
:
'
100% 100%
'
,
'
zIndex
'
:
50
});
drawingregion
.
append
(
node
);
node
.
setX
(
position
.
x
);
node
.
setY
(
position
.
y
);
drawable
.
store_position
(
node
,
position
.
x
,
position
.
y
);
drawable
.
nodes
.
push
(
node
);
return
drawable
;
},
/**
* Promote the current edit to a real annotation.
*
* @public
* @method init_from_edit
* @param M.assignfeedback_editpdfplus.edit edit
* @return bool if width/height is more than min. required.
*/
init_from_edit
:
function
(
edit
)
{
var
bounds
=
new
M
.
assignfeedback_editpdfplus
.
rect
();
bounds
.
bound
([
edit
.
start
,
edit
.
end
]);
if
(
bounds
.
width
<
40
)
{
bounds
.
width
=
40
;
}
if
(
bounds
.
height
<
40
)
{
bounds
.
height
=
40
;
}
this
.
gradeid
=
this
.
editor
.
get
(
'
gradeid
'
);
this
.
pageno
=
this
.
editor
.
currentpage
;
this
.
x
=
bounds
.
x
;
this
.
y
=
bounds
.
y
;
this
.
endx
=
bounds
.
x
+
bounds
.
width
;
this
.
endy
=
bounds
.
y
+
bounds
.
height
;
this
.
colour
=
edit
.
annotationcolour
;
this
.
path
=
edit
.
stamp
;
// Min width and height is always more than 40px.
return
true
;
},
/**
* Move an annotation to a new location.
* @public
* @param int newx
* @param int newy
* @method move_annotation
*/
move
:
function
(
newx
,
newy
)
{
var
diffx
=
newx
-
this
.
x
,
diffy
=
newy
-
this
.
y
;
this
.
x
+=
diffx
;
this
.
y
+=
diffy
;
this
.
endx
+=
diffx
;
this
.
endy
+=
diffy
;
if
(
this
.
drawable
)
{
this
.
drawable
.
erase
();
}
this
.
editor
.
drawables
.
push
(
this
.
draw
());
}
});
M
.
assignfeedback_editpdfplus
=
M
.
assignfeedback_editpdfplus
||
{};
M
.
assignfeedback_editpdfplus
.
annotationstamp
=
ANNOTATIONSTAMP
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment