22#include " ../../ObjectNames.hpp"
33#include " ../LiveColors/LiveColors.hpp"
44#include " SearchField.hpp"
5+ #include " ../ScrollableObjects.hpp"
56#include < alphalaneous.alphas-ui-pack/include/API.hpp>
67#include < alphalaneous.editortab_api/include/EditorTabAPI.hpp>
78#include < raydeeux.gameobjectidstacksize/include/api.hpp>
@@ -29,7 +30,6 @@ bool OSEditorUI::init(LevelEditorLayer* editorLayer) {
2930
3031 auto winSize = CCDirector::get ()->getWinSize ();
3132
32-
3333 alpha::editor_tabs::addTab (" all-objects" _spr, alpha::editor_tabs::BUILD, [this , fields] () {
3434 fields->m_searchBar = alpha::editor_tabs::createEditButtonBar ({});
3535 fields->m_searchBar ->m_hasCreateItems = true ;
@@ -57,6 +57,15 @@ bool OSEditorUI::init(LevelEditorLayer* editorLayer) {
5757 LiveColors::get ()->showMenu (true );
5858 }
5959 }
60+ if (state && !fields->m_initialLoaded ) {
61+ auto arr = fields->m_searchField ->generateItemArrayForSearch (" " );
62+
63+ auto cols = GameManager::get ()->getIntGameVariable (GameVar::EditorButtonsPerRow);
64+ auto rows = GameManager::get ()->getIntGameVariable (GameVar::EditorButtonRows);
65+
66+ fields->m_searchBar ->loadFromItems (arr, cols, rows, false );
67+ fields->m_initialLoaded = true ;
68+ }
6069 });
6170
6271 runAction (CallFuncExt::create ([this , fields, objectSearch] {
@@ -92,13 +101,6 @@ bool OSEditorUI::init(LevelEditorLayer* editorLayer) {
92101 fields->m_orderedItems .push_back (&fields->m_items [cmi->m_objectID ]);
93102 }
94103 }
95-
96- auto arr = fields->m_searchField ->generateItemArrayForSearch (" " );
97-
98- auto cols = GameManager::get ()->getIntGameVariable (GameVar::EditorButtonsPerRow);
99- auto rows = GameManager::get ()->getIntGameVariable (GameVar::EditorButtonRows);
100-
101- fields->m_searchBar ->loadFromItems (arr, cols, rows, false );
102104 }));
103105
104106 return true ;
@@ -337,23 +339,9 @@ void OSEditButtonBar::loadFromItems(cocos2d::CCArray* objects, int rows, int col
337339 checkPage ();
338340}
339341
340- void OSEditButtonBar::goToPage (int page) {
341- EditButtonBar::goToPage (page);
342- checkPage ();
343- }
344-
345- void OSEditButtonBar::onLeft (cocos2d::CCObject* sender) {
346- EditButtonBar::onLeft (sender);
347- checkPage ();
348- }
349-
350- void OSEditButtonBar::onRight (cocos2d::CCObject* sender) {
351- EditButtonBar::onRight (sender);
352- checkPage ();
353- }
354-
355342void OSEditButtonBar::checkPage () {
356343 if (!m_hasCreateItems) return ;
344+ if (ScrollableObjects::isEnabled ()) return ;
357345
358346 auto pageNum = getPage ();
359347 for (auto node : m_buttonArray->asExt <CreateMenuItem>()) {
@@ -362,4 +350,13 @@ void OSEditButtonBar::checkPage() {
362350 oCmi->loadRender ();
363351 }
364352 }
353+ }
354+
355+ void OSBoomScrollLayer::instantMoveToPage (int page) {
356+ BoomScrollLayer::instantMoveToPage (page);
357+
358+ if (auto ebb = typeinfo_cast<EditButtonBar*>(getParent ())) {
359+ auto sEbb = static_cast <OSEditButtonBar*>(ebb);
360+ sEbb ->checkPage ();
361+ }
365362}
0 commit comments