[PB 5.40]Lib Vector - Coordonées - Pas tout compris ou bug ?
Publié : ven. 18/sept./2015 12:16
Hello,
J'ai un peu bricolé un exemple tiré de la doc, et je ne comprends pas pourquoi le premier click de souris dessine les 2 box à 2 endroits différents alors que les click suivant dessinent les 2 box aux même coordonnées. Je pense que le premier comportement est le bon... enfin je crois
Merci
J'ai un peu bricolé un exemple tiré de la doc, et je ne comprends pas pourquoi le premier click de souris dessine les 2 box à 2 endroits différents alors que les click suivant dessinent les 2 box aux même coordonnées. Je pense que le premier comportement est le bon... enfin je crois

Code : Tout sélectionner
If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 400, 200)
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget And EventGadget() = 0 And EventType() = #PB_EventType_LeftButtonDown
If StartVectorDrawing(CanvasVectorOutput(0, #PB_Unit_Point))
CanvasX = GetGadgetAttribute(0, #PB_Canvas_MouseX)
CanvasY = GetGadgetAttribute(0, #PB_Canvas_MouseY)
DrawingX = ConvertCoordinateX(CanvasX, CanvasY, #PB_Coordinate_Device, #PB_Coordinate_User)
DrawingY = ConvertCoordinateY(CanvasX, CanvasY, #PB_Coordinate_Device, #PB_Coordinate_User)
AddPathBox(CanvasX, CanvasY, 10, 5)
VectorSourceColor(RGBA(255, 0, 0, 255))
FillPath()
AddPathBox(DrawingX, DrawingY, 5, 10)
VectorSourceColor(RGBA(0, 255, 0, 255))
FillPath()
Debug Str(CanvasX) + "px" + ":" + Str(CanvasY) + "px"
Debug Str(DrawingX) + "pt" + ":" + Str(DrawingY) + "pt"
StopVectorDrawing()
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
EndIf