Skip to content

Commit c1b041f

Browse files
committed
add xy shift at playback segment.
1 parent bd99a21 commit c1b041f

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

libs/ram/Core/UI/ramActorScene/PlaybackSegment.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,34 @@ void PlaybackSegment::drawImGui()
226226
if (ImGui::Button("Delete")) deleteSelf();
227227

228228
ImGui::ColorEdit3("Color", &jointColor[0]);
229+
230+
float range = 300;
231+
if (ImGui::SliderFloat2("Position", &position[0], -range, range)) saveCache();
232+
233+
ofRectangle rct;
234+
ImGui::BeginChild(getName().c_str(), ImVec2(0,100), false, ImGuiWindowFlags_NoScrollWithMouse);
235+
{
236+
rct.x = ImGui::GetWindowPos().x;
237+
rct.y = ImGui::GetWindowPos().y;
238+
rct.width = ImGui::GetWindowSize().x;
239+
rct.height = ImGui::GetWindowSize().y;
240+
241+
if (ImGui::IsWindowHovered())
242+
{
243+
CameraManager::instance().setEnableInteractiveCamera(false);
244+
if (ofGetMousePressed())
245+
{
246+
position.set(ofMap(ofGetMouseX(), rct.x, rct.x + rct.width, -range, range, true),
247+
ofMap(ofGetMouseY(), rct.y, rct.y + rct.height, -range, range, true));
248+
}
249+
}
250+
}
251+
ImGui::EndChild();
252+
ofSetColor(255);
253+
ofDrawLine(rct.x + ofMap(position.x, -range, range, 0, rct.width), rct.y,
254+
rct.x + ofMap(position.x, -range, range, 0, rct.width), rct.y + rct.height);
255+
ofDrawLine(rct.x, rct.y + ofMap(position.y, -range, range, 0, rct.height),
256+
rct.x + rct.width, rct.y + ofMap(position.y, -range, range, 0, rct.height));
229257
}
230258
ImGui::PopStyleColor();
231259
ImGui::PopID();

0 commit comments

Comments
 (0)