How to setup draw mode (corner, center etc) ??

Jun 24, 2012 at 10:19pm

How to setup draw mode (corner, center etc) ??

Hi there,
I looked for how to do that in docs, no success.
I probably missed something.

Anyone ?

#43853
Jun 25, 2012 at 4:35pm

you mean JSUI?

it depends if you are using sketch or mgraphics.

it is all in the documentation. look at “javascript in max”.

sketch:

var mysketch = new Sketch(width,height);

and use
screentoworld (x,y)
and
worldtoscreen (x, y, z)

…sketch is relative coords

mgraphics:

mgraphics.init();
mgraphics.relative_coords = 1;
mgraphics.autofill = 0;

and calculate aspect with e.g.:

function calcAspect() {
var width = this.box.rect[2] – this.box.rect[0];
var height = this.box.rect[3] – this.box.rect[1];
return width/height;
}

or mgraphics.relative_coords = 0;

and calculate with pixels.

…mgraphics does both relative and non-relative coords

#157502
Jun 25, 2012 at 4:46pm

mgraphics / jsui
yes it is, but I thought about a parameter I missed.
especially, I was confused because usually, there are fixed coordinates references then some constant to draw (and fill) primitives.

in my case, I need the absolute system, and I’ll offset all my little object because absolute system means corner mode.
it isn’t a prob, just good to know :)

thanks btw

#157503
Jun 25, 2012 at 5:03pm

iv’e been discovering mgraphics recently, and i agree that this is a PITA. it particularly annoys me with the way rotation works.

however, i went and looked at cairo (which mgaphics is basically a port of) and some other vector libraries, and all of them seem to work this way. of course , too.

at least it is fine declaring many different “New MGraphics” paths all with their own independent ‘mgraphics.relative_coords’.

i am a relative noob here though, so do not listen to me.

#157504
Jun 25, 2012 at 5:09pm

important is to know how it works for each one of us in our own world and need

#157505

You must be logged in to reply to this topic.