#### Calculate new position values

Total Post:135

Points:947
1216  View(s)
Ratings:
Rate this:

I have a document which containing some elements.  I am trying to show it in a webview but in a smaller size than the original size.  The problem is that I don´t get the correct positions in of the different spots in the webview. I got the correct size of the new spots but not the position. I made the calculations in the following way:

Original size (INDD document)

`DocumentWidth = 768DocumentHeight = 1024New Size (Size of the webview)Width = 522Height = 696 percentW = newWidth(Webview)/DocumentWidthpercentH = newHeight(Webview)/DocumentHeight;`

From these percent values I am calculating all the new values I will need in the ImageMapper (top,left,bottom,right).

Formula for that

`myPrecent = (percentW/percentH) * 100;        result =  myPrecent * ((top,left,right,bottom) / 100);`

I suppose that I am thinking wrong in my calculation but I cant figured out what I´m doing wrong. So I will be appreciate if someone has any idea what I have doing wrong.

1. Post:378

Points:2694
##### Re: Calculate new position values

Hi Chintoo,

try this:

verticalScaling = Height/DocumentHeight

horizontalScaling = Width/DocumentWidth

newTop = Top * verticalScaling

newLeft = Left * horizontalScaling

newBottom = Bottom * verticalScaling

newRight = Right * horizontalScaling

#### CONTACT INFO

10-B Taskand Marg, Near Patrika Chauraha, Civil Lines, Prayagraj, UP, India-211001.
contact@mindstick.com
91-532-2400505

969-G Edgewater Blvd,Suite
793 Foster City-94404, CA (USA)
+1-650-242-0133