Canvas_View: limiting drag of items is not working
Open
Nobody has claimed this yet.
- Dominant language
- Ada
- Stars
- 110
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
As an example, if the program defines the handler for item movement as:
function On_Item_Event_Move_Item
(View : not null access Glib.Object.GObject_Record'Class;
Event : Event_Details_Access)
return Boolean
is
begin
Event.Allowed_Drag_Area := Some_Rectangle;
return Gtkada.Canvas_View.Views.On_Item_Event_Move_Item (View, Event);
end On_Item_Event_Move_Item;
and then the handlers:
Canvas.On_Item_Event (On_Item_Event_Select'Access);
Canvas.On_Item_Event (On_Item_Event_Move_Item'Access);
However, dragging is not limited in any way.
Diving into the problem, I commented out gtkada-canvas_pkg.adb line 509:
.....
then
-- Enable moving the item anywhere
-- ===> JLF 2023-10-03 Event.Allowed_Drag_Area := Drag_Anywhere; <===
Self.Model.Raise_Item (Event.Toplevel_Item);
return True;
end if;
return False;
end On_Item_Event_Move_Item;
and voilá, dragging is now limited to the rectangle.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at gtkada-canvas_pkg.adb line 509 and reproduce the On_Item_Event_Move_Item example with Event.Allowed_Drag_Area set to Some_Rectangle. Check the drag behavior with the current handler and confirm that items remain within the specified rectangle when the issue is fixed.
Written by the indexing model from the issue text.
Assessment
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100