| 301 | | |
|---|
| 302 | | var position = this.positionBlocks[this.relativePosition]; |
|---|
| 303 | | for (var i = 0; i < position.blocks.length; i++) { |
|---|
| 304 | | |
|---|
| 305 | | var positionBlock = position.blocks[i]; |
|---|
| 306 | | var block = this.blocks[i]; |
|---|
| 307 | | |
|---|
| 308 | | // adjust sizes |
|---|
| 309 | | var l = positionBlock.anchor.left; |
|---|
| 310 | | var b = positionBlock.anchor.bottom; |
|---|
| 311 | | var r = positionBlock.anchor.right; |
|---|
| 312 | | var t = positionBlock.anchor.top; |
|---|
| 313 | | |
|---|
| 314 | | //note that we use the isNaN() test here because if the |
|---|
| 315 | | // size object is initialized with a "auto" parameter, the |
|---|
| 316 | | // size constructor calls parseFloat() on the string, |
|---|
| 317 | | // which will turn it into NaN |
|---|
| 318 | | // |
|---|
| 319 | | var w = (isNaN(positionBlock.size.w)) ? this.size.w - (r + l) |
|---|
| 320 | | : positionBlock.size.w; |
|---|
| 321 | | |
|---|
| 322 | | var h = (isNaN(positionBlock.size.h)) ? this.size.h - (b + t) |
|---|
| 323 | | : positionBlock.size.h; |
|---|
| 324 | | |
|---|
| 325 | | block.div.style.width = w + 'px'; |
|---|
| 326 | | block.div.style.height = h + 'px'; |
|---|
| 327 | | |
|---|
| 328 | | block.div.style.left = (l != null) ? l + 'px' : ''; |
|---|
| 329 | | block.div.style.bottom = (b != null) ? b + 'px' : ''; |
|---|
| 330 | | block.div.style.right = (r != null) ? r + 'px' : ''; |
|---|
| 331 | | block.div.style.top = (t != null) ? t + 'px' : ''; |
|---|
| 332 | | |
|---|
| 333 | | block.image.style.left = positionBlock.position.x + 'px'; |
|---|
| 334 | | block.image.style.top = positionBlock.position.y + 'px'; |
|---|
| | 299 | if (this.relativePosition) { |
|---|
| | 300 | var position = this.positionBlocks[this.relativePosition]; |
|---|
| | 301 | for (var i = 0; i < position.blocks.length; i++) { |
|---|
| | 302 | |
|---|
| | 303 | var positionBlock = position.blocks[i]; |
|---|
| | 304 | var block = this.blocks[i]; |
|---|
| | 305 | |
|---|
| | 306 | // adjust sizes |
|---|
| | 307 | var l = positionBlock.anchor.left; |
|---|
| | 308 | var b = positionBlock.anchor.bottom; |
|---|
| | 309 | var r = positionBlock.anchor.right; |
|---|
| | 310 | var t = positionBlock.anchor.top; |
|---|
| | 311 | |
|---|
| | 312 | //note that we use the isNaN() test here because if the |
|---|
| | 313 | // size object is initialized with a "auto" parameter, the |
|---|
| | 314 | // size constructor calls parseFloat() on the string, |
|---|
| | 315 | // which will turn it into NaN |
|---|
| | 316 | // |
|---|
| | 317 | var w = (isNaN(positionBlock.size.w)) ? this.size.w - (r + l) |
|---|
| | 318 | : positionBlock.size.w; |
|---|
| | 319 | |
|---|
| | 320 | var h = (isNaN(positionBlock.size.h)) ? this.size.h - (b + t) |
|---|
| | 321 | : positionBlock.size.h; |
|---|
| | 322 | |
|---|
| | 323 | block.div.style.width = w + 'px'; |
|---|
| | 324 | block.div.style.height = h + 'px'; |
|---|
| | 325 | |
|---|
| | 326 | block.div.style.left = (l != null) ? l + 'px' : ''; |
|---|
| | 327 | block.div.style.bottom = (b != null) ? b + 'px' : ''; |
|---|
| | 328 | block.div.style.right = (r != null) ? r + 'px' : ''; |
|---|
| | 329 | block.div.style.top = (t != null) ? t + 'px' : ''; |
|---|
| | 330 | |
|---|
| | 331 | block.image.style.left = positionBlock.position.x + 'px'; |
|---|
| | 332 | block.image.style.top = positionBlock.position.y + 'px'; |
|---|
| | 333 | } |
|---|
| | 334 | |
|---|
| | 335 | this.contentDiv.style.left = this.padding.left + "px"; |
|---|
| | 336 | this.contentDiv.style.top = this.padding.top + "px"; |
|---|