Code Monkey home page Code Monkey logo

drag_controller's People

Contributors

burtonageo avatar bvssvni avatar leonkunert avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drag_controller's Issues

Relative drag?

All I really want out of DragController is to know when an area is being dragged, and by how much each frame. It'd be really cool if it could do that. I might implement this myself real quick.

Use custom enum for DragAction

The event method takes f: |Drag| -> bool which in code is not self documenting, since one usually puts true or false at the end of the closure.

By using an enum DragAction with Continue and Cancel the code will be easier to read.

Can't build on rust 1.0

Tried to fix myself, but couldn't quite figure it out.

   Compiling piston2d-drag_controller v0.0.2 (file:///Users/aaronmcleod/Documents/programming/rust/drag_controller)
src/lib.rs:69:17: 69:49 error: mismatched types:
 expected `input::Button`,
    found `input::Button`
(expected enum `input::Button`,
    found a different enum `input::Button`) [E0308]
src/lib.rs:69                 Button::Mouse(MouseButton::Left) => {
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib.rs:83:17: 83:49 error: mismatched types:
 expected `input::Button`,
    found `input::Button`
(expected enum `input::Button`,
    found a different enum `input::Button`) [E0308]
src/lib.rs:83                 Button::Mouse(MouseButton::Left) => {
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
Could not compile `piston2d-drag_controller`.

Drag on window resize

I'm using piston with gfx and glutin, and when I resize the window, it starts a drag once I let go of the mouse button on the window resize, and a drag is happening without having the mouse button pressed.

Stop drag when mouse leaves window

If the mouse cursor leaves the window while a drag is in progress, the drag controller will continue the drag when it re-enters, even if the mouse button was released while the cursor was out of view. This is generally undesirable behavior, as far as I can tell.

Cancel dragging by clicking right mouse button

Some window back-ends do not emit mouse events outside the window, which might cause undesirable behavior.

For example, when dragging and left mouse button is released outside the window, when entering this might mess up something and with no way to cancel the operation.

I think there should be a way to cancel drag operations. This can be a useful feature also when you can continue dragging outside the window.

A = dealing with interruption, such as window loosing focus
B = dealing with cancelling
M = mess up behavior

A, B, !M. When dealing with interruption, you can also deal with cancelling operations.

!A, !B, ?!M. When not dealing with interruption or cancelling, you usually don't mess up behavior. Cancelling can simply be ignored.

error: unresolved import `input::Mouse`. There is no `Mouse` in `input`

When building the current Piston, I get the following:

$ cargo build --verbose
[...]
Compiling input v0.0.0 (https://github.com/pistondevelopers/input#fb351501)
[...]
Compiling drag_controller v0.0.0 (https://github.com/pistondevelopers/drag_controller#a797ac06)
[...]
src/lib.rs:17:5: 17:10 error: unresolved import `input::Mouse`. There is no `Mouse` in `input`
src/lib.rs:17     Mouse,
                  ^~~~~
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
Could not compile `drag_controller`.

where it bails as indicated. Checking input, there is indeed no input::Mouse present.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.