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
2b5e55b6
Commit
2b5e55b6
authored
Oct 31, 2012
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use try/catch to detect undefined globals for canvas
parent
6bbe82b6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
common/lib/xmodule/xmodule/js/src/capa/schematic.js
+11
-2
No files found.
common/lib/xmodule/xmodule/js/src/capa/schematic.js
View file @
2b5e55b6
...
@@ -3339,7 +3339,9 @@ schematic = (function() {
...
@@ -3339,7 +3339,9 @@ schematic = (function() {
}
}
// add method to canvas to compute relative coords for event
// add method to canvas to compute relative coords for event
if
(
HTMLCanvasElement
)
HTMLCanvasElement
.
prototype
.
relMouseCoords
=
function
(
event
){
try
{
if
(
HTMLCanvasElement
)
HTMLCanvasElement
.
prototype
.
relMouseCoords
=
function
(
event
){
// run up the DOM tree to figure out coords for top,left of canvas
// run up the DOM tree to figure out coords for top,left of canvas
var
totalOffsetX
=
0
;
var
totalOffsetX
=
0
;
var
totalOffsetY
=
0
;
var
totalOffsetY
=
0
;
...
@@ -3357,6 +3359,9 @@ schematic = (function() {
...
@@ -3357,6 +3359,9 @@ schematic = (function() {
this
.
page_x
=
event
.
pageX
;
this
.
page_x
=
event
.
pageX
;
this
.
page_y
=
event
.
pageY
;
this
.
page_y
=
event
.
pageY
;
}
}
}
catch
(
err
)
{
// ignore
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
//
...
@@ -4091,6 +4096,8 @@ schematic = (function() {
...
@@ -4091,6 +4096,8 @@ schematic = (function() {
// add dashed lines!
// add dashed lines!
// from http://davidowens.wordpress.com/2010/09/07/html-5-canvas-and-dashed-lines/
// from http://davidowens.wordpress.com/2010/09/07/html-5-canvas-and-dashed-lines/
try
{
if
(
CanvasRenderingContext2D
)
CanvasRenderingContext2D
.
prototype
.
dashedLineTo
=
function
(
fromX
,
fromY
,
toX
,
toY
,
pattern
)
{
CanvasRenderingContext2D
.
prototype
.
dashedLineTo
=
function
(
fromX
,
fromY
,
toX
,
toY
,
pattern
)
{
// Our growth rate for our line can be one of the following:
// Our growth rate for our line can be one of the following:
// (+,+), (+,-), (-,+), (-,-)
// (+,+), (+,-), (-,+), (-,-)
...
@@ -4132,7 +4139,9 @@ schematic = (function() {
...
@@ -4132,7 +4139,9 @@ schematic = (function() {
dash
=
!
dash
;
dash
=
!
dash
;
}
}
};
};
}
catch
(
err
)
{
//noop
}
// given a range of values, return a new range [vmin',vmax'] where the limits
// given a range of values, return a new range [vmin',vmax'] where the limits
// have been chosen "nicely". Taken from matplotlib.ticker.LinearLocator
// have been chosen "nicely". Taken from matplotlib.ticker.LinearLocator
function
view_limits
(
vmin
,
vmax
)
{
function
view_limits
(
vmin
,
vmax
)
{
...
...
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