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

🧪 [Experiment] CanvasView - Template and Manipulation enabled Canvas #212

Open
3 of 22 tasks
michael-hawker opened this issue Jul 20, 2022 · 6 comments · Fixed by #214
Open
3 of 22 tasks

🧪 [Experiment] CanvasView - Template and Manipulation enabled Canvas #212

michael-hawker opened this issue Jul 20, 2022 · 6 comments · Fixed by #214
Labels
experiment 🧪 Used to track issues that are experiments (or their linked discussions)

Comments

@michael-hawker
Copy link
Member

michael-hawker commented Jul 20, 2022

Approved from Toolkit

See previous work here:

Problem Statement (copied from Discussion):

I find myself writing this control over and over in various projects and it's never very good. I'd love a control that would be a sibling to ListView or GridView only it was backed by a 2D Canvas instead of an ItemsStackPanel.

Overview

This experiment adds the following components:

  • CanvasView a light-weight ItemsControl backed by a Canvas that allows templating and manipulation of its items (if desired).

Using

You can try it out via the NuGet Packages here:

Read more about Preview Packages here.

CommunityToolkit members can also try it out with Codespaces.

TO DO

Implementation Requirements

Not all these items are required to submit a PR. This list is here to help track what is remaining to implement before a technical review and discussion of moving into the main repository can occur.

  • Working Prototype
  • Feature Complete
  • Documentation
  • Samples
  • Tests
  • Community Feedback / Usage Testimonies

Tested Platforms

  • UWP
  • WinAppSDK / WinUI 3
  • Web Assembly (WASM)
  • Android
  • iOS
  • MacOS
  • Linux / GTK

Technical Review

These items can sometimes be done ahead of time, but are usually started and completed after all implementation details are finished.

  • Accessibility Audit
  • API/Naming Review
  • Code Quality/Style
  • Dependency Review
  • Design/Style Review
  • Final Approval
@michael-hawker michael-hawker added the experiment 🧪 Used to track issues that are experiments (or their linked discussions) label Jul 20, 2022
@michael-hawker michael-hawker added this to the Initial Release milestone Jul 20, 2022
@michael-hawker
Copy link
Member Author

Have a local stash switching the Manipulation code to Cumulative over Delta, indeed resolves the drift issue I was seeing just like we did with the SizerBase. However, in testing, I noticed a big issue with ManipulationStarting not working in WinUI 3 - see microsoft/microsoft-ui-xaml#6847. This is effecting SizerBase too most likely (not sure how we didn't notice earlier).

@michael-hawker michael-hawker linked a pull request Nov 2, 2022 that will close this issue
@michael-hawker
Copy link
Member Author

Realized that to work for more than the current screen (i.e. you want large canvas area in a ScrollViewer) we need to resize the Canvas Width/Height to wrap around contents of Canvas. This will involve more tracking than currently done by the control.

Added as a TODO.

@kmgallahan
Copy link
Contributor

kmgallahan commented Mar 19, 2023

In the sample app the shapes don't follow drag input correctly. The shape and cursor start drifting apart immediately after starting movement, and the gap gets larger as more dragging is done.

Unsure if a DPI scaling issue. I was using 125%, but switching to 100% and relaunching the app didn't help.

@michael-hawker
Copy link
Member Author

Thanks @kmgallahan, was that using UWP or the WindowsAppSDK (or both)? Definitely need to look back into this, was going to investigate trying to do absolute vs. relative positioning like I did for the splitter controls, but that requires storing state, which I don't think I had an easy way to do in the current setup.

@Basnederveen
Copy link

Basnederveen commented Aug 21, 2023

I've removed the height/width properties and the drift is gone.

Could it be related to the fact that the clicked position is relative to origin of the dragged control but we are setting the position of the origin of the dragged control?

@Basnederveen
Copy link

How would you approach switching the ItemsControl for a Selector?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experiment 🧪 Used to track issues that are experiments (or their linked discussions)
Projects
Status: No status
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants