Comment 0 for bug 1503882

Revision history for this message
su_v (suv-lp) wrote :

Several 'Render' extensions use self.view_center to place new objects into the current layer (or group). None of them take parent transforms on layers (e.g. after a change of the page height/orientation or a resize of the page to drawing/selection) into account.

The proposed patch adds a new function to simpletransform.py, computePointInNode(), which can be used to convert self.view_center into coordinates which compensate any parent transforms of the current layer.

Affected extensions (using self.view_center):
  grid_cartesian.py
  grid_isometric.py
  grid_polar.py
  hershey.py
  lindenmayer.py
  polyhedron_3d.py
  render_barcode.py
  render_barcode_datamatrix.py
  render_barcode_qrcode.py
  render_gear_rack.py
  render_gears.py
  rtree.py
  spirograph.py
  triangle.py
  whirl.py
  wireframe_sphere.py

Changes to simpletransform.py
1) the function invertTransform() is copied from voronoi2svg.py (a later commit could remove the original version in voronoi2svg to avoid two copies).
2) a new function computePointInNode() which takes a point [x, y] and a XML node as arguments, is added. This function is called by all affected Render extensions.

TODO:
- Handle exception when current layer is document root.