fix: Preserve layout styles in destroy() method

- Removed removeBasicStyles() call from destroy()
- Keeps layout styles (display: flex, alignItems, justifyContent) intact
- Only resets zoom state and removes event listeners
- Component remains visually correct after calling destroy()

This allows destroy() to be used as a manual reset method without
breaking the component's visual layout. The component can now be
safely reset without removing essential flex container styles.
This commit is contained in:
Claude 2025-11-16 14:08:33 +00:00
parent 40b485d624
commit cbb2a5532f
No known key found for this signature in database

View file

@ -1553,24 +1553,26 @@ export class IvyPinchService {
* **Cleanup:**
* - Resets zoom to original state
* - Removes CSS transforms
* - Removes CSS styles
* - Destroys touch event handlers
* - Removes event listeners
*
* **Important:** Call this when removing the component to prevent memory leaks.
* **Note:** This method resets zoom state but keeps layout styles intact,
* so the component remains functional after calling destroy().
*
* **Important:** Automatically called by component's ngOnDestroy.
* Can also be called manually to reset the component.
*
* @public
*/
public destroy(): void {
// Reset zoom to initial state before cleanup
// Reset zoom to initial state
this.scale = 1;
this.moveX = 0;
this.moveY = 0;
this.element.style.transform = 'none';
this.element.style.transition = 'none';
// Clean up styles and event listeners
this.removeBasicStyles();
// Clean up event listeners (but keep layout styles for component reusability)
this.touches.destroy();
}