Commit graph

241 commits

Author SHA1 Message Date
5acaff9a67
Merge pull request #30 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
Claude/angular signals upgrade 01 lkzye fbjsq ker2 xz a twcx h
2025-11-16 19:09:18 +02:00
Claude
3bd5482700
fix: Remove tolerance from isZoomAtMin to match brightness pattern
Fixed zoom minus button not being disabled at initial state.

The issue was the tolerance in the isZoomAtMin computed signal:
- Was: zoom <= MIN_ZOOM + 0.01 (with tolerance)
- Now: zoom <= MIN_ZOOM (exact, like brightness)

Brightness controls work perfectly because isBrightnessAtMin uses
an exact comparison without tolerance. Now zoom works the same way.

With the tolerance, the initial state (1.0) might not have been
considered "at min" depending on floating point precision, causing
the button to stay enabled when it should be disabled.
2025-11-16 17:05:35 +00:00
Claude
96458b148c
feat: Increase max ranges for custom controls example
Increased both zoom and brightness max values for better demo experience:
- maxBrightness: 2.0 → 3.0 (can brighten to 3x)
- limitZoom: 5 → 8 (can zoom to 8x)

This provides:
- Brightness: 1.0 → 3.0 (3x range, 0.1 step = 20 clicks to max)
- Zoom: 1.0 → 8.0 (8x range, 0.5 step = 14 clicks to max)

Gives users a good range to test the custom controls and see the
reset behavior when reaching maximum values.
2025-11-16 17:02:58 +00:00
3b5402b644
Merge pull request #29 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
fix: Add effect to sync zoom state and set explicit limitZoom
2025-11-16 19:00:49 +02:00
Claude
c8cfb0b339
fix: Add effect to sync zoom state and set explicit limitZoom
Fixed zoom control issues:
1. Zoom minus not disabled on initial load
2. Zoom plus stopping at 1.50 instead of continuing
3. Zoom minus not working when zoom > 1.00

Changes:
- Added effect to sync customZoomState with component's actual scale on init
- Added float tolerance (0.01) to isZoomAtMin comparison
- Set explicit [limitZoom]="5" to allow higher zoom levels
- Changed zoom handlers to check returned scale value instead of predicting max
- Manually reset customZoomState to 1 when destroy() is called

The effect ensures the initial state is always synced with the component,
preventing disabled state issues. The explicit limitZoom prevents early
max detection. Checking returned values makes max detection more reliable.
2025-11-16 16:59:14 +00:00
c89b08e6ad
Merge pull request #28 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
fix: Use event-based zoom tracking like brightness controls
2025-11-16 18:50:50 +02:00
Claude
010255b15d
fix: Use event-based zoom tracking like brightness controls
Changed zoom controls to use event-based state tracking to match the
working brightness control pattern exactly.

Root cause: Reading zoom directly from component's computed properties
created reactivity issues. The brightness controls work because they
use simple event-based state tracking.

Solution:
- Restored customZoomState signal
- Added onCustomZoomChanged event handler
- Listen to (zoomChanged) event in template
- Use customZoomState in all zoom logic and computed signals
- Use fixed ZOOM_STEP constant (0.5) instead of reading from component
- Added tolerance (0.01) to max scale comparison

This matches the brightness pattern exactly:
1. Component emits event when state changes
2. Event handler updates local signal
3. Computed signals react to local signal
4. Template displays local signal

Benefits:
- Simple, predictable reactivity via events
- Isolated state per example
- Matches working brightness pattern
- No complex signal chaining issues
2025-11-16 16:48:04 +00:00
6a028fc05c
Merge pull request #27 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
fix: Use computed signal for zoom display in template
2025-11-16 18:41:46 +02:00
Claude
47e1e83873
fix: Use computed signal for zoom display in template
Fixed TypeScript compilation error:
"TS2349: This expression is not callable"

