comparison layer/BoxLayer.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 14c07e445365
children 873ff035364c
comparison
equal deleted inserted replaced
1532:14a162f6870f 1533:37df1530519d
1104 to.addPoint(p.withReferenceFrame(alignToReference(v, p.getFrame()))); 1104 to.addPoint(p.withReferenceFrame(alignToReference(v, p.getFrame())));
1105 } 1105 }
1106 } 1106 }
1107 1107
1108 bool 1108 bool
1109 BoxLayer::paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t /* frameOffset */, bool /* interactive */) 1109 BoxLayer::paste(LayerGeometryProvider *v, const Clipboard &from,
1110 sv_frame_t /* frameOffset */, bool /* interactive */)
1110 { 1111 {
1111 auto model = ModelById::getAs<BoxModel>(m_model); 1112 auto model = ModelById::getAs<BoxModel>(m_model);
1112 if (!model) return false; 1113 if (!model) return false;
1113 1114
1114 const EventVector &points = from.getPoints(); 1115 const EventVector &points = from.getPoints();
1152 } else { 1153 } else {
1153 frame = i->getFrame(); 1154 frame = i->getFrame();
1154 } 1155 }
1155 } 1156 }
1156 1157
1157 Event p = *i; 1158 Event p = i->withFrame(frame);
1159
1158 Event newPoint = p; 1160 Event newPoint = p;
1159 if (!p.hasValue()) { 1161 if (!p.hasValue()) {
1160 newPoint = newPoint.withValue((model->getValueMinimum() + 1162 newPoint = newPoint.withValue((model->getValueMinimum() +
1161 model->getValueMaximum()) / 2); 1163 model->getValueMaximum()) / 2);
1162 } 1164 }