mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 03:25:14 -04:00
When holding air, inventory should open at middle instead of very bottom
This commit is contained in:
parent
c55400849c
commit
13ef73f9b7
@ -155,6 +155,8 @@ namespace ClassicalSharp.Gui.Widgets {
|
|||||||
for (int i = 0; i < Elements.Length; i++) {
|
for (int i = 0; i < Elements.Length; i++) {
|
||||||
if (Elements[i] == block) SelectedIndex = i;
|
if (Elements[i] == block) SelectedIndex = i;
|
||||||
}
|
}
|
||||||
|
// When holding air, inventory should open at middle
|
||||||
|
if (block == Block.Air) SelectedIndex = -1;
|
||||||
|
|
||||||
scroll.ScrollY = (SelectedIndex / ElementsPerRow) - (MaxRowsDisplayed - 1);
|
scroll.ScrollY = (SelectedIndex / ElementsPerRow) - (MaxRowsDisplayed - 1);
|
||||||
scroll.ClampScrollY();
|
scroll.ClampScrollY();
|
||||||
|
@ -18,7 +18,7 @@ typedef struct AsyncRequest_ {
|
|||||||
|
|
||||||
DateTime TimeAdded;
|
DateTime TimeAdded;
|
||||||
DateTime TimeDownloaded;
|
DateTime TimeDownloaded;
|
||||||
UInt8 RequestType;
|
UInt16 ResponseCode;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
struct { void* Ptr; UInt32 Size; } ResultData;
|
struct { void* Ptr; UInt32 Size; } ResultData;
|
||||||
@ -29,6 +29,7 @@ typedef struct AsyncRequest_ {
|
|||||||
|
|
||||||
DateTime LastModified; /* Time item cached at (if at all) */
|
DateTime LastModified; /* Time item cached at (if at all) */
|
||||||
UInt8 Etag[String_BufferSize(STRING_SIZE)]; /* ETag of cached item (if any) */
|
UInt8 Etag[String_BufferSize(STRING_SIZE)]; /* ETag of cached item (if any) */
|
||||||
|
UInt8 RequestType;
|
||||||
} AsyncRequest;
|
} AsyncRequest;
|
||||||
|
|
||||||
void ASyncRequest_Free(AsyncRequest* request);
|
void ASyncRequest_Free(AsyncRequest* request);
|
||||||
|
@ -867,6 +867,8 @@ void TableWidget_SetBlockTo(TableWidget* widget, BlockID block) {
|
|||||||
for (i = 0; i < widget->ElementsCount; i++) {
|
for (i = 0; i < widget->ElementsCount; i++) {
|
||||||
if (widget->Elements[i] == block) widget->SelectedIndex = i;
|
if (widget->Elements[i] == block) widget->SelectedIndex = i;
|
||||||
}
|
}
|
||||||
|
/* When holding air, inventory should open at middle */
|
||||||
|
if (block == BLOCK_AIR) widget->SelectedIndex = -1;
|
||||||
|
|
||||||
widget->Scroll.ScrollY = widget->SelectedIndex / widget->ElementsPerRow;
|
widget->Scroll.ScrollY = widget->SelectedIndex / widget->ElementsPerRow;
|
||||||
widget->Scroll.ScrollY -= (TABLE_MAX_ROWS_DISPLAYED - 1);
|
widget->Scroll.ScrollY -= (TABLE_MAX_ROWS_DISPLAYED - 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user