ScaleDetector and HasDraggable Components use ScaleDetector without a pointer
I want to realize a function. A map is similar to Baidu Map. One finger can move it, and two fingers can zoom it. In the case of the official website, there is only one ScaleDetector. I can't drag it accurately, so I use HasDraggable Components, but ScaleDetector can't be used. My most desired function is to know the moving coordinates of two fingers. I can handle scaling by myself, or I can use ScaleDetector, But now it can't finish my work
Hi, we only accept issues in English unfortunately. If you translate this to English and notify me I can re-open it.
Hi, we only accept issues in English unfortunately. If you translate this to English and notify me I can re-open it.
I have translated it into English, thank you
Thanks for translating it.
You can use the MultiTouchDragDetector for this if you just want to know the coordinates of several fingers.
You should also be able to get all the information that you need from the ScaleDetector since it also handles pans/drags:
https://docs.flame-engine.org/1.6.0/flame/inputs/gesture_input.html?highlight=gestures#pandetector-and-scaledetector
Thanks for translating it. You can use the
MultiTouchDragDetectorfor this if you just want to know the coordinates of several fingers.You should also be able to get all the information that you need from the
ScaleDetectorsince it also handles pans/drags: https://docs.flame-engine.org/1.6.0/flame/inputs/gesture_input.html?highlight=gestures#pandetector-and-scaledetector
I use FlameGame, which does not recommend MultiTouchDragDetector. I need the drag function of HasDraggableComponents. I have studied the example of this link and can't drag my components accurately
Thanks for translating it. You can use the
MultiTouchDragDetectorfor this if you just want to know the coordinates of several fingers.You should also be able to get all the information that you need from the
ScaleDetectorsince it also handles pans/drags: https://docs.flame-engine.org/1.6.0/flame/inputs/gesture_input.html?highlight=gestures#pandetector-and-scaledetector
ScaleDetector cannot locate the movement of a component. For example, if there is a fixed component, moving the pointer on the top will move the component on the bottom. This is not what I want, and the scaling effect is not ideal. I want to really scale, rather than just monitor the scaling of saleY or saleX
I'm not sure that I understand fully what you want to do, do you want to be able to register drag events on top of components and at the same time be able to react on scale events?
If that is what you want to do you can continue to use the HasDraggableComponents and override the onDragUpdate method in your FlameGame (remember to call super), in the event of that method you will be able to get the pointerId and position of the pointer, with which you should be able to build scaling logic from. Not a very simple solution, but there isn't any simpler way currently if you want to use the HasDraggableComponents mixin.
I'm not sure that I understand fully what you want to do, do you want to be able to register drag events on top of components and at the same time be able to react on scale changes?
If that is what you want to do you can continue to use the
HasDraggableComponentsandoverridethe onDragUpdate method in yourFlameGame(remember to call super), in the event of that method you will be able to get thepointerIdand position of the pointer, with which you should be able to build scaling logic from. Not a very simple solution, but there isn't any simpler way currently if you want to use theHasDraggableComponentsmixin.
Similar to Google Map as my game map, which supports drag and zoom, onDragUpdate can only get the position of one pointer, and can't judge the number of pointers. How can I get the position and number of two pointers? This method gives me too little information
In the event (the argument for onDragUpdate) you can get the pointerId then you'll have to store that with appropriate information about the position, which you also get from the event, to be able to create scaling logic.
In the event (the argument for
onDragUpdate) you can get thepointerIdthen you'll have to store that with appropriate information about the position, which you also get from the event, to be able to create scaling logic.
How can I get the relevant position? In what way, I can only get one coordinate. I should get two coordinates to know whether it is scaling
How can I get the relevant position? In what way, I can only get one coordinate. I should get two coordinates to know whether it is scaling
Like I said, you have to store the position for each pointerId, since they come in with different events.