Bug 509685

Summary: Pasted vector layers get incorrect bounding box / produce ghost visuals
Product: [Applications] krita Reporter: needcomp
Component: Layers/VectorAssignee: Krita Bugs <krita-bugs-null>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: 5.2.9   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Ghosting when using Transform on a pasted layer

Description needcomp 2025-09-19 14:57:19 UTC
Created attachment 185100 [details]
Ghosting when using Transform on a pasted layer

SUMMARY
Pasting a vector layer into an image, which is too small to have it placed in its original position, results in layer having incorrect bounding box. Using some tools displays a ghost copy of the layer contents that cannot be interacted with.

STEPS TO REPRODUCE
1. Create a document
2. Add a vector layer to it
3. Create vector polygon shape _in the lower right corner_
4. Cut or copy _the layer_
5. Create second document using "Create from Clipboard" to produce a smaller canvas OR resize the canvas of the original document so that the copied layers content is now out of its bounds
6. Paste the layer

OBSERVED RESULT
The shape is placed correctly within the visible area of the image, but using Move a layer tool on it outlines rectangle way too big and outside of images bounds (inluding part where shape used to be in the source image). Using Transform a layer or selection tool outlines area way too big and shows a ghost copy of layers conent outside of images bounds. Using Image > Trim to current layer expands the image to include this wrong bounding box though there are no actual shapes there.

EXPECTED RESULT
The bounding box on a pasted layer is expected to outline its actual content of vector shapes, regardles of whether it could be pasted at the original position or had to be moved to fit into destionation canvas bounds. No ghost visuals should produce when applying tools.

SOFTWARE/OS VERSIONS
Krita

 Version: 5.2.11 (git a4da714)
 Installation type: installer / portable package
 Hidpi: true

Qt

  Version (compiled): 5.15.7
  Version (loaded): 5.15.7

OS Information

  Build ABI: x86_64-little_endian-llp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: winnt
  Kernel Version: 10.0.19045
  Pretty Productname: Windows 10 Version 2009
  Product Type: windows
  Product Version: 10

ADDITIONAL INFORMATION
Saving and reloading seems to fix the broken layer, but that is hardly a practical workaround.
Possibly related to https://bugs.kde.org/show_bug.cgi?id=491695 , https://bugs.kde.org/show_bug.cgi?id=423515