コード例 #1
0
        void ValidateMatrix(bool checkParent)
        {
            if (parent != null)
            {
                if (checkParent)
                {
                    parent.ValidateMatrix(checkParent);
                }
                if (_parentMatrixVersion != parent._matrixVersion)
                {
                    _outlineChanged      = true;
                    _parentMatrixVersion = parent._matrixVersion;
                }
            }

            if (_outlineChanged)
            {
                _outlineChanged = false;
                _matrixVersion++;

                Matrix mat = ToolSet.CreateMatrix(_position, _rotation, new Vector3(_scale.X, _scale.Y, 1), _skew);
                if (parent != null)
                {
                    _localToWorldMatrix = mat * parent._localToWorldMatrix;
                }
                else
                {
                    _localToWorldMatrix = mat;
                }
            }
        }
コード例 #2
0
        void UpdatePivotOffset()
        {
            float px = _pivot.X * _contentRect.Width;
            float py = _pivot.Y * _contentRect.Height;

            Matrix  matrix = ToolSet.CreateMatrix(Vector3.Zero, _rotation, new Vector3(_scale.X, _scale.Y, 1), _skew);
            Vector3 offset = new Vector3(px, py, 0);

            Vector3.Transform(ref offset, ref matrix, out _pivotOffset);
        }