The issue was accessing viewChild signal and calling nested computed
properties directly in the template. Angular's template compiler had
issues with the complex chained expression.

Solution:
- Created customZoomScale computed signal
- Simplified template expression from:
  {{ customPinch()?.scale().toFixed(2) || 1 }}
- To cleaner:
  {{ customZoomScale().toFixed(2) }}

Benefits:
- Fixes compilation error
- Cleaner template code
- Better performance (computed signal caches value)
2025-11-16 16:39:12 +00:00
a2848cef53
Merge pull request #26 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
fix: Read zoom state directly from component instead of tracking sepa…
2025-11-16 18:37:09 +02:00
Claude
74bfe8911b
fix: Read zoom state directly from component instead of tracking separately
Fixed zoom control issues where buttons didn't work correctly:
- Zoom minus was not disabled on initial state
- Zoom plus only worked once instead of incrementally
- Zoom minus sometimes reduced below minimum

Root cause: Tracking zoom state separately via events created sync issues

Solution:
- Read zoom directly from component's scale() computed property
- Use component's _zoomControlScale() for zoom increments
- Removed separate customZoomState signal and onCustomZoomChanged handler
- Added [minScale]="1" to enforce minimum zoom level
- isZoomAtMin now computed from pinch.scale() directly

Benefits:
- Always accurate - no sync issues
- Simpler code - one source of truth
- Buttons enable/disable correctly based on actual zoom state
2025-11-16 16:34:22 +00:00
bd84dab555
Merge pull request #25 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
fix: Isolate custom controls state from other examples
2025-11-16 18:29:46 +02:00
Claude
630af17d43
fix: Isolate custom controls state from other examples
Fixed issues with custom controls where shared state caused problems:
- Zoom minus button not disabled on initial load
- Zoom plus only working once instead of incrementally

Root cause: All examples shared the same zoomstate/brightnessstate signals
through common event handlers, causing state pollution.

Solution:
- Created separate signals: customZoomState, customBrightnessState
- Added dedicated handlers: onCustomZoomChanged, onCustomBrightnessChanged
- Updated template to use custom handlers and display custom state
- Computed signals now reference isolated custom state

Now custom controls work independently from other examples on the page.
2025-11-16 16:27:23 +00:00
68f314ac83
Merge pull request #24 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
feat: Add smart min/max behavior to custom controls
2025-11-16 17:13:25 +02:00
Claude
3991058265
feat: Add smart min/max behavior to custom controls
Improve custom controls example with intelligent button behavior:
- Minus buttons disabled when at minimum (initial state)
- Plus buttons reset to minimum when at maximum
- Prevents going below min values
- Provides intuitive UX with disabled states

Implementation:
- Added computed signals: isZoomAtMin, isBrightnessAtMin, isBrightnessAtMax
- Created handler methods: handleZoomIn/Out, handleBrightnessIn/Out
- Handlers check limits and reset when appropriate
- Template binds [disabled] to computed signals

Benefits:
- Users can't accidentally go below minimum
- Easy reset from maximum with single click
- Clear visual feedback via disabled buttons
- Clean pattern for custom toolbar integration
2025-11-16 15:09:09 +00:00
ada388cf69
Merge pull request #23 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
feat: Add custom controls example with plus/minus buttons
2025-11-16 16:47:56 +02:00
Claude
757197fe26
feat: Add custom controls example with plus/minus buttons
Add comprehensive examples demonstrating custom zoom and brightness controls:
- New example in app.component.html showing plus/minus buttons for both features
- Updated README with custom controls section showing how to build custom UI
- Demonstrates disabling default controls and using public methods
- Useful for integrating controls into custom toolbars or layouts

