Reputation: 1646
I have Path that I'm creating once, and adding Rect to it.
On some event I'm offsetting the path by Path.offset(...)
or Path.transform(...)
and then invalidating my canvas for redrawing the path.
But the path is not redrawing in the new place.
I checked the path bounds by using Path.computeBounds(...)
and I see that the rectangle moved. So I don't understand why Canvas.drawPath(...)
is not redrawing the path in the new place.
The only way I managed to make the path redrawn in the new place is to make new path and add the transformed path to it, but I don't really want to do it every time.
m_objPath.offset(p_fltDx, p_fltDy);
//////////////////////////////
// With this lines it makes the path redrawn in the right place - but why should i ??
Path objPath = new Path();
objPath.addPath(m_objPath);
m_objPath = objPath;
//////////////////////////////
m_objCanvas.invalidate();
.
.
.
m_objCanvas.drawPath(m_objPath, m_objPaint);
Any suggestions?
Upvotes: 2
Views: 599
Reputation: 3296
I tested the issue with Path.offset(..)
against Android 4.1 and Android 2.3:
offset(..)
works ok. So just drop using Path...
Upvotes: 1