我是这个库的新手,似乎找不到任何关于如何调整画布大小和位置的详细信息。希望这里有人能指导我以最好的方式定位画布
$(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));
});
}发布于 2014-09-10 05:37:10
"gfx_holder“是您的HTML元素的id。您可以使用常规JavaScript设置宽度和高度。
https://stackoverflow.com/questions/23611282
复制相似问题