Public methods used:
- zoomIn(value) / zoomOut(value) for zoom control
- brightnessIn() / brightnessOut() for brightness control
2025-11-16 14:45:10 +00:00
c68da6c6ed
Merge pull request #22 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
Claude/angular signals upgrade 01 lkzye fbjsq ker2 xz a twcx h
2025-11-16 16:39:35 +02:00
Claude
3809db173d
feat: Implement incremental brightness control
Update brightness toggle to increment by step amounts rather than jumping to max:
- Click repeatedly increases brightness by brightnessStep increments
- When max brightness is reached, clicking resets to normal (1.0)
- Provides smooth, granular control for detail visibility
- Updated README and examples to explain incremental behavior
2025-11-16 14:36:50 +00:00
Claude
28d063bd7a
feat: Simplify brightness control to single toggle button
- Changed brightness controls from two buttons (increase/decrease) to single toggle button
- Button toggles between normal (1.0) and max brightness
- Matches zoom control UX pattern for consistency
- Updated BrightnessControlsComponent to use single button with two states
- Added toggleBrightness() method to container component
- Added isBrightened computed signal to track brightness state
- Visual feedback: outline sun (normal) vs filled sun (brightened)

Better UX: Single button is cleaner and more intuitive, consistent with zoom control.
2025-11-16 14:30:59 +00:00
3286cb59b4
Merge pull request #21 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
fix: Move control styles to presentational components
2025-11-16 16:20:58 +02:00
Claude
1af7e761b9
fix: Move control styles to presentational components
- Moved brightness control styles from container SASS to BrightnessControlsComponent
- Moved zoom control styles from container SASS to ZoomControlsComponent
- Fixed Angular view encapsulation issue preventing styles from applying
- Added @brianpooe/ngx-pinch-zoom path mapping to tsconfig.json
- Updated app component to import from @brianpooe/ngx-pinch-zoom

This fixes the issue where control icons were not visible due to Angular's
view encapsulation preventing parent component styles from applying to
child presentational components. Each component now contains its own styles.
2025-11-16 14:15:21 +00:00
88bd1e0a74
Merge pull request #20 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
fix: Preserve layout styles in destroy() method
2025-11-16 16:10:54 +02:00
Claude
cbb2a5532f
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.
2025-11-16 14:08:33 +00:00
09e5af85c9
Merge pull request #19 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
fix: Reset zoom state properly in destroy() method
2025-11-16 16:02:11 +02:00
Claude
40b485d624
fix: Reset zoom state properly in destroy() method
- Added zoom state reset (scale=1, moveX=0, moveY=0) before cleanup
- Explicitly sets transform to 'none' and transition to 'none'
- Prevents image from appearing enlarged/overflowed after destroy
- Ensures clean state restoration before removing event listeners

This fixes the issue where calling destroy() would enlarge the image
and cause overflow instead of properly resetting the component state.
2025-11-16 13:59:55 +00:00
f2504e4178
Merge pull request #18 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
fix: Add zoneless mode guards to prevent initialization errors
2025-11-16 15:50:00 +02:00
Claude
7dbc12c185
fix: Add zoneless mode guards to prevent initialization errors
- Added null checks in getImageElement() for this.element
- Updated getImageHeight() and getImageWidth() to use optional chaining
- Added guards in isDragging() for this.element and this.parentElement
- Returns safe defaults (0, false, undefined) when service not initialized

This fixes TypeError in zoneless mode where computed signals are evaluated
immediately during template rendering, before ngOnInit() runs. The guards
ensure methods return safe values until the service is properly initialized.

