Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d31268e7
Commit
d31268e7
authored
Dec 11, 2013
by
Valera Rozuvan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor changes by Valera.
parent
79519b7a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
21 deletions
+30
-21
common/lib/xmodule/xmodule/js/src/capa/imageinput.js
+30
-21
No files found.
common/lib/xmodule/xmodule/js/src/capa/imageinput.js
View file @
d31268e7
/////////////////////////////////////////////////////////////////////////////
/**
//
* Simple image input
// Simple image input
*
//
*
////////////////////////////////////////////////////////////////////////////////
* Click on image. Update the coordinates of a dot on the image.
* The new coordinates are the location of the click.
*/
// click on image, update coordinates
/**
// put a dot at location of click, on image
* 'The wise adapt themselves to circumstances, as water molds itself to the
* pitcher.'
*
* ~ Chinese Proverb
*/
window
.
image_input_click
=
function
(
id
,
event
)
{
window
.
image_input_click
=
function
(
id
,
event
)
{
var
iidiv
=
document
.
getElementById
(
"imageinput_"
+
id
),
var
iiDiv
=
document
.
getElementById
(
'imageinput_'
+
id
),
pos_x
=
event
.
offsetX
?
(
event
.
offsetX
)
:
event
.
pageX
-
iidiv
.
offsetLeft
,
pos_y
=
event
.
offsetY
?
(
event
.
offsetY
)
:
event
.
pageY
-
iidiv
.
offsetTop
,
posX
=
event
.
offsetX
?
event
.
offsetX
:
event
.
pageX
-
iiDiv
.
offsetLeft
,
posY
=
event
.
offsetY
?
event
.
offsetY
:
event
.
pageY
-
iiDiv
.
offsetTop
,
cross
=
document
.
getElementById
(
'cross_'
+
id
),
// To reduce differences between values returned by different kinds of
// To reduce differences between values returned by different kinds of
// browsers, we round `pos_x` and `pos_y`.
// browsers, we round `posX` and `posY`.
// IE10: `pos_x` and `pos_y` - float.
//
// Chrome, FF: `pos_x` and `pos_y` - integers.
// IE10: `posX` and `posY` - float.
result
=
"["
+
Math
.
round
(
pos_x
)
+
","
+
Math
.
round
(
pos_y
)
+
"]"
,
// Chrome, FF: `posX` and `posY` - integers.
cx
=
(
pos_x
-
15
)
+
"px"
,
result
=
'['
+
Math
.
round
(
posX
)
+
','
+
Math
.
round
(
posY
)
+
']'
;
cy
=
(
pos_y
-
15
)
+
"px"
,
cross
=
document
.
getElementById
(
"cross_"
+
id
);
cross
.
style
.
left
=
(
posX
-
15
)
+
'px'
;
cross
.
style
.
top
=
(
posY
-
15
)
+
'px'
;
cross
.
style
.
visibility
=
'visible'
;
cross
.
style
.
left
=
cx
;
document
.
getElementById
(
'input_'
+
id
).
value
=
result
;
cross
.
style
.
top
=
cy
;
cross
.
style
.
visibility
=
"visible"
;
document
.
getElementById
(
"input_"
+
id
).
value
=
result
;
};
};
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