How to drag&drop object using touch event

Hi everyone, Im new here and JS(Three.js) side and wonder about one issue that I found on some project on github. Blueprint. Its a 3d floor plan project and its not working on mobile web (the touch draggable function).

Item.prototype.clickPressed = function (intersection) {

            this.dragOffset.copy(intersection.point).sub(this.position);
        };
        ;
        /** */
        Item.prototype.clickDragged = function (intersection) {
            if (intersection) {
                this.moveToPosition(intersection.point.sub(this.dragOffset), intersection);
            }
        };
        ;

function clickPressed(vec2) {
vec2 = vec2 || mouse;
var intersection = scope.itemIntersection(mouse, selectedObject);
if (intersection) {
selectedObject.clickPressed(intersection);
}
}
function clickDragged(vec2) {
vec2 = vec2 || mouse;
var intersection = scope.itemIntersection(mouse, selectedObject);
if (intersection) {
if (scope.isRotating()) {
selectedObject.rotate(intersection);
}
else {
selectedObject.clickDragged(intersection);
}
}
}

these functions about press item from point A, to point B, like mousedown > mousemove > mouseup. the functions work perfectly but when change to mobile web, clickDragged function is not working at all.
so wonder how to fix the solution or some help how to change code for items available for dragging. Really need help, guys. thanks

somebody? could help with issue?

Hi!

Even if I’d like to help, I see no specific question about the problem.
You just offer the other people to go through the source code of a not so small project that was made with an outdated version of the framework (r69, whereas the current one is r94) and typescript, find the piece of code which doesn’t work (or works incorrectly), fix it(!) and give you the working solution.

I edited my question, will be good if you show me the fix way, or what I should change

How do you thin then? @prisoner849

I don’t thin, but thanks for the question :slight_smile:

So, could you clarify what are you talking about? Is it Edit Floorplan or Design?
I didn’t find any code in touch events that would allow to do the same things as with mouse events, for example in Designmode, you can rotate the scene with the touch, but you can’t move (drag) a selected object.
Thus, you have to add some logics for that stuff into existing touch events or re-work them completely.
Maybe someone more experienced can add some more information about this topic or can say that my suggestion is totally wrong :slight_smile:

yeah the floor paln is rotate by touch event, but items cant dragging as you said. that is a big issue for me and cannot find solution on internet too. thats why I asked from you, and if u remember I asked this question on stackoverflow too. ))

And if you remember, I offerd you to take a look at the touch events :slight_smile:

I looked for touch events a lot but here is no solution for my issue )) (or I dont understand) haha

Hi prisoner, do u have links about how to move object from point a to point b by click (not drag), clickOn on pointA , and clickOff on pointB. Thanks