mira
mira

Reputation: 1056

How to fit workarea height to fill the screen in Svg-edit?

It it possible to set workarea height of svg-edit to dynamiccaly fit the screen height ? Now there is possibility to change the workare size in file config.js (for example 640x480, 800x600). But how can I change this workarea to fit the screen dynamically ? There is not important how many pixels workarea has but I need zoom workarea to fit the screen. I would like to make editor window with workarea height to fill actual browser screen (zooming disabled, workarea expands to whole browser window). Is it possible to set this using config files or it needs som implementation into core files ?

Here is a part of config.js:

svgEditor.setConfig({dimensions: [640, 480],
emptyStorageOnDecline: true
allowedOrigins: [window.location.origin] // May be 'null' (as a string) when
used as a file:// URL
});

Here is a part of code in svg-editor.html I am working with:

 <div id="workarea">
<style id="styleoverrides" type="text/css" media="screen" scoped="scoped"
</style>
<div id="svgcanvas" style="position:relative">
</div>
</div>

original svg-edit workarea with pixels 640x480

Upvotes: 0

Views: 656

Answers (1)

GoTeamScotch
GoTeamScotch

Reputation: 51

function getDimensions() {
    // do something here to get your height and width values
    var x = 640,
        y = 480;

    return [x,y];
}

svgEditor.setConfig({
    dimensions: getDimensions()
});

If you want the workarea to change as the user resizes the window then you'll also need to bind window.onresize to change SVG-Edit's canvas size using svgCanvas.setResolution().

Hopefully that helps.

Upvotes: 0

Related Questions