Fix the hit testing so the regions line up with the icons.

This commit is contained in:
Joe Onorato
2009-09-25 13:59:59 -07:00
parent e048e8a8ef
commit 56848b0cc5
2 changed files with 30 additions and 13 deletions
+18 -1
View File
@@ -363,10 +363,27 @@ main(int launchID)
draw_page(icon, lastIcon, -pageAngle*currentPagePosition, scale);
draw_page(icon+iconsPerPage, lastIcon, (-pageAngle*currentPagePosition)+pageAngle, scale);
// Draw the border lines for debugging ========================================
/*
bindProgramVertex(NAMED_PVOrtho);
bindProgramFragment(NAMED_PFOrtho);
bindProgramFragmentStore(NAMED_PFSText);
color(1.0f, 1.0f, 0.0f, 0.99f);
int i;
for (i=0; i<ROWS_PER_PAGE+1; i++) {
int y = loadI32(ALLOC_Y_BORDERS, i);
drawRect(0, y, SCREEN_WIDTH_PX, y+1, 0.0f);
}
for (i=0; i<COLUMNS_PER_PAGE+1; i++) {
int x = loadI32(ALLOC_X_BORDERS, i);
drawRect(x, 0, x+1, SCREEN_HEIGHT_PX, 0.0f);
}
*/
// Draw the scroll handle ========================================
/*
bindTexture(NAMED_PFText, 0, loadI32(ALLOC_PARAMS, PARAM_SCROLL_HANDLE_ID));
bindTexture(NAMED_PFOrtho, 0, loadI32(ALLOC_PARAMS, PARAM_SCROLL_HANDLE_ID));
float handleLeft = 40 + (320 * (scrollXPx/(float)(maxScrollXPx)));
float handleTop = 680;
float handleWidth = loadI32(ALLOC_PARAMS, PARAM_SCROLL_HANDLE_TEX_WIDTH);
+12 -12
View File
@@ -399,7 +399,7 @@ public class AllAppsView extends RSSurfaceView
private ProgramStore mPSText;
private ProgramFragment mPFDebug;
private ProgramFragment mPFImages;
private ProgramFragment mPFText;
private ProgramFragment mPFOrtho;
private ProgramVertex mPV;
private ProgramVertex.MatrixAllocation mPVAlloc;
private ProgramVertex mPVOrtho;
@@ -523,10 +523,10 @@ public class AllAppsView extends RSSurfaceView
mPFImages.bindSampler(mSampler, 0);
bf.setTexEnvMode(ProgramFragment.EnvMode.MODULATE, 0);
//mPFText = bf.create();
mPFText = (new ProgramFragment.Builder(mRS, null, null)).create();
mPFText.setName("PFText");
mPFText.bindSampler(mSamplerText, 0);
//mPFOrtho = bf.create();
mPFOrtho = (new ProgramFragment.Builder(mRS, null, null)).create();
mPFOrtho.setName("PFOrtho");
mPFOrtho.bindSampler(mSamplerText, 0);
ProgramStore.Builder bs = new ProgramStore.Builder(mRS, null, null);
bs.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
@@ -691,20 +691,20 @@ public class AllAppsView extends RSSurfaceView
int cellHeight = iconsSize / Defines.ROWS_PER_PAGE;
int cellWidth = iconsSize / Defines.COLUMNS_PER_PAGE;
int centerY = (height / 2) - (int)(cellHeight * 0.35f);
mTouchYBorders[0] = centerY - (int)(2.4f * cellHeight);
mTouchYBorders[1] = centerY - (int)(1.15f * cellHeight);
int centerY = (height / 2) - (int)(cellHeight * 0.2f);
mTouchYBorders[0] = centerY - (int)(2.8f * cellHeight);
mTouchYBorders[1] = centerY - (int)(1.25f * cellHeight);
mTouchYBorders[2] = centerY;
mTouchYBorders[3] = centerY + (int)(1.15f * cellHeight);;
mTouchYBorders[4] = centerY + (int)(2.4f * cellHeight);
mTouchYBorders[3] = centerY + (int)(1.25f * cellHeight);;
mTouchYBorders[4] = centerY + (int)(2.6f * cellHeight);
mAllocTouchYBorders.data(mTouchYBorders);
int centerX = (width / 2);
mTouchXBorders[0] = centerX - (2 * cellWidth);
mTouchXBorders[1] = centerX - (int)(0.83f * cellWidth);;
mTouchXBorders[1] = centerX - (int)(0.85f * cellWidth);
mTouchXBorders[2] = centerX;
mTouchXBorders[3] = centerX + (int)(0.83f * cellWidth);;
mTouchXBorders[3] = centerX + (int)(0.85f * cellWidth);
mTouchXBorders[4] = centerX + (2 * cellWidth);
mAllocTouchXBorders.data(mTouchXBorders);