fix(sidebar): disable frame CSS transition while user is resizing the sidebar to prevent janky animations
This commit is contained in:
@@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-01-04 - 3.5.1 - fix(sidebar)
|
||||||
|
disable frame CSS transition while user is resizing the sidebar to prevent janky animations
|
||||||
|
|
||||||
|
- Added isResizing boolean property to wcc-frame to toggle transitions during resize
|
||||||
|
- Set frame.isResizing = true at resize start and false on mouseup to re-enable transitions
|
||||||
|
- Updated CSS to skip transition while isResizing is true
|
||||||
|
- Files changed: ts_web/elements/wcc-frame.ts, ts_web/elements/wcc-sidebar.ts
|
||||||
|
|
||||||
## 2026-01-04 - 3.5.0 - feat(wcctools)
|
## 2026-01-04 - 3.5.0 - feat(wcctools)
|
||||||
add context menu and pinning support, persist pinned state in URL, and add grouped demo test elements
|
add context menu and pinning support, persist pinned state in URL, and add grouped demo test elements
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@design.estate/dees-wcctools',
|
name: '@design.estate/dees-wcctools',
|
||||||
version: '3.5.0',
|
version: '3.5.1',
|
||||||
description: 'A set of web component tools for creating element catalogues, enabling the structured development and documentation of custom elements and pages.'
|
description: 'A set of web component tools for creating element catalogues, enabling the structured development and documentation of custom elements and pages.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ export class WccFrame extends DeesElement {
|
|||||||
@property({ type: Number })
|
@property({ type: Number })
|
||||||
accessor sidebarWidth: number = 200;
|
accessor sidebarWidth: number = 200;
|
||||||
|
|
||||||
|
@property({ type: Boolean })
|
||||||
|
accessor isResizing: boolean = false;
|
||||||
|
|
||||||
public static styles = [
|
public static styles = [
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
@@ -59,7 +62,7 @@ export class WccFrame extends DeesElement {
|
|||||||
border: 10px solid #ffaeaf;
|
border: 10px solid #ffaeaf;
|
||||||
left: ${this.sidebarWidth}px;
|
left: ${this.sidebarWidth}px;
|
||||||
`}
|
`}
|
||||||
transition: all 0.3s ease;
|
transition: ${this.isResizing ? 'none' : 'all 0.3s ease'};
|
||||||
${this.isNative ? 'padding: 0px;' : (() => {
|
${this.isNative ? 'padding: 0px;' : (() => {
|
||||||
switch (this.viewport) {
|
switch (this.viewport) {
|
||||||
case 'desktop':
|
case 'desktop':
|
||||||
|
|||||||
@@ -768,6 +768,11 @@ export class WccSidebar extends DeesElement {
|
|||||||
const frame = this.dashboardRef?.shadowRoot?.querySelector('wcc-frame') as any;
|
const frame = this.dashboardRef?.shadowRoot?.querySelector('wcc-frame') as any;
|
||||||
const properties = this.dashboardRef?.shadowRoot?.querySelector('wcc-properties') as any;
|
const properties = this.dashboardRef?.shadowRoot?.querySelector('wcc-properties') as any;
|
||||||
|
|
||||||
|
// Disable frame transition during resize
|
||||||
|
if (frame) {
|
||||||
|
frame.isResizing = true;
|
||||||
|
}
|
||||||
|
|
||||||
const onMouseMove = (e: MouseEvent) => {
|
const onMouseMove = (e: MouseEvent) => {
|
||||||
const newWidth = Math.min(400, Math.max(150, startWidth + (e.clientX - startX)));
|
const newWidth = Math.min(400, Math.max(150, startWidth + (e.clientX - startX)));
|
||||||
this.sidebarWidth = newWidth;
|
this.sidebarWidth = newWidth;
|
||||||
@@ -784,6 +789,10 @@ export class WccSidebar extends DeesElement {
|
|||||||
this.isResizing = false;
|
this.isResizing = false;
|
||||||
document.removeEventListener('mousemove', onMouseMove);
|
document.removeEventListener('mousemove', onMouseMove);
|
||||||
document.removeEventListener('mouseup', onMouseUp);
|
document.removeEventListener('mouseup', onMouseUp);
|
||||||
|
// Re-enable frame transition
|
||||||
|
if (frame) {
|
||||||
|
frame.isResizing = false;
|
||||||
|
}
|
||||||
// Dispatch event on release for URL persistence
|
// Dispatch event on release for URL persistence
|
||||||
this.dispatchEvent(new CustomEvent('widthChanged', { detail: this.sidebarWidth }));
|
this.dispatchEvent(new CustomEvent('widthChanged', { detail: this.sidebarWidth }));
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user