when scrolling up through comments, it starts at the bottom of the page instead of the top
This commit is contained in:
parent
a9352008cf
commit
a63f5b875b
@ -28,6 +28,11 @@ int ScrollPanel::GetScrollLimit()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScrollPanel::SetScrollPosition(int position)
|
||||||
|
{
|
||||||
|
offsetY = position;
|
||||||
|
}
|
||||||
|
|
||||||
void ScrollPanel::XOnMouseWheelInside(int localx, int localy, int d)
|
void ScrollPanel::XOnMouseWheelInside(int localx, int localy, int d)
|
||||||
{
|
{
|
||||||
if(!d)
|
if(!d)
|
||||||
|
@ -21,6 +21,7 @@ namespace ui
|
|||||||
ScrollPanel(Point position, Point size);
|
ScrollPanel(Point position, Point size);
|
||||||
|
|
||||||
int GetScrollLimit();
|
int GetScrollLimit();
|
||||||
|
void SetScrollPosition(int position);
|
||||||
|
|
||||||
virtual void Draw(const Point& screenPos);
|
virtual void Draw(const Point& screenPos);
|
||||||
virtual void XTick(float dt);
|
virtual void XTick(float dt);
|
||||||
|
@ -69,7 +69,8 @@ PreviewView::PreviewView():
|
|||||||
addCommentBox(NULL),
|
addCommentBox(NULL),
|
||||||
submitCommentButton(NULL),
|
submitCommentButton(NULL),
|
||||||
commentBoxHeight(20),
|
commentBoxHeight(20),
|
||||||
showAvatars(true)
|
showAvatars(true),
|
||||||
|
prevPage(false)
|
||||||
{
|
{
|
||||||
class FavAction: public ui::ButtonAction
|
class FavAction: public ui::ButtonAction
|
||||||
{
|
{
|
||||||
@ -374,7 +375,10 @@ void PreviewView::OnMouseWheel(int x, int y, int d)
|
|||||||
if(commentsPanel->GetScrollLimit() == 1 && d < 0)
|
if(commentsPanel->GetScrollLimit() == 1 && d < 0)
|
||||||
c->NextCommentPage();
|
c->NextCommentPage();
|
||||||
if(commentsPanel->GetScrollLimit() == -1 && d > 0)
|
if(commentsPanel->GetScrollLimit() == -1 && d > 0)
|
||||||
|
{
|
||||||
|
prevPage = true;
|
||||||
c->PrevCommentPage();
|
c->PrevCommentPage();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -585,24 +589,16 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
|
|||||||
}
|
}
|
||||||
|
|
||||||
commentsPanel->InnerSize = ui::Point(commentsPanel->Size.X, currentY+4);
|
commentsPanel->InnerSize = ui::Point(commentsPanel->Size.X, currentY+4);
|
||||||
|
if (prevPage)
|
||||||
|
{
|
||||||
|
prevPage = false;
|
||||||
|
commentsPanel->SetScrollPosition(currentY);
|
||||||
|
//update positions of the comments so that it doesn't start at the top for a frame
|
||||||
|
commentsPanel->Tick(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void PreviewView::NotifyPreviewChanged(PreviewModel * sender)
|
|
||||||
{
|
|
||||||
savePreview = sender->GetGameSave();
|
|
||||||
if(savePreview && savePreview->Data && !(savePreview->Width == XRES/2 && savePreview->Height == YRES/2))
|
|
||||||
{
|
|
||||||
int newSizeX, newSizeY;
|
|
||||||
float factorX = ((float)XRES/2)/((float)savePreview->Width);
|
|
||||||
float factorY = ((float)YRES/2)/((float)savePreview->Height);
|
|
||||||
float scaleFactor = factorY < factorX ? factorY : factorX;
|
|
||||||
savePreview->Data = Graphics::resample_img(savePreview->Data, savePreview->Width, savePreview->Height, savePreview->Width*scaleFactor, savePreview->Height*scaleFactor);
|
|
||||||
savePreview->Width *= scaleFactor;
|
|
||||||
savePreview->Height *= scaleFactor;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
PreviewView::~PreviewView()
|
PreviewView::~PreviewView()
|
||||||
{
|
{
|
||||||
if(addCommentBox)
|
if(addCommentBox)
|
||||||
|
@ -49,6 +49,7 @@ class PreviewView: public ui::Window {
|
|||||||
int votesDown;
|
int votesDown;
|
||||||
bool doOpen;
|
bool doOpen;
|
||||||
bool showAvatars;
|
bool showAvatars;
|
||||||
|
bool prevPage;
|
||||||
|
|
||||||
int commentBoxHeight;
|
int commentBoxHeight;
|
||||||
float commentBoxPositionX;
|
float commentBoxPositionX;
|
||||||
|
Reference in New Issue
Block a user