Critical for Angular 20 zoneless change detection compatibility.
2025-11-16 13:48:06 +00:00
3a86ffdf41
Merge pull request #17 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
Claude/angular signals upgrade 01 lkzye fbjsq ker2 xz a twcx h
2025-11-16 15:43:09 +02:00
Claude
10c0dde307
fix: Use official provideZonelessChangeDetection API
- Added explicit provideZonelessChangeDetection() from @angular/core
- Follows official Angular 20 zoneless documentation
- Explicit configuration is better than implicit defaults
- Enables zoneless mode for optimal performance with signals
2025-11-16 13:41:39 +00:00
Claude
46c5cbda65
refactor: Use stable zoneless mode for Angular 20
- Removed provideZonelessChangeDetection() call
- In Angular 20+, zoneless is stable and default when no zone provider specified
- No Zone.js dependency needed - cleaner and more performant
- Aligns with official Angular 20 zoneless documentation
2025-11-16 13:37:15 +00:00
Claude
02151446cb
fix: Configure example app for Angular 20 zoneless mode
- Added provideZonelessChangeDetection() to enable zoneless mode
- Resolves NG0908 error (Angular requires Zone.js)
- Modern approach that works perfectly with signals-based library
- No Zone.js dependency needed for the example app
2025-11-16 13:34:59 +00:00
98fc57322f
Merge pull request #16 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
docs: Update documentation and modernize example app
2025-11-16 12:11:16 +02:00
Claude
27bd5d7326
docs: Update documentation and modernize example app
Documentation updates:
- Corrected library README to reflect IvyPinchService and TouchesService are Angular services, not utility classes
- Updated CHANGELOG to accurately describe service architecture
- All services now correctly documented as using Angular's DI system

Example app modernization:
- Converted AppComponent to standalone component (removed NgModule)
- Updated to use Angular 20 signals (signal() for state)
- Updated main.ts to use bootstrapApplication instead of bootstrapModule
- Fixed template to call signal values as functions
- Added JSDoc documentation

All features demonstrated:
- Click-to-zoom functionality
- Brightness control
- Combined workflows (click-to-zoom + brightness)
- All configuration options
- Programmatic control methods
2025-11-16 10:03:44 +00:00
e9b7011bbb
Merge pull request #15 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
docs: Update credits to properly attribute complete contributor chain
2025-11-16 11:51:28 +02:00
Claude
f4d8717cc9
docs: Update credits to properly attribute complete contributor chain
- Added original author: Nikita Drozhzhin (drozhzhin-n-e/ngx-pinch-zoom)
- Added Angular 19/20 fork contributors: Konstantin Schütte and Björn Schmidt (medDV-GmbH)
- Structured credits to show development lineage: Original → Fork → Current
- Updated all three documentation files with consistent attribution
2025-11-16 09:49:14 +00:00
c37d8a703d
Merge pull request #14 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
refactor: Convert IvyPinch and Touches to proper Angular services
2025-11-16 11:40:10 +02:00
Claude
ef3c6365db
refactor: Convert IvyPinch and Touches to proper Angular services
Converted core utility classes to Angular services with @Injectable decorators
for better consistency with Angular best practices and modern DI patterns.

**Breaking Changes:**

This is a fresh start with no backward compatibility.

1. **IvyPinch → IvyPinchService**
   - Added @Injectable() decorator
   - Constructor removed, replaced with init(properties, callback) method
   - Now injected via Angular DI instead of instantiated with 'new'
   - Injected TouchesService instead of creating new Touches instance
   - Provided at component level for proper instance scoping

2. **Touches → TouchesService**
   - Added @Injectable() decorator
   - Constructor removed, replaced with init(properties) method
   - Now injected via Angular DI instead of instantiated with 'new'
   - Provided at component level for proper instance scoping

3. **PinchZoomComponent Updates**
   - Added IvyPinchService and TouchesService to providers array
   - Injected services via inject() function
   - Changed from 'new IvyPinch()' to 'ivyPinchService.init()'
   - Updated all references from this.pinchZoom to this.ivyPinchService

4. **Removed Backward Compatibility**
   - Deleted ivypinch.ts (re-export shim)
   - Deleted touches.ts (re-export shim)
   - Clean break for fresh start with Angular 20 patterns

**Benefits:**

- Fully consistent with Angular service architecture
- Better dependency injection throughout
- Each component gets properly scoped service instances
- Cleaner, more testable code
- No ambiguity about utility classes vs services
- Professional Angular patterns from top to bottom

**Technical Details:**

