r2828 - + Transposed the vertical and horizontal parameter positions in the utility and the demo.
Author: vtGavin
Date: Mon Jun 22 06:25:49 2009
New Revision: 2828
Modified:
branches/dev/positionTo/demos/positionTo/default.html
branches/dev/positionTo/ui/utils.positionTo.js
Log:
+ Transposed the vertical and horizontal parameter positions in the utility
and the demo.
Modified: branches/dev/positionTo/demos/positionTo/default.html
==============================================================================
--- branches/dev/positionTo/demos/positionTo/default.html (original)
+++ branches/dev/positionTo/demos/positionTo/default.html Mon Jun 22
06:25:49 2009
@@ -43,11 +43,11 @@
$(function() {
$('input#positionTo_button').bind('click', function(){
var positionableAnchor =
- $('select#positionTo_positionableAnchor_vertical
option:selected').val() + ' '
- + $('select#positionTo_positionableAnchor_horizontal
option:selected').val();
+ $('select#positionTo_positionableAnchor_horizontal
option:selected').val() + ' '
+ + $('select#positionTo_positionableAnchor_vertical
option:selected').val();
var targetAnchor =
- $('select#positionTo_targetAnchor_vertical
option:selected').val() + ' '
- + $('select#positionTo_targetAnchor_horizontal
option:selected').val();
+ $('select#positionTo_targetAnchor_horizontal
option:selected').val() + ' '
+ + $('select#positionTo_targetAnchor_vertical
option:selected').val();
$('div#positionTo_positionable').positionTo(
$('div#positionTo_parent')[0],
@@ -78,29 +78,29 @@
<div style="padding: 20px; margin-top: 75px;">
<div style="padding-bottom: 20px;">
- <b>positionable anchor:</b>
+ <b>positionable anchor:</b>
+ <select id="positionTo_positionableAnchor_horizontal">
+ <option value="left">left</option>
+ <option value="center">center</option>
+ <option value="right">right</option>
+ </select>
<select id="positionTo_positionableAnchor_vertical">
<option value="top">top</option>
<option value="middle">middle</option>
<option value="bottom">bottom</option>
</select>
- <select id="positionTo_positionableAnchor_horizontal">
+ </div>
+ <div style="padding-bottom: 20px;">
+ <b>target anchor:</b>
+ <select id="positionTo_targetAnchor_horizontal">
<option value="left">left</option>
<option value="center">center</option>
<option value="right">right</option>
</select>
- </div>
- <div style="padding-bottom: 20px;">
- <b>target anchor:</b>
<select id="positionTo_targetAnchor_vertical">
<option value="top">top</option>
<option value="middle">middle</option>
<option value="bottom">bottom</option>
- </select>
- <select id="positionTo_targetAnchor_horizontal">
- <option value="left">left</option>
- <option value="center">center</option>
- <option value="right">right</option>
</select>
</div>
<div style="padding-bottom: 20px;">
Modified: branches/dev/positionTo/ui/utils.positionTo.js
==============================================================================
--- branches/dev/positionTo/ui/utils.positionTo.js (original)
+++ branches/dev/positionTo/ui/utils.positionTo.js Mon Jun 22 06:25:49 2009
@@ -50,9 +50,21 @@
array_offset_chunks = offset.replace(/px/gi, '').split(' ');
if (array_positionableAnchor_chunks.length == 2)
- {
+ {
+ // now, figure out the horizontal positionable offset
+ switch (array_positionableAnchor_chunks[0])
+ {
+ case 'center':
+ positionableOffset_x -= (this.outerWidth() / 2);
+ break;
+
+ case 'right':
+ positionableOffset_x -= this.outerWidth();
+ break;
+ }
+
// figure out the vertical positionable offset
- switch(array_positionableAnchor_chunks[0])
+ switch(array_positionableAnchor_chunks[1])
{
case 'middle':
positionableOffset_y -= (this.outerHeight() / 2);
@@ -62,24 +74,24 @@
positionableOffset_y -= this.outerHeight();
break;
}
-
- // now, figure out the horizontal positionable offset
- switch (array_positionableAnchor_chunks[1])
+ }
+
+ if (array_targetAnchor_chunks.length == 2)
+ {
+ // figure out the horizontal target offset
+ switch (array_targetAnchor_chunks[0])
{
case 'center':
- positionableOffset_x -= (this.outerWidth() / 2);
+ positionableOffset_x += (targetPosition.right -
targetPosition.left) / 2;
break;
case 'right':
- positionableOffset_x -= this.outerWidth();
+ positionableOffset_x += (targetPosition.right -
targetPosition.left);
break;
}
- }
-
- if (array_targetAnchor_chunks.length == 2)
- {
+
// figure out the vertical target offset
- switch (array_targetAnchor_chunks[0])
+ switch (array_targetAnchor_chunks[1])
{
case 'middle':
positionableOffset_y += (targetPosition.bottom -
targetPosition.top) / 2;
@@ -89,36 +101,24 @@
positionableOffset_y += (targetPosition.bottom -
targetPosition.top);
break;
}
-
- // figure out the horizontal target offset
- switch (array_targetAnchor_chunks[1])
- {
- case 'center':
- positionableOffset_x += (targetPosition.right -
targetPosition.left) / 2;
- break;
-
- case 'right':
- positionableOffset_x += (targetPosition.right -
targetPosition.left);
- break;
- }
}
if (array_offset_chunks.length == 2)
- {
- var offset_vertical_px = parseInt(array_offset_chunks[0]);
- // if: a valid integer was specified for the vertical offset
- // then: apply it to the calculated vertical offset
- if (!isNaN(offset_vertical_px))
- {
- positionableOffset_y += offset_vertical_px;
- }
-
- var offset_horizontal_px = parseInt(array_offset_chunks[1]);
+ {
+ var offset_horizontal_px = parseInt(array_offset_chunks[0]);
// if: a valid integer was specified for the horizontal offset
// then: apply it to the calculated horizontal offset
if (!isNaN(offset_horizontal_px))
{
positionableOffset_x += offset_horizontal_px;
+ }
+
+ var offset_vertical_px = parseInt(array_offset_chunks[1]);
+ // if: a valid integer was specified for the vertical offset
+ // then: apply it to the calculated vertical offset
+ if (!isNaN(offset_vertical_px))
+ {
+ positionableOffset_y += offset_vertical_px;
}
}