Fix animation break

selection
NaiJi ✨ 2 years ago
parent ed3330cb97
commit 98273d3a39

@ -2,7 +2,7 @@
int main() int main()
{ {
sf::RenderWindow window(sf::VideoMode{1280, 720}, "Test", sf::Style::Default); sf::RenderWindow window(sf::VideoMode{1280, 720}, "Test", sf::Style::Fullscreen);
ApplicationSFML app(&window); ApplicationSFML app(&window);
if (app.init()) if (app.init())
app.run(); app.run();

@ -163,6 +163,7 @@ void ClassicEditor::update(kku::UpdateData&& updatedata)
void ClassicEditor::display() const void ClassicEditor::display() const
{ {
_graphics_manager->display(); _graphics_manager->display();
_selection_manager->display();
} }
void ClassicEditor::recalculate(const kku::microsec& timestamp) void ClassicEditor::recalculate(const kku::microsec& timestamp)

@ -51,3 +51,13 @@ bool SelectionManager::isMultiselectionEnabled() const
{ {
return _multiselection_enabled; return _multiselection_enabled;
} }
void SelectionManager::display() const
{
for (const auto& note : _selected_notes)
for (const auto& element : note->getElements())
if (element.selected)
{
element.selection->display();
}
}

@ -19,6 +19,8 @@ public:
void enableMultiselection(bool enable = true); void enableMultiselection(bool enable = true);
bool isMultiselectionEnabled() const; bool isMultiselectionEnabled() const;
void display() const;
private: private:
std::vector<ClassicMockNote*> _selected_notes; std::vector<ClassicMockNote*> _selected_notes;
bool _multiselection_enabled; bool _multiselection_enabled;

@ -118,8 +118,6 @@ void ClassicSceneGraphicsManager::display(const std::vector<MockElement>& elemen
} }
sprite->display(); sprite->display();
if (elements[i].selected)
elements[i].selection->display();
} }
} }
@ -181,7 +179,7 @@ void ClassicSceneGraphicsManager::fetchFirstNote(const kku::microsec& offset)
if (offset < (*_first)->getPerfectOffset()) if (offset < (*_first)->getPerfectOffset())
{ {
Iterator note_iterator = _first; Iterator note_iterator = _first;
while (note_iterator != _timeline->begin() && !isVisiblyClose(note_iterator, offset)) while (note_iterator != _timeline->begin() && isVisiblyClose(note_iterator, offset))
{ {
--note_iterator; --note_iterator;
} }
@ -194,7 +192,7 @@ void ClassicSceneGraphicsManager::fetchFirstNote(const kku::microsec& offset)
&& offset <= note->getPerfectOffset()) && offset <= note->getPerfectOffset())
{ {
note->setState(ClassicNote::State::FLYING); note->setState(ClassicNote::State::FLYING);
note->setGraphics(this, kku::TimeRange{offset, note->getPerfectOffset()}); note->setGraphics(this, kku::TimeRange{note->getPerfectOffset() - _visibility_offset, note->getPerfectOffset()});
} }
} }
else else
@ -229,7 +227,7 @@ void ClassicSceneGraphicsManager::fetchLastNote(const kku::microsec& offset)
&& offset <= note->getPerfectOffset()) && offset <= note->getPerfectOffset())
{ {
note->setState(ClassicNote::State::FLYING); note->setState(ClassicNote::State::FLYING);
note->setGraphics(this, kku::TimeRange{offset, note->getPerfectOffset()}); note->setGraphics(this, kku::TimeRange{note->getPerfectOffset() - _visibility_offset, note->getPerfectOffset()});
} }
++note_iterator; ++note_iterator;

Loading…
Cancel
Save