/** * @brief Update the scrollable view */ void uiMaterialEditorNode::updateView (uiNode_t* node, bool reset) { const int imageCount = UI_MaterialEditorNodeGetImageCount(node); const int imagesPerLine = (node->box.size[0] - node->padding) / (IMAGE_WIDTH + node->padding); const int imagesPerColumn = (node->box.size[1] - node->padding) / (IMAGE_WIDTH + node->padding); /* update view */ if (imagesPerLine > 0 && imagesPerColumn > 0) { const int pos = reset ? 0 : -1; setScrollY(node, pos, imagesPerColumn, imageCount / imagesPerLine); } else setScrollY(node, 0, 0, 0); }
/** * @brief Update the scrollable view */ static void UI_MaterialEditorNodeUpdateView (uiNode_t *node, qboolean reset) { const int imageCount = UI_MaterialEditorNodeGetImageCount(node); const int imagesPerLine = (node->size[0] - node->padding) / (IMAGE_WIDTH + node->padding); const int imagesPerColumn = (node->size[1] - node->padding) / (IMAGE_WIDTH + node->padding); /* update view */ if (imagesPerLine > 0 && imagesPerColumn > 0) { const int pos = reset ? 0 : -1; UI_AbstractScrollableNodeSetY(node, pos, imagesPerColumn, imageCount / imagesPerLine); } else UI_AbstractScrollableNodeSetY(node, 0, 0, 0); }