Services are provided at component level (not root) to ensure each
PinchZoomComponent instance gets its own IvyPinchService and TouchesService
with isolated state.

All builds passing (library + example app).
2025-11-16 09:33:14 +00:00
3f62ac94ad
Merge pull request #13 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
Claude/angular signals upgrade 01 lkzye fbjsq ker2 xz a twcx h
2025-11-16 11:24:57 +02:00
Claude
6e751e0dd5
docs: Clarify core logic attribution and modernization scope
Updated documentation to more accurately reflect what was preserved from the
original library versus what was rebuilt for Angular 20.

**Key Changes:**

**package.json:**
- Updated description to clarify "rebuilt with modern signals" rather than
  "complete rewrite"
- Emphasizes core logic is "adapted from original" with "extensive enhancements"

**README.md Credits Section:**
Now clearly separated into two parts:

1. **What's From the Original:**
   - Core pinch-to-zoom mathematics and transform algorithms (IvyPinch)
   - Touch and mouse gesture detection logic (Touches)
   - Original zoom/pan calculations and constraints

2. **What's New in This Version:**
   - Complete Angular 20 signals API migration
   - Professional architecture (models/, services/, containers/, presentational/)
   - Smart/Dumb component pattern
   - New features: brightness control, click-to-zoom
   - Service-based state management
   - 778 lines of JSDoc documentation

**CHANGELOG.md:**
- Changed from "Complete Rewrite" to "Major Modernization"
- Added explanation: "core zoom/pan mathematics from the original library have
  been preserved and enhanced, while the Angular implementation has been
  completely rebuilt"
- Credits section now explicitly lists what was retained from original

**Library README.md:**
- Added "Core Logic Attribution" section
- Added "Modernization & New Features" section
- Clearer separation of original work vs new work

**Rationale:**

This is more accurate and gives proper credit to the original developers for
their excellent core zoom algorithms while still highlighting the significant
work done to:
- Migrate to Angular 20 signals
- Redesign the architecture
- Add new features (brightness, click-to-zoom)
- Add comprehensive documentation

The core math and gesture detection logic from Nikita Drozhzhin's original
work remains the foundation, enhanced with modern Angular patterns and new
capabilities.
2025-11-16 09:20:42 +00:00
Claude
97a68341ff
chore: Add @brianpooe scope to package name
Updated package name from `ngx-pinch-zoom` to `@brianpooe/ngx-pinch-zoom`
to properly scope the package under the @brianpooe npm organization.

**Changes:**

- projects/ngx-pinch-zoom/package.json: name → @brianpooe/ngx-pinch-zoom
- README.md: All import examples updated to use scoped package name
- CHANGELOG.md: Installation command updated
- projects/ngx-pinch-zoom/README.md: Import examples updated
- ivypinch.ts: Deprecation notice updated with scoped package name
- touches.ts: Deprecation notice updated with scoped package name

Library builds successfully as @brianpooe/ngx-pinch-zoom.
2025-11-16 09:15:54 +00:00
Claude
40fac72bc0
docs: Update ownership, credits, and architecture documentation
This commit updates all documentation to reflect the complete Angular 20 rewrite
and establishes proper attribution for the original library authors.

**Package Changes:**

1. **package.json**
   - Changed name from @meddv/ngx-pinch-zoom to ngx-pinch-zoom
   - Updated author to Brian Pooe
   - Removed contributors (moved to Credits section in docs)
   - Updated repository URLs to brianpooe/ngx-pinch-zoom
   - Enhanced description highlighting modern architecture
   - Added keywords: Angular signals, smart components, anomaly detection

2. **Main README.md**
   - Updated all import examples from @meddv/ngx-pinch-zoom to ngx-pinch-zoom
   - Added comprehensive Architecture section with folder structure
   - Added Design Patterns section (Smart/Dumb, Services, Signals, DI)
   - Added detailed Credits section acknowledging original authors:
     * Nikita Drozhzhin - Original creator
     * Konstantin Schütte - Angular 19 fork maintainer
     * Björn Schmidt - Angular 19 fork contributor
   - Updated GitHub issues link to brianpooe repository

