Commit 7d4c8790 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[graph] correctly make screenshot of multiple canvases in sigma

parent 8ba2cb0e
......@@ -55,7 +55,6 @@ cameraButton session id sigmaRef = simpleButton {
let sigma = R.readRef sigmaRef
Sigmax.dependOnSigma sigma "[cameraButton] sigma: Nothing" $ \s -> do
screen <- Sigma.takeScreenshot s
log2 "[cameraButton] screenshot" screen
launchAff_ $ do
uploadArbitraryDataURL session id (Just "screenshot.png") screen
, text: "Screenshot"
......
......@@ -191,7 +191,13 @@ function bindMouseSelectorPlugin(left, right, sig) {
function bind(sigma, event, handler) { sigma.bind(event, handler); }
function takeScreenshot(sigma) {
return sigma.renderers[0].container.lastChild.toDataURL();
let c = sigma.renderers[0].container;
let edges = c.getElementsByClassName('sigma-edges')[0];
let scene = c.getElementsByClassName('sigma-scene')[0];
let sceneCtx = scene.getContext('2d');
sceneCtx.globalAlpha = 1;
sceneCtx.drawImage(edges, 0, 0);
return scene.toDataURL('image/png');
}
exports._sigma = _sigma;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment