void InteractiveBitmaps::handleGestureEvents(const std::vector& gesture_events){ for (const auto& gesture : gesture_events){ std::wstring target(gesture.target.begin(), gesture.target.end()); // Find the name of the touch object the gesture "targets". This will be the same name we used to register // the touch object with GestureWorks auto rect = rectangles.find(target); if (rect == rectangles.end()) continue; if (gesture.gesture_id == "n-drag"){ int dx = static_cast(gesture.values.at("drag_dx") * ofGetScreenWidth()); int dy = static_cast(gesture.values.at("drag_dy") * ofGetScreenHeight()); rect->second.IncrementPosition(dx, dy); } else if (gesture.gesture_id == "n-scale"){ float ds = gesture.values.at("scale_dsx") * ofGetScreenWidth(); rect->second.IncrementScale(ds); } else if (gesture.gesture_id == "n-rotate"){ float dtheta = gesture.values.at("rotate_dtheta"); if (!dtheta) continue; std::pair center(normScreenToWindowPx(gesture.x, gesture.y)); rect->second.Rotate(dtheta, center.first, center.second); } } }