Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish implementing Line and remove LineView #3014

Open
1 of 8 tasks
Tracked by #2994
tig opened this issue Nov 26, 2023 · 0 comments
Open
1 of 8 tasks
Tracked by #2994

Finish implementing Line and remove LineView #3014

tig opened this issue Nov 26, 2023 · 0 comments
Assignees
Milestone

Comments

@tig
Copy link
Collaborator

tig commented Nov 26, 2023

This is a sub-issue of:

Todo

Background

Sometime back I implemented Line. It is extremely simple right now:

/// <summary>
/// Draws a single line using the <see cref="LineStyle"/> specified by <see cref="View.BorderStyle"/>.
/// </summary>
public class Line : View {
	private Orientation _orientation;

	/// <summary>
	/// The direction of the line.  If you change this you will need to manually update the Width/Height
	/// of the control to cover a relevant area based on the new direction.
	/// </summary>
	public Orientation Orientation { get => _orientation; set => _orientation = value; }

	/// <summary>
	/// Constructs a Line object.
	/// </summary>
	public Line ()
	{

	}

	/// <inheritdoc/>
	public override bool OnDrawFrames ()
	{
		var screenBounds = BoundsToScreen (Bounds);
		LineCanvas lc;

		lc = SuperView?.LineCanvas;
		lc.AddLine (screenBounds.Location, Orientation == Orientation.Horizontal ? Frame.Width : Frame.Height, Orientation, BorderStyle);

		return true;
	}

	//public override void OnDrawContentComplete (Rect contentArea)
	//{
	//	var screenBounds = ViewToScreen (Frame);

	//}

	/// <inheritdoc/>
	public override void OnDrawContent (Rect contentArea)
	{
		OnDrawFrames ();
	}
}

Note the comments in the code are wrong and it's buggy (assumes Bounds == Frame).

My dream is that it gets enhanced to take the code that's in TileView for dragging an edge with keyboard/mouse (showing a diamond) so that I can be used as the basis for any "view edge drag operation".

If we do this, and then use Line objects for the top, right, bottom, and left of a view's Border frame, all mouse/keyboard dragging logic for View resizing (see #2537) will be nicely encapsulated.

TileView then can be removed and replaced with a tiled-layout mode. See #2491.

@tig tig changed the title Finish implementing 'Line' and remove LineView Finish implementing Line and remove LineView Nov 26, 2023
@tig tig moved this to 🔖 Ready in Terminal.Gui V2 Beta May 12, 2024
@tig tig moved this from 🔖 Ready to 📋 Approved - Need Owner in Terminal.Gui V2 Beta May 13, 2024
@tig tig added this to the V2 Beta milestone May 25, 2024
@tig tig self-assigned this Jul 11, 2024
@tig tig moved this to 🏗 Approved - In progress in Terminal.Gui V2 Initial Release Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗 Approved - In progress
Status: 📋 Approved - Need Owner
Development

No branches or pull requests

1 participant