Copy & Paste Feature in Figpea: A Powerful Way to Duplicate and Transfer Content
Figpea offers a robust copy and paste system that enhances your design workflow by providing multiple ways to duplicate and transfer content. Let's explore the key features and capabilities of this system.
Key Features
1. Layer Copying
- Copy single layers or multiple layers at once
- Maintains layer properties, styles, and transformations
- Preserves layer hierarchy for composite layers
2. Smart Image Pasting
Figpea supports multiple image pasting methods:
- Direct image pasting from clipboard
- Base64 encoded image pasting
- Supports various image formats (PNG, JPEG, GIF, WebP)
3. Intelligent Positioning
When pasting content, Figpea:
- Places new elements at the cursor position
- Maintains relative positioning between multiple copied layers
- Automatically adjusts to the correct layer hierarchy
How to Use
Basic Copy & Paste
- Select the layer(s) you want to copy
- Use standard keyboard shortcuts:
- Copy: Ctrl+C (Windows) or Cmd+C (Mac)
- Paste: Ctrl+V (Windows) or Cmd+V (Mac)
Working with Images
You can paste images directly from:
- Your system clipboard
- Screenshots
- Other design applications
- Web browsers
The pasted image will automatically be converted into a layer at your cursor position.
Multiple Layer Copying
When copying multiple layers:
- Select multiple layers using Shift+Click or Ctrl/Cmd+Click
- Copy the selection
- When pasting, all layers will be placed maintaining their relative positions
Technical Details
The copy-paste system in Figpea implements a sophisticated mechanism for handling various types of content:
Internal Layer Copying
When copying layers within Figpea:
- The system identifies the selected layer(s) and their relationships
- For composite layers, all child layers are included in the copy operation
- A unique identifier is stored in the clipboard with the format
figpea;[layer-ids]
- When pasting, the system:
- Recreates the layer hierarchy
- Preserves all layer properties and styles
- Adjusts positions relative to the paste location
Image Handling
The system supports multiple image formats through three paste handlers:
-
Direct Image Pasting
- Detects image files in clipboard
- Converts to appropriate layer type
- Maintains original image quality
-
Base64 Image Support
- Recognizes base64-encoded images
- Supports PNG, JPEG, GIF, and WebP formats
- Automatically converts to blob for layer creation
-
Layer ID References
- Manages internal layer references
- Preserves layer relationships
- Maintains transformation matrices
Position Management
The system implements smart positioning through:
- Real-time cursor tracking
- World coordinate transformation
- Parent layer detection
- Automatic alignment and spacing
Best Practices
- Position First: Move your cursor to the desired location before pasting
- Layer Hierarchy: Pay attention to which layer is selected when pasting, as it determines the paste location in the layer hierarchy
- Multiple Elements: When copying multiple elements, they will maintain their relative positions when pasted
Limitations and Error Handling
Limitations
- Copied layers are bound to the current project
- Some complex layer effects might need adjustment after pasting
- External content pasting is limited to image formats
Error Handling
The system includes robust error handling for various scenarios:
- Invalid clipboard content is gracefully ignored
- Failed image conversions are caught and reported
- Base64 decoding errors are handled safely
- Layer reference errors maintain system stability
Edge Cases
The system handles several edge cases:
- Pasting outside page boundaries
- Copying composite layers with complex hierarchies
- Multiple simultaneous paste operations
- Invalid or corrupted clipboard data
Conclusion
The copy and paste feature in Figpea is designed to streamline your workflow by providing flexible ways to duplicate and transfer content. Whether you're working with single layers, multiple elements, or external images, the system maintains accuracy while offering convenience.