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
887eea30
Commit
887eea30
authored
Dec 11, 2013
by
polesye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add comments.
parent
6e01ce50
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee
+0
-2
common/lib/xmodule/xmodule/js/src/capa/display.coffee
+15
-2
No files found.
common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee
View file @
887eea30
...
@@ -354,9 +354,7 @@ describe 'Problem', ->
...
@@ -354,9 +354,7 @@ describe 'Problem', ->
abs
=
Math
.
abs
abs
=
Math
.
abs
points
=
reg
.
exec
(
rect
)
points
=
reg
.
exec
(
rect
)
if
points
if
points
# width
width
=
abs
(
points
[
3
]
-
points
[
1
])
width
=
abs
(
points
[
3
]
-
points
[
1
])
# height
height
=
abs
(
points
[
4
]
-
points
[
2
])
height
=
abs
(
points
[
4
]
-
points
[
2
])
ctx
.
rect
(
points
[
1
],
points
[
2
],
width
,
height
)
ctx
.
rect
(
points
[
1
],
points
[
2
],
width
,
height
)
...
...
common/lib/xmodule/xmodule/js/src/capa/display.coffee
View file @
887eea30
...
@@ -483,6 +483,13 @@ class @Problem
...
@@ -483,6 +483,13 @@ class @Problem
element
.
find
(
"section#forinput
#{
choice
}
"
).
addClass
'choicetextgroup_show_correct'
element
.
find
(
"section#forinput
#{
choice
}
"
).
addClass
'choicetextgroup_show_correct'
imageinput
:
(
element
,
display
,
answers
)
=>
imageinput
:
(
element
,
display
,
answers
)
=>
# answers is a dict of (answer_id, answer_text) for each answer for this
# question.
# @Examples:
# {'anwser_id': {
# 'rectangle': '(10,10)-(20,30);(12,12)-(40,60)',
# 'regions': '[[10,10], [30,30], [10, 30], [30, 10]]'
# } }
types
=
types
=
rectangle
:
(
coords
)
=>
rectangle
:
(
coords
)
=>
reg
=
/^\(([0-9]+),([0-9]+)\)-\(([0-9]+),([0-9]+)\)$/
reg
=
/^\(([0-9]+),([0-9]+)\)-\(([0-9]+),([0-9]+)\)$/
...
@@ -492,9 +499,7 @@ class @Problem
...
@@ -492,9 +499,7 @@ class @Problem
abs
=
Math
.
abs
abs
=
Math
.
abs
points
=
reg
.
exec
(
rect
)
points
=
reg
.
exec
(
rect
)
if
points
if
points
# width
width
=
abs
(
points
[
3
]
-
points
[
1
])
width
=
abs
(
points
[
3
]
-
points
[
1
])
# height
height
=
abs
(
points
[
4
]
-
points
[
2
])
height
=
abs
(
points
[
4
]
-
points
[
2
])
ctx
.
rect
(
points
[
1
],
points
[
2
],
width
,
height
)
ctx
.
rect
(
points
[
1
],
points
[
2
],
width
,
height
)
...
@@ -506,7 +511,15 @@ class @Problem
...
@@ -506,7 +511,15 @@ class @Problem
parseCoords
=
(
coords
)
=>
parseCoords
=
(
coords
)
=>
reg
=
JSON
.
parse
(
coords
)
reg
=
JSON
.
parse
(
coords
)
# Regions is list of lists [region1, region2, region3, ...] where regionN
# is disordered list of points: [[1,1], [100,100], [50,50], [20, 70]].
# If there is only one region in the list, simpler notation can be used:
# regions="[[10,10], [30,30], [10, 30], [30, 10]]" (without explicitly
# setting outer list)
if
typeof
reg
[
0
][
0
][
0
]
==
"undefined"
if
typeof
reg
[
0
][
0
][
0
]
==
"undefined"
# we have [[1,2],[3,4],[5,6]] - single region
# instead of [[[1,2],[3,4],[5,6], [[1,2],[3,4],[5,6]]]
# or [[[1,2],[3,4],[5,6]]] - multiple regions syntax
reg
=
[
reg
]
reg
=
[
reg
]
return
reg
return
reg
...
...
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