File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,11 @@ void ProjectLoader::timerEvent(QTimerEvent *event)
227227 return;
228228
229229 if (m_engine) {
230+ for (Monitor *monitor : m_unpositionedMonitors)
231+ monitor->autoPosition(m_engine->monitors());
232+
233+ m_unpositionedMonitors.clear();
234+
230235 m_engine->step();
231236
232237 if (m_running != m_engine->isRunning()) {
@@ -245,6 +250,7 @@ void ProjectLoader::callLoad(ProjectLoader *loader)
245250
246251void ProjectLoader::load()
247252{
253+ m_unpositionedMonitors.clear();
248254 m_loadStatus = m_project.load();
249255 m_engineMutex.lock();
250256 m_engine = m_project.engine().get();
@@ -401,6 +407,11 @@ void ProjectLoader::addMonitor(Monitor *monitor)
401407 if (!model)
402408 return;
403409
410+ if (monitor->needsAutoPosition()) {
411+ if (std::find(m_unpositionedMonitors.begin(), m_unpositionedMonitors.end(), monitor) == m_unpositionedMonitors.end())
412+ m_unpositionedMonitors.push_back(monitor);
413+ }
414+
404415 model->moveToThread(qApp->thread());
405416 model->setParent(this);
406417 monitor->setInterface(model);
Original file line number Diff line number Diff line change @@ -151,6 +151,7 @@ class ProjectLoader : public QObject
151151 QList<SpriteModel *> m_sprites;
152152 QList<SpriteModel *> m_clones;
153153 QList<MonitorModel *> m_monitors;
154+ std::vector<libscratchcpp::Monitor *> m_unpositionedMonitors;
154155 QStringList m_unsupportedBlocks;
155156 double m_fps = 30;
156157 bool m_turboMode = false;
You can’t perform that action at this time.
0 commit comments