3. **CHANGELOG.md**
   - Updated version date to 2025-11-16
   - Changed title to "Complete Rewrite: Angular 20 + Professional Architecture"
   - Reorganized features to highlight new capabilities:
     * Click to Zoom for anomaly detection
     * Brightness Control
     * Professional Architecture
     * Smart/Dumb Components
   - Added Architecture Changes section with folder structure
   - Added comprehensive Credits section with original authors
   - Updated migration guide npm install command

4. **Library README.md** (projects/ngx-pinch-zoom/README.md)
   - Complete rewrite with focus on architecture and quality
   - Added detailed folder structure documentation
   - Added Design Patterns section explaining:
     * Smart/Dumb Component Pattern
     * Service-Based Architecture
     * Signal-Based Reactivity
     * Modern Dependency Injection
   - Added Code Quality section (778 lines JSDoc, strict mode, etc.)
   - Added Use Cases section (anomaly detection, medical imaging, etc.)
   - Added Credits section with full attribution

5. **Deprecated Re-export Files**
   - Updated @deprecated comments in ivypinch.ts and touches.ts
   - Changed import examples from @meddv/ngx-pinch-zoom to ngx-pinch-zoom

**Key Documentation Themes:**

- Emphasizes this is a **complete rewrite**, not just an update
- Proper attribution to original authors in Credits sections
- Highlights professional Angular architecture patterns
- Documents the clean folder structure (models/, services/, components/)
- Explains smart/dumb component pattern explicitly
- Shows real-world use cases (anomaly detection, defect inspection)

All references to @meddv and medDV-GmbH have been removed from ownership
positions and properly attributed in Credits sections.
2025-11-16 09:13:35 +00:00
d5a96e8d77
Merge pull request #12 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
refactor: Implement clean Angular architecture with explicit folder s…
2025-11-16 11:05:16 +02:00
Claude
4ca19ec858
refactor: Implement clean Angular architecture with explicit folder structure
This commit restructures the library to follow Angular best practices with clear
separation of concerns and explicit smart/dumb component organization.

**Directory Structure Changes:**

models/
├── interfaces.model.ts (moved from interfaces.ts)
├── properties.model.ts (moved from properties.ts)
├── zoom-config.model.ts (existing)
├── transform-state.model.ts (existing)
├── brightness-state.model.ts (existing)
├── click-to-zoom.model.ts (existing)
└── index.ts (barrel export)

services/
├── brightness.service.ts (existing)
├── zoom-state.service.ts (existing)
├── ivy-pinch.service.ts (moved from ivypinch.ts)
├── touches.service.ts (moved from touches.ts)
└── index.ts (barrel export)

components/
├── containers/
│   └── pinch-zoom/
│       ├── pinch-zoom.container.ts (renamed from pinch-zoom.component.ts)
│       ├── pinch-zoom.container.html (renamed from pinch-zoom.component.html)
│       └── pinch-zoom.container.sass (renamed from pinch-zoom.component.sass)
└── presentational/
    ├── zoom-controls/
    │   └── zoom-controls.component.ts
    └── brightness-controls/
        └── brightness-controls.component.ts

**Key Changes:**

1. **Models Organization**: All data models, interfaces, and types moved to models/
   - interfaces.ts → models/interfaces.model.ts
   - properties.ts → models/properties.model.ts

2. **Services Organization**: Core logic moved to services/
   - ivypinch.ts → services/ivy-pinch.service.ts (utility class)
   - touches.ts → services/touches.service.ts (utility class)
   - Removed @Injectable decorators (classes instantiated with 'new')
   - Renamed TouchProperties to avoid naming conflict

