britzl / defold-input

Simplify input related operations such as gesture detection, input mapping and clicking/dragging game objects
MIT License
111 stars 26 forks source link

Please add a new property for the cursor script #9

Closed notbadgun closed 4 years ago

notbadgun commented 4 years ago

When moving (drag) an object using the cursor, all the coordinates of the object change. You need to add a property that allows you to move the object without changing the Z coordinate of the object. I sort my objects by Z. When I move an object with the cursor, I want to raise the object above others by the Z coordinate. Now the cursor script does not give it because of "go.set_position(pos - self.state.pressed_offset, self.state.pressed_id)".

Now I have to write this way: "local set_pos = pos - self.state.pressed_offset go.set(self.state.pressed_id, "position.x", set_pos.x) go.set(self.state.pressed_id, "position.y", set_pos.y)"

Thank you for the great asset!

britzl commented 4 years ago

Good point. I guess the cursor.script should always use the z-position of the dragged object on every update.

notbadgun commented 4 years ago

That's a good idea!