ID:1770313
 
(See the best response by Lummox JR.)
Code:


Problem description:So Im trying to make drag and drop work well through a mobile device. The problem is the screen will start moving up and down is there a way to lock screen in position

The general solution in javascript is to put
event.preventDefault();
event.stopPropagation();
...
return false;

into the ontouch functions. I assume this would have to be done in the dms files, but I'll admit that I do not know the webclient well enough to know where you can put this.
well i know a bit of java, havent used it sense highschool though, i also was making a tiny unity game with java before i quit it last summer. Does anyone know how to put a java script into dream maker?
Best response
Java and JavaScript are two different animals. The webclient uses JavaScript.

What controls are you trying to drag and drop from? If you're just concerned with the map alone, that's something I can look at because it's part of the core functionality.

If you're creating your own .dms control to add to your project (and kudos if you are), I'd suggest just registering handlers for touch events with addEventListener and adding the preventDefault() code as Mightymo suggested.
In response to Lummox JR
well i made my own directional pad wheel onto the screen for players. Click wasnt working well so i thought if i used drag the up arrow for example it might work easier. It works quite well with the mouse, however so did the click. So im experimenting
In response to Lummox JR
handlers for touch events? whats that about? Ill research how to do JavaScript myself. Where would i put the java script? save it into my game file?
Well again, are we talking about an actual control or did you just put something on the HUD? Because a HUD object will be impacted by the map itself, and that's something I'd need to deal with. A separate control would be written in JavaScript, but it sounds like you're not doing that.
In response to Lummox JR
no just on the HUD, how would i get to be doing it on java? if i have more control over what i can do I'd prefer ti use it
To do it in JavaScript you'd need to define a whole new control for the webclient.

Basically, a control is just a .dms file with something like this in it:

<byondclass name="mycontrol">
<style>
...
</style>
<script>
{
config: {
// config options
},
fn: {
// functions like create, output, etc.
},
winsetfn: {
// winset functions
}
}
</script>
<div id=one>This div is part of the control's contents and can be accessed by control.ui.one</div>
</byondclass>


The webclient documentation explains how to set all this up, and you can study existing .dms controls to see how those work. However, I would suggest this is probably not ideal for you if you don't already know JavaScript. If drag and drop isn't working with touch events on the map, that's something I need to handle.
In response to DanteVFenris
and i made a mistake, its not click that doesnt work, or maybe drag and drop besides the screen moving. MouseExited doesnt work. basically i wanted to do when i click i move, than when i lift my finger up from hud d pad i stop with MouseExited. It just ignores MouseExited() on touch but works perfectly fine with a mouse
nvm dont listen to me, I need to test it more, than ill tell you what i think is not working. With my code
you need a mouse mode
photon browser could be good