3. **Components Organization**: Explicit smart/dumb component separation
   - Smart (Container) components: components/containers/
   - Dumb (Presentational) components: components/presentational/
   - Renamed files with .container.* suffix for clarity

4. **Backward Compatibility**: Legacy import paths maintained via re-exports
   - ivypinch.ts → re-exports from services/ivy-pinch.service.ts
   - touches.ts → re-exports from services/touches.service.ts

5. **Public API**: Simplified exports through barrel files
   - Models exported from ./lib/models
   - Services exported from ./lib/services
   - Components exported from ./lib/components

**Benefits:**

- Clear separation of concerns (models, services, components)
- Explicit smart/dumb component pattern
- Professional Angular project structure
- Improved maintainability and discoverability
- Backward compatible with existing imports

All builds passing (library + example app).
2025-11-16 09:03:25 +00:00
6045dbbf04
Merge pull request #11 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
docs(ivypinch): Add comprehensive JSDoc documentation and remove dupl…
2025-11-15 22:23:16 +02:00
Claude
4c59f2b9fd
docs(ivypinch): Add comprehensive JSDoc documentation and remove duplicate file
Consolidated ivypinch.ts and ivypinch.improved.ts into a single, well-documented file.

**Changes:**

1. **Added comprehensive JSDoc documentation to ivypinch.ts:**
   - File-level @fileoverview with architecture description
   - Section headers for code organization (8 major sections)
   - JSDoc comments for all properties (30+ documented)
   - JSDoc comments for all methods (50+ documented)
   - Algorithm explanations for complex methods (pinch, pan, wheel zoom)
   - Mathematical formulas with inline examples
   - @param and @returns tags for all methods
   - @public/@private visibility markers
   - Cross-references using {@link} tags
   - Usage examples in @example blocks

2. **Documentation Highlights:**
   - **Transform mathematics**: Matrix format, hardware acceleration benefits
   - **Fixed-point zooming**: How pinch center stays visually fixed
   - **Two pinch modes**: Fixed vs. draggable pinch with trade-offs
   - **Pan constraints**: Algorithm for preventing gaps at edges
   - **Wheel zoom**: Snapping behavior and cursor-centered zooming
   - **Coordinate calculations**: Touch vs. mouse event handling
   - **Public API**: Detailed docs for component integration

3. **Removed ivypinch.improved.ts:**
   - Eliminated duplicate file to maintain single source of truth
   - Prevents sync issues between two copies
   - All educational content now in production file
   - IDE tooltips will show documentation
   - TypeDoc can generate API docs from JSDoc

4. **Fixed property initialization order:**
   - Moved defaultMaxScale before maxScale
   - Resolved TypeScript initialization error

**Benefits:**

 Single source of truth (no duplicate files to sync)
 IDE tooltips show documentation on hover
 Better developer onboarding
 TypeDoc-ready for API documentation generation
 No bundle size impact (JSDoc stripped at build time)
 Easier to maintain (update docs with code)
 Professional documentation standards

