Javascript Draw2D设定位置

Javascript Draw2D设定位置,javascript,draw2d-js,Javascript,Draw2d Js,我是这个库的新手,似乎找不到任何关于如何调整画布大小和位置的详细信息。希望这里有人能指导我以最好的方式定位画布 $(window).load(function () { // create the canvas for the user interaction // var canvas = new draw2d.Canvas("gfx_holder"); // unmarshal the JSON document into the canvas

我是这个库的新手,似乎找不到任何关于如何调整画布大小和位置的详细信息。希望这里有人能指导我以最好的方式定位画布

   $(window).load(function () {


    // create the canvas for the user interaction
    //
    var canvas = new draw2d.Canvas("gfx_holder");

    // unmarshal the JSON document into the canvas
    // (load)
    var reader = new draw2d.io.json.Reader();
    reader.unmarshal(canvas, jsonDocument);

    // display the JSON document in the preview DIV
    //
    displayJSON(canvas);

    // add an event listener to the Canvas for change notifications.
    // We just dump the current canvas document into the DIV
    //
    canvas.getCommandStack().addEventListener(function (e) {
        if (e.isPostChangeEvent()) {
            displayJSON(canvas);
        }
    });
});

function displayJSON(canvas) {
    var writer = new draw2d.io.json.Writer();
    writer.marshal(canvas, function (json) {
        $("#json").text(JSON.stringify(json, null, 2));
    });
}
“gfx_holder”是HTML元素的id。可以使用常规JavaScript设置宽度和高度