static private void UpdateCursor()
        {
            Noesis.Rect rect = focused.GetRangeBounds((uint)focused.CaretIndex, (uint)focused.CaretIndex);
            Matrix4     m    = focused.TextView.TransformToAncestor(focused.View.Content);

            Noesis.Vector4 v = new Noesis.Vector4(rect.Location.X, rect.Location.Y + rect.Size.Height, 0, 1) * m;
            Input.compositionCursorPos = new UnityEngine.Vector2(v.X, v.Y + 25);
        }
示例#2
0
        /// <summary>
        /// Create the border geometry.
        /// </summary>
        /// <param name="ha">The horizontal alignment.</param>
        /// <param name="va">The vertical alignment.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="margin">The margin.</param>
        /// <returns>The border geometry.</returns>
        private Geometry CreateBorderGeometry(
            HorizontalAlignment ha, VerticalAlignment va, double width, double height, out Thickness margin)
        {
            float m    = (float)this.Distance;
            var   rect = new Noesis.Rect(
                ha == HorizontalAlignment.Left ? m : 0f, va == VerticalAlignment.Top ? m : 0f, (float)width, (float)height);

            margin = new Thickness(
                ha == HorizontalAlignment.Left ? m : 0f,
                va == VerticalAlignment.Top ? m : 0f,
                ha == HorizontalAlignment.Right ? m : 0f,
                va == VerticalAlignment.Bottom ? m : 0f);
            return(new RectangleGeometry {
                Rect = rect, RadiusX = (float)this.CornerRadius, RadiusY = (float)this.CornerRadius
            });
        }
        /// <summary>
        /// Draws a collection of ellipses, where all have the same stroke and fill.
        /// This performs better than calling DrawEllipse multiple times.
        /// </summary>
        /// <param name="rectangles">The rectangles.</param>
        /// <param name="fill">The fill color. If set to <c>OxyColors.Undefined</c>, the ellipses will not be filled.</param>
        /// <param name="stroke">The stroke color. If set to <c>OxyColors.Undefined</c>, the ellipses will not be stroked.</param>
        /// <param name="thickness">The stroke thickness (in device independent units, 1/96 inch).</param>
        public override void DrawEllipses(IList <OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness)
        {
            var path = this.CreateAndAdd <Path>();

            this.SetStroke(path, stroke, thickness);
            if (!fill.IsUndefined())
            {
                path.Fill = this.GetCachedBrush(fill);
            }

            var gg = new GeometryGroup {
                FillRule = FillRule.Nonzero
            };

            foreach (var rect in rectangles)
            {
                Noesis.Rect r = this.ToRect(rect);

                gg.Children.Add(new EllipseGeometry(new Noesis.Point(r.X + r.Width / 2, r.Y + r.Height / 2), r.Width / 2, r.Height / 2));
                //gg.Children.Add(new EllipseGeometry(this.ToRect(rect)));
            }

            path.Data = gg;
        }