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

feat: add attributes for drag region #6362

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from

Conversation

BillGoldenWater
Copy link
Contributor

@BillGoldenWater BillGoldenWater commented Feb 26, 2023

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • I have added a convincing reason for adding this feature, if necessary

Other information

It's useful for set a element that has many children draggable.

eg.

A floating window need to be draggable when drag on any where, and can toggle maximize on double click on title.

Use to need set data-tauri-drag-region everywhere, and need to manually implement it for region that doesn't need maximize.

This PR let developer could achieve this just by set body attributes to data-tauri-drag-region-container and title container to data-tauri-drag-region-container data-tauri-drag-region-titlebar.

Description:

data-tauri-drag-region: mark this element as "drag region"

data-tauri-drag-region-container: children are also considered drag regions

data-tauri-drag-region-titlebar: the "drag region" maximizes window on double click (default when only data-tauri-drag-region is used)

data-tauri-drag-region-exclude: this element doesn't trigger drag

Example:

<div class="titlebar"
     data-tauri-drag-region-container="true"
     data-tauri-drag-region-titlebar="true"
>
  <div>Title</div>
  <div>Some decoration</div>
  <button data-tauri-drag-region-exclude>close</button>
</div>

@BillGoldenWater BillGoldenWater requested a review from a team as a code owner February 26, 2023 10:56
@BillGoldenWater BillGoldenWater changed the title feat: add more option to data-tauri-drag-region attribute feat: add attributes for drag region Feb 26, 2023
Copy link
Member

@amrbashir amrbashir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you give some examples on how these might interact with each other? specifically the new ones.

core/tauri/scripts/core.js Outdated Show resolved Hide resolved
.changes/add-attribute-for-drag-region.md Outdated Show resolved Hide resolved
.changes/add-attribute-for-drag-region.md Outdated Show resolved Hide resolved
.changes/add-attribute-for-drag-region.md Outdated Show resolved Hide resolved
.changes/add-attribute-for-drag-region.md Outdated Show resolved Hide resolved
.changes/add-attribute-for-drag-region.md Outdated Show resolved Hide resolved
amr-crabnebula

This comment was marked as outdated.

Copy link
Member

@amrbashir amrbashir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more question does data-tauri-drag-region-container require data-tauri-drag-region to be also set or do they work independently? I think they should be independent from each other and if they are both present data-tauri-drag-region would take the precedence and disable all other attributes (i.e. use the old behavior)

.changes/add-attribute-for-drag-region.md Outdated Show resolved Hide resolved
@lucasfernog
Copy link
Member

I think we should target this to v2 so it also has some time to be tested by everyone while it's unstable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

Successfully merging this pull request may close these issues.

None yet

4 participants