Hi,
everyone. Congratulations on 1.0! It's awesome!
I want to create a fully scalable GFX/GFX3D site. Until now GFX scales perfectly if I define a surface as follows :
dojoGFX_Main_surface=dojox.gfx.createSurface(dojo.byId("dojoGFX_Main"),"100%","100%");
(
)
However, the base-class for all my GFXs has to set diffrent transformation factors depending on whether the browser is IE or another one. This is the code of the class :
dojo.provide("WaXCode.Waxxon.dojo.gfx.Kernel");
dojo.require("dojox.gfx");
dojo.declare("WaXCode.Waxxon.dojo.gfx.Kernel",null,{
constructor:function(id,surface,group,matrix){
this.id =id;
this.surface =surface;
this.group =group;
this.matrix =matrix;
var xScale=1;
if(dojo.isIE) xScale=0.100;
this.group.setTransform(this.matrix.scale(xScale,0.78));},
resize:function(newWidth,newHeight){if(!dojo.isIE) this.group.setTransform(this.matrix.scale(newWidth/1000,newHeight/1220));},
prepare:function(){
this.group.createRect({x:300,y:300,width:300,height:300}).setFill("black");
}
});
Since I'm new to GFX I wonder if it is really neccesary to provide different scaling values for different browsers and to perform a scale on resize for every browser except IE. Also, if something is drawn out of the 1000x1000 bound, scrollbars are shown to be able to scroll to the out of bounds area drawn. Is there a way to prevent the scrollbars from showing up so that the user can't see nothing from what is drawn out the 1000x1000 region?
GFX3D gives me even more trouble. In IE the 3d obejcts scale automatically, as the 2d object do, but Opera & Netscape just don't. My base-class for GFX3D is :
dojo.provide("WaXCode.Waxxon.dojo.gfx.kernel.ThirdD");
dojo.require("WaXCode.Waxxon.dojo.gfx.Kernel");
dojo.require("dojox.gfx3d");
dojo.declare("WaXCode.Waxxon.dojo.gfx.kernel.ThirdD",WaXCode.Waxxon.dojo.gfx.Kernel,{
constructor:function(id,surface,group){
this.view=surface.createViewport();this.a=true;
this.view.setDimensions({width:1000,height:1000});
var m = dojox.gfx3d.matrix;
var camera = [m.cameraRotateXg(0), m.cameraRotateYg(0), m.cameraTranslate(470, 50, 0)];
this.view.applyCameraTransform(camera);},
resize:function(newWidth,newHeight){this.inherited(arguments);
if(dojo.isIE ) return ;
this.view.applyTransform(dojox.gfx3d.matrix.scale(12,0.4));
},
ieFixY:function(y,z){
if( dojo.isIE ) return y ;
return z ;},
ieFixZ:function(y,z){
if( dojo.isIE )return z ;
return y ;},
prepare:function(){this.inherited(arguments);
this.view.setLights([{direction: {x: -510, y: -505, z: 505}, color: "white"}],
{color:"white", intensity: 2}, "white");
var m = dojox.gfx3d.matrix;
//IE coordinates to draw the bottom's x y in the surface's center.
//var l = this.view.createCube({bottom: {x: 500, y: this.ieFixY(500,500), z: this.ieFixZ(500,500)}, top:{x:500.50, y: this.ieFixY(550,500), z: this.ieFixZ(500,550)}})
//Opera coordinates
var l = this.view.createCube({bottom: {x: 500, y: -500, z: this.ieFixZ(5,5)}, top: {x: 1200, y: this.ieFixY(550,500), z: this.ieFixZ(500,550)}})
.setFill({type: "plastic", finish: "dull", color: "lime"});
var camera = [m.cameraRotateXg(0), m.cameraRotateYg(0), m.cameraTranslate(470, 50, 0)];
// this.view.applyTransform(dojox.gfx3d.matrix.scale(0.1));
// this.view.applyCameraTransform(camera);
this.view.render();
}
});
I just want to be able to draw 2d & 3d objects in the same 1000x1000 area that fills out the entire Browser window, scales automatically on resize and draws the same on every browser. Could someone give me a hint on how to accomplish that or point to a GFX3D tutorial ( I wasn't able to find one, yet )?
ThanX in advance.

One way to go about
One way to go about automatic resizing is to do it programmatically — connect to the proper events (onresize?) and resize the surface using pixel coordinates. It should work predictably in all supported browsers without any magic. The same goes for scrollbars — if your surface fits the window, you don't have to scroll, yet you can draw outside of the surface, and it will be clipped.
Thanx!
Thanx Eugene,
by now I found out how to do it and both classes I coded work perfectly in scaling 2d&3d now. But still I had to use specific code for IE and non IE browsers, there was no appearent workaround for that.
And thanx for pointing me to "clipping". After reading your post it was clear to me that setting the DIV's overflow property to hidden could do the job and it worked.
Bye!