From 29154bd6514e129eb3c91076ca0f316a7a1ad212 Mon Sep 17 00:00:00 2001 From: Jason <17367223+jsoltys@users.noreply.github.com> Date: Tue, 5 May 2026 15:42:30 -0500 Subject: [PATCH] Editor Support Co-authored-by: Copilot --- TESTING_404R.md | 105 +++ VISUAL_LAYER_REFERENCE.md | 115 +++ app/app.py | 3 + app/blueprints/canvas.py | 216 +++++ app/blueprints/products.py | 40 +- app/create_test_images.py | 90 +++ app/create_visual_test_images.py | 240 ++++++ app/data/product_attributes.json | 215 +++++ app/data/products.json | 36 +- app/data/users.json | 4 +- app/static/css/styles.css | 18 + app/static/images/layers/base.jpg | Bin 0 -> 17639 bytes .../window/storm-window/404/door-black.png | Bin 0 -> 2532 bytes .../window/storm-window/404/door-bronze.png | Bin 0 -> 2540 bytes .../window/storm-window/404/door-tan.png | Bin 0 -> 2540 bytes .../window/storm-window/404/door-white.png | Bin 0 -> 2526 bytes .../window/storm-window/layers/base.jpg | Bin 0 -> 19976 bytes .../window/storm-window/layers/foreground.png | Bin 0 -> 3652 bytes .../window/storm-window/layers/hardware.png | Bin 0 -> 2395 bytes app/static/js/script.js | 155 +++- app/templates/product_finder.html | 12 +- app/templates/product_manager.html | 762 ++++++++++++++++++ app/templates/user_manager.html | 7 + information/CANVAS_API_GUIDE.md | 311 +++++++ information/CANVAS_API_IMPLEMENTATION.md | 285 +++++++ information/CANVAS_API_QUICKSTART.md | 197 +++++ information/CANVAS_DIRECTORY_SETUP.md | 336 ++++++++ information/FOREGROUND_LAYER_EXAMPLE.md | 142 ++++ information/FOREGROUND_QUICKSTART.md | 113 +++ information/LAYERED_IMAGES.md | 34 + information/LAYER_TRANSFORMS.md | 210 +++++ information/products-layered-example.json | 69 ++ 32 files changed, 3698 insertions(+), 17 deletions(-) create mode 100644 TESTING_404R.md create mode 100644 VISUAL_LAYER_REFERENCE.md create mode 100644 app/blueprints/canvas.py create mode 100644 app/create_test_images.py create mode 100644 app/create_visual_test_images.py create mode 100644 app/data/product_attributes.json create mode 100644 app/static/images/layers/base.jpg create mode 100644 app/static/images/window/storm-window/404/door-black.png create mode 100644 app/static/images/window/storm-window/404/door-bronze.png create mode 100644 app/static/images/window/storm-window/404/door-tan.png create mode 100644 app/static/images/window/storm-window/404/door-white.png create mode 100644 app/static/images/window/storm-window/layers/base.jpg create mode 100644 app/static/images/window/storm-window/layers/foreground.png create mode 100644 app/static/images/window/storm-window/layers/hardware.png create mode 100644 app/templates/product_manager.html create mode 100644 information/CANVAS_API_GUIDE.md create mode 100644 information/CANVAS_API_IMPLEMENTATION.md create mode 100644 information/CANVAS_API_QUICKSTART.md create mode 100644 information/CANVAS_DIRECTORY_SETUP.md create mode 100644 information/FOREGROUND_LAYER_EXAMPLE.md create mode 100644 information/FOREGROUND_QUICKSTART.md create mode 100644 information/LAYER_TRANSFORMS.md diff --git a/TESTING_404R.md b/TESTING_404R.md new file mode 100644 index 0000000..9340586 --- /dev/null +++ b/TESTING_404R.md @@ -0,0 +1,105 @@ +# Testing Layer Transforms - Product 404R + +## Quick Test Guide + +I've created **product 404R** as a demonstration of the layer transform feature. It uses the same images as product 404 but flips the door and hardware layers horizontally to show a right-hinge configuration. + +## Test URLs + +**Left-Hinge (Original):** +``` +http://localhost:8080/quiz/product/404 +``` + +**Right-Hinge (Flipped):** +``` +http://localhost:8080/quiz/product/404R +``` + +## What to Look For + +When you compare both products: + +1. **Base layer** - Should be identical (house/background doesn't flip) +2. **Door layer** - Should be mirrored left-to-right +3. **Hardware layer** - Should be mirrored to match door position +4. **Foreground layer** - Should be identical (plants don't flip) + +## Image Files Used + +Both products use the same image files from: +``` +/static/images/window/storm-window/404/ + ├── door-white.png + ├── door-black.png + └── (other color variants) + +/static/images/window/storm-window/layers/ + ├── base.jpg + ├── hardware.png + └── foreground.png +``` + +**Zero additional images needed!** The flip is pure CSS. + +## Configuration Difference + +### Product 404 (Left-Hinge) +```json +"imageConfig": { + "useCanvasAPI": true +} +``` + +### Product 404R (Right-Hinge) +```json +"imageConfig": { + "useCanvasAPI": true, + "layerTransforms": { + "door": "flip-horizontal", + "hardware": "flip-horizontal" + } +} +``` + +## Color Variations + +Both products support all color options: +- Black +- White +- Bronze +- Sandstone + +Select different colors in the dropdown to see the door layer change while maintaining the flip. + +## Technical Notes + +- **Performance**: Instant rendering, GPU-accelerated CSS transform +- **Storage**: No duplicate images required +- **Bandwidth**: Same image files downloaded once and reused +- **Compatibility**: Works in all modern browsers + +## Use Cases + +This same technique can be applied to: +- Storm doors with different hinge sides +- Windows with operable panels on left vs right +- Sliding doors/windows that open from different sides +- Any product where a mirror variant is needed + +## Next Steps + +1. Restart your Flask server to load the new product data +2. Visit both URLs to compare +3. Try different color selections +4. Open browser DevTools to see the CSS classes applied: + - `.layer-flip-horizontal` on door and hardware layers for 404R + - No transform classes on 404 + +## Production Usage + +When ready for production: +1. Design all "left-hinge" (or default orientation) images +2. Add product entries for "right-hinge" variants with `layerTransforms` +3. No need to create separate images! +4. Consider naming convention: 404, 404R, 404L, etc. diff --git a/VISUAL_LAYER_REFERENCE.md b/VISUAL_LAYER_REFERENCE.md new file mode 100644 index 0000000..eb3c4f5 --- /dev/null +++ b/VISUAL_LAYER_REFERENCE.md @@ -0,0 +1,115 @@ +# Visual Test Images - Layer Reference + +## Image Overview + +All images created with **800x600px** canvas dimensions for perfect alignment. + +## Layers Created + +### 1. **Base Layer** (`/layers/base.jpg`) +- **Sky blue background** (#87CEEB) +- **Green grass** at bottom +- **Tan house** with dark brown roof +- **Two side windows** with dividers +- **Door opening** in center (lighter tan rectangle) +- **Opaque JPG** - the foundation layer + +### 2. **Door Layer** (`/404/door-{color}.png`) +Created in 4 colors: +- `door-white.png` - White door (#FFFFFF) +- `door-black.png` - Dark gray/black door (#2C2C2C) +- `door-bronze.png` - Bronze door (#8B6914) +- `door-tan.png` - Tan door (#D2B48C) + +Each door has: +- **Rectangular shape** positioned in the door opening +- **Two decorative panels** (outlined rectangles) +- **Small black circle** on right side marking handle position +- **Transparent PNG** - shows house through transparent areas + +### 3. **Hardware Layer** (`/layers/hardware.png`) +- **Gold circle** (#FFD700) for door handle +- **Bronze backplate** (#B8860B) behind handle +- **Light highlight** for 3D effect +- **Positioned on right side** (for left-hinge door) +- **Transparent PNG** - only handle visible + +### 4. **Foreground Layer** (`/layers/foreground.png`) +- **Green bushes** at bottom corners (#228B22) +- **Pink flowers** with gold centers +- **Plants overlap bottom of door** realistically +- **Transparent PNG** - plants appear in front + +## How They Stack (z-index order) + +``` +Layer 5: Foreground (plants) - On top, in front of everything +Layer 3: Hardware (handle) - Above door +Layer 2: Door (colored) - In door opening +Layer 1: Base (house) - Background, always visible +``` + +## Left-Hinge vs Right-Hinge + +### Product 404 (Left-Hinge) +- Door handle on **right side** of door +- Door opens to the right +- Uses images as created + +### Product 404R (Right-Hinge) +- Door and hardware layers **flipped horizontally** +- Door handle appears on **left side** of door +- Door opens to the left +- Same image files, just CSS transformed! + +## Visual Features to Notice + +1. **Door positioning**: The door rectangle fits perfectly in the lighter opening on the house +2. **Handle alignment**: The small black dot on the door matches the gold handle position +3. **Plants overlap**: The foreground plants appear in front of the door bottom +4. **Color changes**: Select different colors to see door change while everything else stays the same +5. **Flip effect**: Compare 404 vs 404R to see the door and handle swap sides + +## Technical Details + +- **Canvas size**: 800x600 pixels (all layers) +- **Format**: JPG for base (opaque), PNG for others (transparency) +- **Color depth**: RGB/RGBA +- **Positioning**: Centered with `object-fit: contain` + +## Test Checklist + +When viewing the products, verify: +- ✅ House background always visible +- ✅ Door fits in opening +- ✅ Door color changes when selected +- ✅ Gold handle appears on door +- ✅ Plants appear in front of door +- ✅ 404R has flipped door and handle +- ✅ No white gaps or misalignment + +## File Locations + +``` +app/static/images/ +└── window/ + └── storm-window/ + ├── 404/ + │ ├── door-white.png + │ ├── door-black.png + │ ├── door-bronze.png + │ └── door-tan.png + └── layers/ + ├── base.jpg + ├── hardware.png + └── foreground.png +``` + +## Creating Similar Images + +Use the script `create_visual_test_images.py` as a template: +1. Set canvas dimensions (CANVAS_WIDTH, CANVAS_HEIGHT) +2. Design each layer with proper positioning +3. Use transparent PNGs for layered elements +4. Export base layer as JPG, others as PNG +5. Keep all layers at same canvas size diff --git a/app/app.py b/app/app.py index 35377ba..1ed1ab1 100644 --- a/app/app.py +++ b/app/app.py @@ -19,10 +19,12 @@ app.config['SESSION_COOKIE_SAMESITE'] = 'Lax' from blueprints.auth import auth_bp from blueprints.users import users_bp from blueprints.products import products_bp +from blueprints.canvas import canvas_bp app.register_blueprint(auth_bp) app.register_blueprint(users_bp) app.register_blueprint(products_bp) +app.register_blueprint(canvas_bp) # Comment Change # Home route @@ -44,6 +46,7 @@ def home():

Current Location: {session.get('currentLocation', 'Not selected')}