MCPcopy Create free account
hub / github.com/antvis/F2Native / GetPosition

Method GetPosition

core/bridge/ChartBridge.cpp:119–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119nlohmann::json ChartBridge::GetPosition(const nlohmann::json &itemData) {
120 if (chart_ == nullptr || itemData.is_null()) {
121 return {};
122 }
123 const auto &position = chart_->GetPosition(itemData);
124 auto ratio = chart_->GetCanvasContext().GetDevicePixelRatio();
125 return nlohmann::json({{"method","getPosition"}, {"position", {position.x / ratio / pixelRatio_,
126 position.y / ratio /
127 pixelRatio_}}}).dump();
128}
129
130bool ChartBridge::InvokeRender(const nlohmann::json &dsl, const nlohmann::json &itemPosition,
131 BridgeCallback callback) {

Callers 1

GetPositionsMethod · 0.45

Calls 3

GetDevicePixelRatioMethod · 0.80
dumpMethod · 0.80
GetCanvasContextMethod · 0.45

Tested by

no test coverage detected