refactor(core): change drag element detection to data attr, fixes #1656 (#1659)

This commit is contained in:
Lucas Fernandes Nogueira 2021-04-29 20:38:19 -03:00 committed by GitHub
parent df8bdcf063
commit 4f1e87f87b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 4 deletions

View File

@ -0,0 +1,5 @@
---
"tauri": patch
---
Change draggable region element detection from `drag-region` class to `data-tauri-drag-region` attribute.

View File

@ -189,7 +189,8 @@ if (!String.prototype.startsWith) {
// drag region // drag region
document.addEventListener('mousedown', (e) => { document.addEventListener('mousedown', (e) => {
if (e.target.classList.contains('drag-region') && e.buttons === 1) { // start dragging if the element has a `tauri-drag-region` data attribute
if (e.target.dataset.tauriDragRegion === '' && e.buttons === 1) {
window.__TAURI__.invoke('tauri', { window.__TAURI__.invoke('tauri', {
__tauriModule: "Window", __tauriModule: "Window",
message: { message: {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -80,7 +80,7 @@
</script> </script>
<main> <main>
<div class="flex row noselect just-around" style="margin=1em;"> <div class="flex row noselect just-around" style="margin=1em;" data-tauri-drag-region>
<img src="tauri.png" height="60" on:click={onLogoClick} alt="logo" /> <img src="tauri.png" height="60" on:click={onLogoClick} alt="logo" />
<div> <div>
<a class="dark-link" target="_blank" href="https://tauri.studio/en/docs/getting-started/intro"> <a class="dark-link" target="_blank" href="https://tauri.studio/en/docs/getting-started/intro">