コード例 #1
0
        static public IGlyphData GetData(this IGlyphData root, IGlyphComponent component)
        {
            if (root == null || component == null)
            {
                return(null);
            }

            foreach (IGlyphComponent parent in component.AndAllParents())
            {
                if (Tree.BreadthFirst(root, x => x.Children).Any(x => x.BindedObject == parent, out IGlyphData data))
                {
                    return(data);
                }
            }

            return(null);
        }
コード例 #2
0
        public TransformableDataController(IGlyphData data)
        {
            var anchoredController = data as IAnchoredController;

            Anchor = anchoredController?.Anchor ?? data.BindedObject.GetSceneNode();

            if (data is ITransformationController transformationController)
            {
                PositionController  = new AnchoredPositionController(transformationController.PositionController, Anchor);
                RotationController  = new AnchoredRotationController(transformationController.RotationController, Anchor);
                ScaleController     = new AnchoredScaleController(transformationController.ScaleController, Anchor);
                OrientedReferential = transformationController.OrientedReferential;
            }
            else
            {
                PositionController = data is IPositionController positionController ? new AnchoredPositionController(positionController, Anchor) : null;
                RotationController = data is IRotationController rotationController ? new AnchoredRotationController(rotationController, Anchor) : null;
                ScaleController    = data is IScaleController scaleController ? new AnchoredScaleController(scaleController, Anchor) : null;
            }
        }