comparison layer/FlexiNoteLayer.cpp @ 1533:37df1530519d

Fix failure to apply new frame when pasting events
author Chris Cannam
date Wed, 09 Oct 2019 11:51:19 +0100
parents 0fa49a6ce64f
children 4f8c72adbf43
comparison
equal deleted inserted replaced
1532:14a162f6870f 1533:37df1530519d
1738 to.addPoint(p.withReferenceFrame(alignToReference(v, p.getFrame()))); 1738 to.addPoint(p.withReferenceFrame(alignToReference(v, p.getFrame())));
1739 } 1739 }
1740 } 1740 }
1741 1741
1742 bool 1742 bool
1743 FlexiNoteLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t /*frameOffset */, bool /* interactive */) 1743 FlexiNoteLayer::paste(LayerGeometryProvider *v, const Clipboard &from,
1744 sv_frame_t /*frameOffset */, bool /* interactive */)
1744 { 1745 {
1745 auto model = ModelById::getAs<NoteModel>(m_model); 1746 auto model = ModelById::getAs<NoteModel>(m_model);
1746 if (!model) return false; 1747 if (!model) return false;
1747 1748
1748 const EventVector &points = from.getPoints(); 1749 const EventVector &points = from.getPoints();
1785 } else { 1786 } else {
1786 frame = i->getFrame(); 1787 frame = i->getFrame();
1787 } 1788 }
1788 } 1789 }
1789 1790
1790 Event p = *i; 1791 Event p = i->withFrame(frame);
1792
1791 Event newPoint = p; 1793 Event newPoint = p;
1792 if (!p.hasValue()) { 1794 if (!p.hasValue()) {
1793 newPoint = newPoint.withValue((model->getValueMinimum() + 1795 newPoint = newPoint.withValue((model->getValueMinimum() +
1794 model->getValueMaximum()) / 2); 1796 model->getValueMaximum()) / 2);
1795 } 1797 }