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


    Jun 24 2012 | 10:19 pm
    Hi there, I looked for how to do that in docs, no success. I probably missed something.
    Anyone ?

    • Jun 25 2012 | 4:35 pm
      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
    • Jun 25 2012 | 4:46 pm
      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
    • Jun 25 2012 | 5:03 pm
      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.
    • Jun 25 2012 | 5:09 pm
      important is to know how it works for each one of us in our own world and need