**File Stats:**
- Lines: 1,559 (781 original + 778 JSDoc)
- Properties documented: 30+
- Methods documented: 50+
- Code sections: 8 major areas
- No runtime impact (comments don't affect bundle)

All builds passing (library + app). Documentation quality matches enterprise standards.
2025-11-15 20:20:55 +00:00
a032e7e2af
Merge pull request #10 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
refactor: Implement Angular service-based architecture with smart/dum…
2025-11-15 22:09:23 +02:00
Claude
2d9b6c25fe
refactor: Implement Angular service-based architecture with smart/dumb components
Restructured the ngx-pinch-zoom library following Angular best practices:

**Architecture Changes:**

1. **Models Layer** (new):
   - zoom-config.model.ts - Configuration interfaces for zoom behavior
   - transform-state.model.ts - Transform state and metadata interfaces
   - brightness-state.model.ts - Brightness configuration and state
   - click-to-zoom.model.ts - Click-to-zoom configuration and events
   - All models exported via barrel file for clean imports

2. **Services Layer** (new):
   - BrightnessService (@Injectable)
     * Signal-based reactive brightness state management
     * Computed state with atMin/atMax bounds checking
     * Increase/decrease/setValue/reset methods
     * Configuration management with min/max/step

   - ZoomStateService (@Injectable)
     * Signal-based reactive zoom/transform state management
     * Computed extended state with isZoomedIn, atMaxScale, atMinScale
     * Transform state updates and limit management
     * Exposes readonly signals for reactive consumption

3. **Components Layer** (refactored):
   - ZoomControlsComponent (dumb/presentational)
     * Pure component with no business logic
     * Input: isZoomedIn signal
     * Output: toggle event
     * Accessibility: ARIA labels, keyboard support

   - BrightnessControlsComponent (dumb/presentational)
     * Pure component with no business logic
     * Inputs: atMin, atMax signals
     * Outputs: increase, decrease events
     * Accessibility: ARIA labels, keyboard support

   - PinchZoomComponent (smart/container)
     * Orchestrates services and child components
     * Injects BrightnessService and ZoomStateService
     * Delegates brightness logic to BrightnessService
     * Uses child components for UI rendering
     * Effects for reactive state synchronization

**Benefits:**

 Separation of Concerns - Clear boundaries between presentation and business logic
 Testability - Services can be unit tested in isolation, components easily mocked
 Reusability - Services and dumb components can be reused across the application
 Type Safety - Strong TypeScript interfaces throughout all layers
 Reactive Patterns - Signal-based state with computed values
 Maintainability - Easier to locate and fix bugs, simpler to add features
 Angular Best Practices - Dependency injection, smart/dumb pattern, service layer

**Technical Details:**

- Smart/Dumb component pattern for better separation of concerns
- Dependency Injection for all services (scoped to component instance)
- Signal-based reactive state management (Angular 20+)
- Effects for state synchronization and side effects
- Computed signals for derived state
- Barrel exports for clean import paths
- Backward compatible - all existing interfaces preserved
- Bundle size: 272.62 kB (minimal increase of ~6 kB for architecture improvements)

**Files Changed:**
- Modified: pinch-zoom.component.ts (refactored to use services)
- Modified: pinch-zoom.component.html (uses child components)
- Modified: public-api.ts (exports new models, services, components)
- Added: 4 model files + index
- Added: 2 service files + index
- Added: 2 component files + index

All builds passing (app + library). No breaking changes to public API.
2025-11-15 19:55:43 +00:00
8a0978341a
Merge pull request #9 from brianpooe/claude/angular-signals-upgrade-01LkzyeFbjsqKer2XzATwcxH
docs(examples): Add comprehensive demos for click-to-zoom and brightn…
2025-11-15 21:39:15 +02:00
Claude
a9a2f414ad
docs(examples): Add comprehensive demos for click-to-zoom and brightness features
Enhanced the demo application with complete examples for the newly implemented features:

New Examples Added:
- enableClickToZoom: Basic click-to-zoom functionality demonstration
- clickToZoomScale: Custom zoom scale (3.5x) demonstration
- enableBrightnessControl: Brightness adjustment controls
- brightnessStep: Custom brightness increment (0.2) demonstration
- minBrightness/maxBrightness: Brightness range limits (0.5-1.5)
- Combined demo: Click-to-zoom + brightness for anomaly detection workflows

Updates:
- Fixed all property bindings to use camelCase (Angular 20 signals requirement)
  - transition-duration → transitionDuration
  - limit-zoom → limitZoom
  - auto-zoom-out → autoZoomOut
  - double-tap → doubleTap
  - double-tap-scale → doubleTapScale
- Added brightness state tracking in app.component.ts
- Added onBrightnessChanged event handler

The combined example showcases the complete workflow for defect inspection
and anomaly detection, demonstrating how both features work together.
2025-11-15 19:36:46 +00:00