mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
updated docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f0d5b97d86
commit
b8620d1ea8
@ -52,6 +52,36 @@ function squareClick(){
|
|||||||
centerSquare()
|
centerSquare()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The folowing two functions will get the vertical and horizontal
|
||||||
|
* distance components between the pints a and A, centers of the small
|
||||||
|
* and large squares respectively.
|
||||||
|
* One of the squares is .container and the other is .meta-container,
|
||||||
|
* which is small or big is not important.
|
||||||
|
*
|
||||||
|
* +---------------+-------+
|
||||||
|
* | | |
|
||||||
|
* | | |
|
||||||
|
* | + a . . | . . . | . +
|
||||||
|
* | . | | +- getCurrentVerticalOffset(...)
|
||||||
|
* | . + A | . . . | . +
|
||||||
|
* +---------------+ |
|
||||||
|
* | . . |
|
||||||
|
* | . . |
|
||||||
|
* | . . |
|
||||||
|
* +-----------------------+
|
||||||
|
* . .
|
||||||
|
* +-+-+
|
||||||
|
* +------------------- getCurrentHorizontalOffset(...)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Adding this distance to margins of one of the sqares will effectively
|
||||||
|
* allign the two points.
|
||||||
|
*
|
||||||
|
* NOTE: neither function accunts for container margins.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
// get the vertical offset of the center of square from center of meta-container
|
// get the vertical offset of the center of square from center of meta-container
|
||||||
// NOTE: this does not account for container margins
|
// NOTE: this does not account for container margins
|
||||||
function getCurrentVerticalOffset(square){
|
function getCurrentVerticalOffset(square){
|
||||||
@ -59,8 +89,6 @@ function getCurrentVerticalOffset(square){
|
|||||||
square = $('.square.current')
|
square = $('.square.current')
|
||||||
}
|
}
|
||||||
|
|
||||||
var zoom = $('.container').css('zoom')
|
|
||||||
|
|
||||||
var ribbons = $('.ribbon')
|
var ribbons = $('.ribbon')
|
||||||
var ribbon = square.parents('.ribbon')
|
var ribbon = square.parents('.ribbon')
|
||||||
var squares = ribbon.children('.square')
|
var squares = ribbon.children('.square')
|
||||||
@ -122,15 +150,16 @@ function alignRibbon(square, position){
|
|||||||
if(position == null){
|
if(position == null){
|
||||||
position = 'center'
|
position = 'center'
|
||||||
}
|
}
|
||||||
// account for shifted container...
|
|
||||||
|
var ribbon = square.parents('.ribbon')
|
||||||
|
|
||||||
|
// account for margined container...
|
||||||
// NOTE: this enables us to cheat and shift all the ribbons just
|
// NOTE: this enables us to cheat and shift all the ribbons just
|
||||||
// by changing container margin-left...
|
// by changing container margin-left...
|
||||||
var cml = parseFloat($('.container').css('margin-left'))
|
var cml = parseFloat($('.container').css('margin-left'))
|
||||||
if(!cml){
|
if(!cml){
|
||||||
cml = 0
|
cml = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var ribbon = square.parents('.ribbon')
|
|
||||||
var h_offset = getCurrentHorizontalOffset(square) - cml
|
var h_offset = getCurrentHorizontalOffset(square) - cml
|
||||||
var w = $('.square').outerWidth(true)
|
var w = $('.square').outerWidth(true)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user