godotengine / godotengine/godot-docs
Drag preview does not consider camera position
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**Godot version:**
3.2.2
**OS/device including version:**
MacOS 10.15.5
**Issue description:**
set_drag_preview() does does not account for camera movement currently. It seems to take mouse position from viewport only.
Problem described in detail in https://github.com/godotengine/godot/issues/11281
Currently I solve this issue with an offset by hand like this:
```
var preview = Control.new()
var preview_unit = from_control.duplicate(true)
preview_unit.rect_position = camera.global_position-_position-(get_viewport_rect().size/2)
preview.add_child(preview_unit)
set_drag_preview(preview)
```
This is however not obvious and should either be documented or camera movement should be considered when positioning the preview
**Steps to reproduce:**
Run project. Drag and drop picker.
**Minimal reproduction project:**
[drag_and_drop 2.zip](https://github.com/godotengine/godot/files/4895246/drag_and_drop.2.zip)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.