예제 #1
0
        //================================================================================================================
        /// <summary>
        /// Update options of the item and redraw it
        /// </summary>
        public void Redraw(TagCloudItemSize size, double scaleRatio, double opacityRatio)
        {
            //UpdateLayout();
            itemScaling.ScaleX = itemScaling.ScaleY = Math.Abs((16 + CenterPoint.Z * 4) * scaleRatio);
            Opacity            = CenterPoint.Z + opacityRatio;

            Canvas.SetLeft(this, (size.XOffset + CenterPoint.X * size.XRadius) - (ActualWidth / 2.0));
            Canvas.SetTop(this, (size.YOffset - CenterPoint.Y * size.YRadius) - (ActualHeight / 2.0));
            Canvas.SetZIndex(this, (int)(CenterPoint.Z * Math.Min(size.XRadius, size.YRadius)));
        }
예제 #2
0
        //===================================================================================================================
        /// <summary>
        /// Configure rotate transformation
        /// </summary>
        ///<param name="position">Defines the direction of rotation</param>
        private void SetRotateTransform(Point position)
        {
            TagCloudItemSize size = GetElementsSize();

            double x     = (position.X - size.XOffset) / size.XRadius;
            double y     = (position.Y - size.YOffset) / size.YRadius;
            double angle = Math.Sqrt(x * x + y * y);

            rotateTransform.Rotation = new AxisAngleRotation3D(new Vector3D(-y, -x, 0.0), angle);
        }
예제 #3
0
        //===================================================================================================================
        /// <summary>
        /// Redraw buttons with new size
        /// </summary>
        private void OnPageSizeChanged(object sender, SizeChangedEventArgs e)
        {
            if (tagCollection != null)
            {
                TagCloudItemSize size = GetElementsSize();

                foreach (TagCloudItem button in tagCollection)
                {
                    button.Redraw(size, scaleRatio, opacityRatio);
                }
            }
        }
예제 #4
0
        //===================================================================================================================
        /// <summary>
        /// Rotate blocks
        /// </summary>
        private void RotateBlocks()
        {
            TagCloudItemSize size = GetElementsSize();

            foreach (TagCloudItem TagCloudItem in tagCollection)
            {
                Point3D point3D;
                if (rotateTransform.TryTransform(TagCloudItem.CenterPoint, out point3D))
                {
                    TagCloudItem.CenterPoint = point3D;
                    TagCloudItem.Redraw(size, scaleRatio, opacityRatio);
                }
            }
        }