comparison layer/RegionLayer.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 bd7fdc418f36
children 4f8c72adbf43
comparison
equal deleted inserted replaced
1532:14a162f6870f 1533:37df1530519d
1454 to.addPoint(p.withReferenceFrame(alignToReference(v, p.getFrame()))); 1454 to.addPoint(p.withReferenceFrame(alignToReference(v, p.getFrame())));
1455 } 1455 }
1456 } 1456 }
1457 1457
1458 bool 1458 bool
1459 RegionLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t /* frameOffset */, bool /* interactive */) 1459 RegionLayer::paste(LayerGeometryProvider *v, const Clipboard &from,
1460 sv_frame_t /* frameOffset */, bool /* interactive */)
1460 { 1461 {
1461 auto model = ModelById::getAs<RegionModel>(m_model); 1462 auto model = ModelById::getAs<RegionModel>(m_model);
1462 if (!model) return false; 1463 if (!model) return false;
1463 1464
1464 const EventVector &points = from.getPoints(); 1465 const EventVector &points = from.getPoints();
1502 } else { 1503 } else {
1503 frame = i->getFrame(); 1504 frame = i->getFrame();
1504 } 1505 }
1505 } 1506 }
1506 1507
1507 Event p = *i; 1508 Event p = i->withFrame(frame);
1509
1508 Event newPoint = p; 1510 Event newPoint = p;
1509 if (!p.hasValue()) { 1511 if (!p.hasValue()) {
1510 newPoint = newPoint.withValue((model->getValueMinimum() + 1512 newPoint = newPoint.withValue((model->getValueMinimum() +
1511 model->getValueMaximum()) / 2); 1513 model->getValueMaximum()) / 2);
1512 } 1514 }