| 520 | | |
|---|
| 521 | | /** |
|---|
| 522 | | * Method: calculateRelativePosition |
|---|
| 523 | | * |
|---|
| 524 | | * Calculate the position of the popup (or what the popup should be) |
|---|
| 525 | | * given a starting pixel position and a size value. |
|---|
| 526 | | * |
|---|
| 527 | | * Parameters: |
|---|
| 528 | | * px - {<OpenLayers.Pixel>} The top and left position of the popup div. |
|---|
| 529 | | * size - {<OpenLayers.Size>} The size of the popup div(or the size that |
|---|
| 530 | | * it should be). |
|---|
| 531 | | * |
|---|
| 532 | | * Returns: |
|---|
| 533 | | * The new top and left position of the popup div. |
|---|
| 534 | | */ |
|---|
| 535 | | calculateRelativePosition: function(px, size) { |
|---|
| 536 | | |
|---|
| 537 | | px = px.clone(); |
|---|
| 538 | | |
|---|
| 539 | | if (this.relativePosition == OpenLayers.Position.TOP_RIGHT || |
|---|
| 540 | | this.relativePosition == OpenLayers.Position.BOTTOM_RIGHT) { |
|---|
| 541 | | px.x -= size.w; |
|---|
| 542 | | } |
|---|
| 543 | | |
|---|
| 544 | | if (this.relativePosition == OpenLayers.Position.BOTTOM_LEFT || |
|---|
| 545 | | this.relativePosition == OpenLayers.Position.BOTTOM_RIGHT) { |
|---|
| 546 | | px.y -= size.h; |
|---|
| 547 | | } |
|---|
| 548 | | |
|---|
| 549 | | return px; |
|---|
| 550 | | }, |
|---|
| 551 | | |
|---|
| | 520 | |
|---|