Created
November 21, 2011 00:36
-
-
Save NickCarneiro/1381275 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//convert web to mobile | |
int web_width = 1279; | |
int web_height = 1795; | |
int x_mid = web_width / 2; | |
int y_mid = web_height / 2; | |
Integer x_in = X_INPUT_FROM_ROHAN; | |
Integer y_in = Y_INPUT_FROM_ROHAN; | |
Integer x_out; | |
Integer y_out; | |
if(x_in >= 0{ | |
//past middle | |
x_out = x_in + web_width / 2; | |
} else{ | |
//less than middle | |
x_out = web_width / 2 - (-1* x_in); | |
} | |
if(y_in >= y_mid){ | |
//past middle | |
y_out = web_height / 2 - y_in; | |
} else{ | |
//less than middle | |
y_out = web_height / 2 + -1 * y_in; | |
} | |
Integer x_out = (int) (x_out / x_scale); | |
Integer y_out = (int)(y_out / y_scale); | |
Integer x_adjusted = x_out - 16; | |
Integer y_adjusted = y_padding_top + y_out - 36; | |
//remove previous | |
if(tempView != null){ | |
mainLayout.removeView(tempView); | |
} | |
//plot marker | |
tempView = new MyCustomView(context, x_adjusted, y_adjusted); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment