Skip to content

Commit 33aaa65

Browse files
committed
make dojox.Drawing use width/height passed in to its constructor if any
!strict
1 parent 3c99d73 commit 33aaa65

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

drawing/Drawing.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ function(dojo, defaults, registry, keys, Mouse, Canvas, Undo, Anchors, Stencil,
109109
var def = dojo.attr(node, "defaults");
110110
this.defaults = def ? (typeof def === 'string' ? dojo.getObject(def) : def) : defaults;
111111

112-
this.id = node.id;
112+
this.id = node.id || dijit.getUniqueId('dojox_drawing_Drawing');
113113
registry.register(this, "drawing");
114114
this.mode = (props.mode || dojo.attr(node, "mode") || "").toLowerCase();
115115
var box = dojo.contentBox(node);
116-
this.width = box.w;
117-
this.height = box.h;
116+
this.width = props.width || box.w;
117+
this.height = props.height || box.h;
118118
utilCommon.register(this); // So Toolbar can find this Drawing DEPRECATED
119119
this.mouse = new Mouse({util:utilCommon, keys:keys, id:this.mode=="ui"?"MUI":"mse"});
120120
this.mouse.setEventMode(this.mode);
@@ -174,6 +174,7 @@ function(dojo, defaults, registry, keys, Mouse, Canvas, Undo, Anchors, Stencil,
174174
srcRefNode:this.domNode,
175175
util:utilCommon,
176176
mouse:this.mouse,
177+
width: this.width, height: this.height,
177178
callback: dojo.hitch(this, "onSurfaceReady")
178179
});
179180
this.initPlugins();

drawing/_base.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
define(["dojo", "./annotations/Label", "./Drawing"
2-
],function(dojo, Drawing){
2+
],function(dojo, L, Drawing){
33
dojo.experimental("dojox.drawing");
44
return Drawing;
55
});

drawing/manager/Canvas.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ function(dojo, oo, gfx){
1717
dojo.mixin(this, options);
1818

1919
var dim = dojo.contentBox(this.srcRefNode);
20-
this.height = this.parentHeight = dim.h;
21-
this.width = this.parentWidth = dim.w;
20+
this.height = this.parentHeight = options.height || dim.h;
21+
this.width = this.parentWidth = options.width || dim.w;
2222
this.domNode = dojo.create("div", {id:"canvasNode"}, this.srcRefNode);
2323
dojo.style(this.domNode, {
2424
width:this.width,

0 commit comments

Comments
 (0)