Skip to content
Snippets Groups Projects
Commit 112eaf1c authored by Drahomír Karchňák's avatar Drahomír Karchňák
Browse files

#76 News detail dialog resizes so it fits the screen size

parent e5ed3b6b
No related branches found
No related tags found
No related merge requests found
......@@ -99,6 +99,9 @@ public class PanoramaScreen extends AbstractTablexiaScreen<int[][]> {
private static final float NEWSPAPER_DETAIL_DIALOG_DIMMER = 0.6f;
private static final float NEWS_DIALOG_MAX_WIDTH = 0.85f;
private static final float NEWS_DIALOG_MAX_HEIGHT = 0.85f;
private TextureRegion clickmap;
private Group panel;
......@@ -412,13 +415,17 @@ public class PanoramaScreen extends AbstractTablexiaScreen<int[][]> {
components.add(new TouchCloseDialogComponent());
components.add(new AdaptiveSizeDialogComponent());
components.add(new SpeechDialogComponent(
components.add(
new SpeechDialogComponent(
new Point(
//4 is just a little offset to make sure that dialog appears to the top and right...
newsDetailDialog.getInnerLeftX() + newsDetailDialog.getInnerWidth() / 2 + 4,
newsDetailDialog.getInnerBottomY() + newsDetailDialog.getInnerHeight() / 2 + 4),
//4 is just a little offset to make sure that dialog appears to the top and right...
newsDetailDialog.getInnerLeftX() + newsDetailDialog.getInnerWidth() / 2 + 4,
newsDetailDialog.getInnerBottomY() + newsDetailDialog.getInnerHeight() / 2 + 4
),
new Vector2(newsDetailDialog.getInnerWidth() / 2f * 0.8f, newsDetailDialog.getInnerHeight() / 2f * 0.8f),
SpeechDialogComponent.ArrowType.BEND_ARROW, true));
SpeechDialogComponent.ArrowType.ARROW, true
)
);
components.add(new FixedSpaceContentDialogComponent());
components.add(new ResizableSpaceContentDialogComponent());
......@@ -485,10 +492,29 @@ public class PanoramaScreen extends AbstractTablexiaScreen<int[][]> {
TablexiaComponentDialog.TablexiaDialogType.DIALOG_RECTANGLE,
components.toArray(new TablexiaDialogComponentAdapter[]{})
);
int origNewsDetailWidth = getScreenTextureRegion(GFX_PATH + NEWSPAPER_DETAIL + (dialogIndex + 1)).getRegionWidth();
int origNewsDetailHeight = getScreenTextureRegion(GFX_PATH + NEWSPAPER_DETAIL + (dialogIndex + 1)).getRegionHeight();
this.newsDetailDialog.show(
getScreenTextureRegion(GFX_PATH + NEWSPAPER_DETAIL + (dialogIndex + 1)).getRegionWidth(),
getScreenTextureRegion(GFX_PATH + NEWSPAPER_DETAIL + (dialogIndex + 1)).getRegionHeight()
origNewsDetailWidth,
origNewsDetailHeight
);
if(newsDetailDialog.getOutterHeight() > getSceneInnerHeight() * NEWS_DIALOG_MAX_HEIGHT) {
int currNewsDetailHeight;
int currNewsDetailWidth;
currNewsDetailHeight = (int) (getSceneInnerHeight() * NEWS_DIALOG_MAX_HEIGHT);
currNewsDetailWidth = (int) (currNewsDetailHeight * ((float)(origNewsDetailWidth) / origNewsDetailHeight));
if(currNewsDetailWidth > getSceneWidth() * NEWS_DIALOG_MAX_WIDTH) {
currNewsDetailWidth = (int) (getSceneWidth() * NEWS_DIALOG_MAX_WIDTH);
currNewsDetailHeight = (int) (currNewsDetailWidth * ((float)(origNewsDetailHeight) / origNewsDetailWidth));
}
this.newsDetailDialog.setSize(currNewsDetailWidth, currNewsDetailHeight);
}
}
private Music playingMusic;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment