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
6c6cd430
Commit
6c6cd430
authored
Aug 19, 2016
by
Chris Rodriguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding visual indicator of placemenet
parent
ba60d2e0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
23 deletions
+93
-23
cms/static/sass/xmodule/_image-zoom-tool.scss
+11
-0
common/static/js/vendor/image-zoom-tool.js
+71
-23
lms/static/sass/course/_image-zoom-tool.scss
+11
-0
No files found.
cms/static/sass/xmodule/_image-zoom-tool.scss
View file @
6c6cd430
...
@@ -52,4 +52,15 @@
...
@@ -52,4 +52,15 @@
display
:
block
;
display
:
block
;
}
}
}
}
.edx-zoom-loop
{
position
:
absolute
;
border-radius
:
50%
;
border-width
:
1px
;
border-style
:
solid
;
border-color
:
$black
;
box-shadow
:
inset
0
0
4px
$blue
;
background
:
transparent
;
z-index
:
20
;
}
}
}
common/static/js/vendor/image-zoom-tool.js
View file @
6c6cd430
...
@@ -28,8 +28,10 @@
...
@@ -28,8 +28,10 @@
$lightbox
=
$
(
'<div class="edx_imagezoom_lightbox">'
),
$lightbox
=
$
(
'<div class="edx_imagezoom_lightbox">'
),
$errorMessage
=
$
(
'<div class="edx_imagezoom_errorMessage">'
),
$errorMessage
=
$
(
'<div class="edx_imagezoom_errorMessage">'
),
$loader
=
$
(
'<div class="edx_imagezoom_loader">Loading...</div>'
),
$loader
=
$
(
'<div class="edx_imagezoom_loader">Loading...</div>'
),
$zoomArea
=
$
(
'.zooming-image-place'
),
$imageArea
=
$
(
'.zooming-image-place a'
),
$imageArea
=
$
(
'.zooming-image-place a'
),
$indicator
=
$
(
'.zooming-image-place .indicator'
);
$indicator
=
$
(
'.zooming-image-place .indicator'
),
$disc
=
$
(
'.edx-zoom-loop'
);
$this
.
css
({
$this
.
css
({
cursor
:
'default'
cursor
:
'default'
...
@@ -120,8 +122,6 @@
...
@@ -120,8 +122,6 @@
event
.
preventDefault
();
event
.
preventDefault
();
if
(
!
$zoomed
.
hasClass
(
'is-visible'
))
{
if
(
!
$zoomed
.
hasClass
(
'is-visible'
))
{
var
left
=
event
.
pageX
,
top
=
event
.
pageY
;
if
(
!
$magnifiedImage
.
hasClass
(
'is-appended'
))
{
if
(
!
$magnifiedImage
.
hasClass
(
'is-appended'
))
{
getMagnifiedImage
();
getMagnifiedImage
();
...
@@ -129,6 +129,7 @@
...
@@ -129,6 +129,7 @@
setTimeout
(
function
()
{
setTimeout
(
function
()
{
appendZoomed
(
true
);
appendZoomed
(
true
);
addZoomLocationDisc
();
magnifyWithMouse
(
left
,
top
,
true
);
magnifyWithMouse
(
left
,
top
,
true
);
if
(
settings
.
lightbox
==
true
)
{
if
(
settings
.
lightbox
==
true
)
{
...
@@ -156,9 +157,11 @@
...
@@ -156,9 +157,11 @@
case
keys
.
esc
:
case
keys
.
esc
:
if
(
$zoomed
.
hasClass
(
'is-visible'
))
{
if
(
$zoomed
.
hasClass
(
'is-visible'
))
{
detachZoomed
();
detachZoomed
();
removeZoomLocationDisc
();
if
(
settings
.
lightbox
==
true
)
{
if
(
settings
.
lightbox
==
true
)
{
detachLightbox
();
detachLightbox
();
removeZoomLocationDisc
();
}
}
$imageArea
.
focus
();
$imageArea
.
focus
();
...
@@ -166,23 +169,23 @@
...
@@ -166,23 +169,23 @@
break
;
break
;
case
keys
.
up
:
case
keys
.
up
:
// we move
two
spaces at a time
// we move
five
spaces at a time
magnifyWithKeyboard
(
0
,
2
,
event
);
magnifyWithKeyboard
(
0
,
5
,
event
);
break
;
break
;
case
keys
.
down
:
case
keys
.
down
:
// we move
two
spaces at a time
// we move
five
spaces at a time
magnifyWithKeyboard
(
0
,
-
2
,
event
);
magnifyWithKeyboard
(
0
,
-
5
,
event
);
break
;
break
;
case
keys
.
left
:
case
keys
.
left
:
// we move
two
spaces at a time
// we move
five
spaces at a time
magnifyWithKeyboard
(
2
,
0
,
event
);
magnifyWithKeyboard
(
5
,
0
,
event
);
break
;
break
;
case
keys
.
right
:
case
keys
.
right
:
// we move
two
spaces at a time
// we move
five
spaces at a time
magnifyWithKeyboard
(
-
2
,
0
,
event
);
magnifyWithKeyboard
(
-
5
,
0
,
event
);
break
;
break
;
default
:
default
:
...
@@ -193,9 +196,11 @@
...
@@ -193,9 +196,11 @@
$
(
document
).
click
(
function
(
event
)
{
$
(
document
).
click
(
function
(
event
)
{
if
(
$zoomed
.
hasClass
(
'is-visible'
))
{
if
(
$zoomed
.
hasClass
(
'is-visible'
))
{
detachZoomed
();
detachZoomed
();
removeZoomLocationDisc
();
if
(
settings
.
lightbox
==
true
)
{
if
(
settings
.
lightbox
==
true
)
{
detachLightbox
();
detachLightbox
();
removeZoomLocationDisc
();
}
}
}
}
});
});
...
@@ -213,6 +218,33 @@
...
@@ -213,6 +218,33 @@
});
});
}
}
});
});
function
addZoomLocationDisc
()
{
if
(
$zoomArea
.
find
(
$
(
'.edx-zoom-loop'
)))
{
$
(
'.edx-zoom-loop'
).
remove
();
}
var
discHeight
=
$zoomed
.
height
()
/
5
,
discWidth
=
$zoomed
.
width
()
/
5
,
zoomAreaHeight
=
$zoomArea
.
height
(),
zoomAreaWidth
=
$zoomArea
.
width
(),
zoomAreaCenterX
=
(
zoomAreaWidth
/
2
)
-
(
discWidth
/
2
),
zoomAreaCenterY
=
(
zoomAreaHeight
/
2
)
-
(
discHeight
/
2
);
$disc
=
$
(
'<div class="edx-zoom-loop"></div>'
)
.
height
(
discHeight
)
.
width
(
discWidth
)
.
css
({
left
:
zoomAreaCenterX
,
top
:
zoomAreaCenterY
});
$zoomArea
.
append
(
$disc
);
};
function
removeZoomLocationDisc
()
{
$disc
.
remove
();
};
function
magnifyWithMouse
(
left
,
top
,
centered
)
{
function
magnifyWithMouse
(
left
,
top
,
centered
)
{
var
heightDiff
=
$magnifiedImage
.
height
()
/
$targetImage
.
height
(),
var
heightDiff
=
$magnifiedImage
.
height
()
/
$targetImage
.
height
(),
...
@@ -221,8 +253,8 @@
...
@@ -221,8 +253,8 @@
magnifierLeft
;
magnifierLeft
;
if
(
centered
)
{
if
(
centered
)
{
magnifierTop
=
-
$magnifiedImage
.
height
()
/
2
;
magnifierTop
=
(
-
$magnifiedImage
.
height
()
/
2
)
+
(
$zoomed
.
height
()
/
2
)
;
magnifierLeft
=
-
$magnifiedImage
.
width
()
/
2
;
magnifierLeft
=
(
-
$magnifiedImage
.
width
()
/
2
)
+
(
$zoomed
.
width
()
/
2
)
;
}
else
{
}
else
{
magnifierTop
=
(
-
(
top
-
$targetImage
.
offset
().
top
)
*
heightDiff
)
+
(
settings
.
height
/
2
);
magnifierTop
=
(
-
(
top
-
$targetImage
.
offset
().
top
)
*
heightDiff
)
+
(
settings
.
height
/
2
);
magnifierLeft
=
(
-
(
left
-
$targetImage
.
offset
().
left
)
*
widthDiff
)
+
(
settings
.
width
/
2
);
magnifierLeft
=
(
-
(
left
-
$targetImage
.
offset
().
left
)
*
widthDiff
)
+
(
settings
.
width
/
2
);
...
@@ -235,21 +267,37 @@
...
@@ -235,21 +267,37 @@
};
};
function
magnifyWithKeyboard
(
left
,
top
,
event
)
{
function
magnifyWithKeyboard
(
left
,
top
,
event
)
{
var
newLeft
,
var
largeLeft
,
newTop
;
largeTop
,
smallLeft
,
smallTop
;
event
.
preventDefault
();
event
.
preventDefault
();
newLeft
=
$magnifiedImage
.
css
(
'left'
);
largeLeft
=
$magnifiedImage
.
css
(
'left'
);
newLeft
=
newLeft
.
replace
(
'px'
,
''
);
largeLeft
=
largeLeft
.
replace
(
'px'
,
''
);
newLeft
=
parseInt
(
newLeft
)
+
left
;
largeLeft
=
parseInt
(
largeLeft
)
+
left
;
newTop
=
$magnifiedImage
.
css
(
'top'
);
newTop
=
newTop
.
replace
(
'px'
,
''
);
largeTop
=
$magnifiedImage
.
css
(
'top'
);
newTop
=
parseInt
(
newTop
)
+
top
;
largeTop
=
largeTop
.
replace
(
'px'
,
''
);
largeTop
=
parseInt
(
largeTop
)
+
top
;
smallLeft
=
$disc
.
css
(
'left'
);
smallLeft
=
smallLeft
.
replace
(
'px'
,
''
);
smallLeft
=
parseInt
(
smallLeft
)
-
(
left
/
5
);
smallTop
=
$disc
.
css
(
'top'
);
smallTop
=
smallTop
.
replace
(
'px'
,
''
);
smallTop
=
parseInt
(
smallTop
)
-
(
top
/
5
);
$magnifiedImage
.
css
({
$magnifiedImage
.
css
({
top
:
newTop
+
'px'
,
top
:
largeTop
+
'px'
,
left
:
newLeft
+
'px'
left
:
largeLeft
+
'px'
});
$disc
.
css
({
top
:
smallTop
+
'px'
,
left
:
smallLeft
+
'px'
});
});
};
};
...
...
lms/static/sass/course/_image-zoom-tool.scss
View file @
6c6cd430
...
@@ -52,4 +52,15 @@
...
@@ -52,4 +52,15 @@
display
:
block
;
display
:
block
;
}
}
}
}
.edx-zoom-loop
{
position
:
absolute
;
border-radius
:
50%
;
border-width
:
1px
;
border-style
:
solid
;
border-color
:
$black
;
box-shadow
:
inset
0
0
4px
$blue
;
background
:
transparent
;
z-index
:
20
;
}
}
}
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