Board index FlightGear Development Canvas

SVG object setCenter(x,y) format for setRotation

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

SVG object setCenter(x,y) format for setRotation

Postby omega95 » Fri Jul 18, 2014 12:51 pm

I've been having trouble with this on the 2 canvas instruments (VSD, HUD) I've been working on. I was wondering of the exactly format (as in, measure from where and what's the frame of reference?) for the .setCenter function. It looks like it's not a position with respect to the display, or the object (from the top left corner)

Cheers! :)
Merlion Virtual Airlines - the experience of a flight time...
Get high quality aircraft, airports, video tutorials or development tools from my hangar.
Posts: 1223
Joined: Sat Jul 30, 2011 12:59 am
Location: -unknown-
Callsign: MIA0001, OM-EGA
IRC name: omega95
Version: 2.12 git
OS: Ubuntu 13.04

Re: SVG object setCenter(x,y) format for setRotation

Postby TheTom » Fri Jul 18, 2014 1:23 pm

The center is measured in the elements frame of reference. If you call updateCenter() it is set to the center of the bounding box (shifted by an optional offset if changed in Inkscape (dragging with MMB)).
Posts: 321
Joined: Sun Oct 09, 2011 10:20 am

Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest