Use Contains Method With Item Within A Group2D

I am trying to solve a bug in my app and I do not know what the source of it is. I am guessing it has something to do with attempting to use the Contains method with a PixmapShape within a Group2D? It does not seem to register the rotation of the parent.

It’s just because the vector classes do not seem to have a parent-child relationship recorded for you. It seems to only record the items within a Group2D but it’s not suited for getting hold of the parent from the child by default. I have written my own classes (which interact with native Object2Ds in Xojo) to suite my needs to tackle some issues with limitations of the built-in vector classes.

I cannot get my head around the issue. It’s only an issue if you rotate the Group2D not the PixmapShape itself (I believe).

Thanks

Ahem, what is the problem? What bug do you want to solve? What are you seeing and what do you expect. Some more details, please.

The problem is when I rotate the Group2D and use Contains method on a PixmapShape within that Group2D, the rotation of the Group2D does not seem to make a difference with the Group2D’s contains method.

I’m not seeing a problem. This code in a Canvas only beeps when clicking on the green picture.

Property grp As Group2D
Property pix As PixmapShape

Sub Open()
  dim p As new Picture(300, 200)
  p.Graphics.ForeColor = &c008000
  p.Graphics.FillRect 0, 0, p.Width, p.Height
  
  pix = new PixmapShape(p)
  pix.X = 100
  pix.Y = 100
  pix.Rotation = 0.4
  pix.Scale = 1.3
  
  grp = new Group2D
  grp.Append pix
  grp.X = 200
  grp.Y = 200
  grp.Scale = 0.5
  grp.Rotation = 0.7
  
  me.Invalidate
End Sub

Sub Paint(g As Graphics, areas() As REALbasic.Rect)
  g.ForeColor = &cFFFFFF
  g.FillRect 0, 0, g.Width, g.Height
  g.DrawObject grp, 0, 0
End Sub

Function MouseDown(X As Integer, Y As Integer) As Boolean
  if pix.Contains(X, Y) then beep
End Function

[quote=221265:@Will Shank]I’m not seeing a problem. This code in a Canvas only beeps when clicking on the green picture.

[code]
Property grp As Group2D
Property pix As PixmapShape

Sub Open()
dim p As new Picture(300, 200)
p.Graphics.ForeColor = &c008000
p.Graphics.FillRect 0, 0, p.Width, p.Height

pix = new PixmapShape§
pix.X = 100
pix.Y = 100
pix.Rotation = 0.4
pix.Scale = 1.3

grp = new Group2D
grp.Append pix
grp.X = 200
grp.Y = 200
grp.Scale = 0.5
grp.Rotation = 0.7

me.Invalidate
End Sub

Sub Paint(g As Graphics, areas() As REALbasic.Rect)
g.ForeColor = &cFFFFFF
g.FillRect 0, 0, g.Width, g.Height
g.DrawObject grp, 0, 0
End Sub

Function MouseDown(X As Integer, Y As Integer) As Boolean
if pix.Contains(X, Y) then beep
End Function
[/code][/quote]
I thought there might be relative rotation if you rotate an item within the group. But it seems to only work from rotating the parent to get a relative rotation for the items within the group.