Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Change log
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*

- [9.0.0-dev (TBD)](#900-dev-tbd)
- [9.0.0 (2023-08-23)](#900-2023-08-23)
- [8.4.0 (2023-07-20)](#840-2023-07-20)
- [8.3.0 (2023-06-13)](#830-2023-06-13)
Expand Down Expand Up @@ -93,6 +94,10 @@ Change log

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## 9.0.0-dev (TBD)
* tweak to `fitToContent` [#2412](from https://github.com/gridstack/gridstack.js/pull/2412#issuecomment-1690219018)
* fix [#2413](https://github.com/gridstack/gridstack.js/issues/2413) support touchscreen+mouse devices. Thank you [@Ruslan207](https://github.com/Ruslan207)

## 9.0.0 (2023-08-23)
- feat [#404](https://github.com/gridstack/gridstack.js/issues/404) added `GridStackOptions.fitToContent` and `GridStackWidget.fitToContent` to make gridItems size themselves to their content (no scroll bar), calling `GridStack.resizeToContent(el)` whenever the grid or item is resized.
- also added new `'resizecontent'` event, and `resizeToContentCB` and `resizeToContentParent` vars.
Expand Down
23 changes: 10 additions & 13 deletions src/dd-touch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,8 @@ export function touchend(e: TouchEvent): void {
*/
export function pointerdown(e: PointerEvent): void {
// console.log("pointer down")
if (e.pointerType !== 'mouse') {
(e.target as HTMLElement).releasePointerCapture(e.pointerId) // <- Important!
}
if (e.pointerType === 'mouse') return;
(e.target as HTMLElement).releasePointerCapture(e.pointerId) // <- Important!
}

export function pointerenter(e: PointerEvent): void {
Expand All @@ -187,9 +186,8 @@ export function pointerenter(e: PointerEvent): void {
return;
}
// console.log('pointerenter');
if (e.pointerType !== 'mouse') {
simulatePointerMouseEvent(e, 'mouseenter');
}
if (e.pointerType === 'mouse') return;
simulatePointerMouseEvent(e, 'mouseenter');
}

export function pointerleave(e: PointerEvent): void {
Expand All @@ -199,12 +197,11 @@ export function pointerleave(e: PointerEvent): void {
// console.log('pointerleave ignored');
return;
}
if (e.pointerType !== 'mouse') {
DDTouch.pointerLeaveTimeout = window.setTimeout(() => {
delete DDTouch.pointerLeaveTimeout;
// console.log('pointerleave delayed');
simulatePointerMouseEvent(e, 'mouseleave');
}, 10);
}
if (e.pointerType === 'mouse') return;
DDTouch.pointerLeaveTimeout = window.setTimeout(() => {
delete DDTouch.pointerLeaveTimeout;
// console.log('pointerleave delayed');
simulatePointerMouseEvent(e, 'mouseleave');
}, 10);
}