question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to resize canvas?

See original GitHub issue

I try edit the height of canvas like to $('#canvas').css('height', '200px'), but this dont work. And try with document.getElementById('canvas').style.height='200px' but dont work.

I learn about map.refreshLayout(), but this dont have effect.

Example:

$('a#resize-map').click(function(){
    map.setVisible(false); // I don't think it necessary to use this function.
    $('#canvas').css('height', '200px');
    map.refreshLayout();
    map.setVisible(true);// I don't think it necessary to use this function.
    return false;
});
<html>
    <head>
        ...
    </head>
        <body>
        <div id="canvas"></div>
        <a href="#" id="resize-map">Resize canvas</a>
    </body>
</html>

I use jQuery. Thanks a lot!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
andyngdzcommented, Oct 17, 2017

Call cordova.fireDocumentEvent('plugin_touch', {});

0reactions
amirul1000commented, Mar 11, 2018

itanhduy commented on Oct 18, 2017 Call cordova.fireDocumentEvent(‘plugin_touch’, {});

that work for me after long suffer

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Resize HTML5 canvas to fit window
getContext('2d'); // Start listening to resize events and draw canvas. ... The blue border shows you the edge of the resizing canvas, and...
Read more >
Resizing the Canvas
In Edit mode, select the Resize Canvas tool from the Toolbar at the top of the panel. · Position your cursor over the...
Read more >
How to resize your image canvas
Steps to resize your image canvas · 1. Go to the Pixlr Editor website and launch the Pixlr X free edition (if you...
Read more >
Resizing the canvas
1 Choose Image Canvas Size. · 2 In the New Dimensions group box, mark the Lock aspect ratio check box. · 3 Set...
Read more >
WebGL Resizing the Canvas.
If you're on a desktop or laptop try pressing ctrl + + and ctrl + - to zoom in and out ( ⌘...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found