Giter Site home page Giter Site logo

animecyc / tidraggable Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pec1985/tidraggable

86.0 86.0 37.0 2.24 MB

An enhanced fork of the original TiDraggable module by Pedro Enrique, allows for simple creation of "draggable" views.

JavaScript 8.49% Python 13.55% Objective-C 43.28% Java 34.68%

tidraggable's People

Contributors

animecyc avatar dbankier avatar pec1985 avatar

Stargazers

 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  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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tidraggable's Issues

Draggable Views inside a ScrollView disable scrolling when enabled set to false

I'm creating many Draggable views inside a ScrollView like below.

var scroll = Ti.UI.createScrollView({
    contentWidth: 'auto',
    contentHeight: '100%',
    showHorizontalScrollIndicator: true,
    showVerticalScrollIndicator: false,
    scrollType: 'horizontal'
});

for (var i = 0; i < views.length; i++) {
   var tile = Draggable.createView({
        width: width,
        height: height,
        left: left,
        top: top,
        bubbleParent: true,
        backgroundImage: image,
        draggable: {
           enabled: false
        }
   });
   scroll.add(tile);
}

When I use the native Titanium View, scrolling works as expected. However, when I disable the dragging abilities on a Draggable view, the scroll event does not bubble to the parent, which is a scroll view. Is there a way to keep scrolling enabled & responding while disabling the dragging feature for a ScrollView's children?

Thank you so f***cking much!!!

Since the TiDraggable from pec1985 is ignored, and no one had a solution for the child problem I was searching for any help. Now I found your fork.

Great work! Works on android and iOS as its best! Thanks again, dude!!!

Building the module

Hi Animecyc,

Could you please let me know how i can package this module as a zip to add to my Titanium modules folder in.

Titanium -> modules -> iphone

i have tried ./build.py with no luck.

Thankyou.

Android build

hey is it possible to build the zip file for latest Android?
I can't find it.

Pinch to Rotate and Scale

Like the Ti.Draggable from @pec1985 does for iOS, it would be nice to have 2-finger (pinch) scale and rotation of the target views both for iOS and Android.

There is an Android native library that does this perfectly already: https://github.com/Almeros/android-gesture-detectors

There should be two boolean parameters for this: canResize and canRotate

This would be an awesome addition to TiDraggable, specially if parity is maintained between iOS and Android.

@iotashan already mapped the pinch events on Android on his last commit, we just need to scale / rotate the target views and also keep the rotating / scaling from original Pedro’s iOS module. Follows the commit link:

iotashan@fe2e4f7

Draggable in Scrollableview

I would like to be able to scroll left/right the scrollableview and up/down the draggable, is this possible ?
thanks

update view by properties

Hi,

firstly, thanks for your work on this great module.

I just experienced that the draggable view (on Android) doesn't react on programmatically changes of view properties such as draggableView.left = 0;

I'm trying to implement a "snapping" behavior and need to update the position of the view. It would be awesome if you could help me out!

Thanks!

Crash on Xperia3+ with Android 6.0.1, SDK 5.5.1.GA

App crashes instantly on startup, when module is included.

[WARN] :   V8Object: (KrollRuntimeThread) [41,41] Runtime disposed, cannot set property 'userAgent'
[ERROR] :  linker: /data/app/trending.android.app-2/lib/arm/libti.draggable.so: has text relocations
[ERROR] :  I/JavaDumper:JavaDumperThread(  663): addEvent: [email protected] processName: trending.android.app
[ERROR] :  I/JavaDumper:JavaDumperThread(  663): Event: [email protected] TimeStamp: 1475219211
[ERROR] :  W/JavaDumper:JavaDumper(  663): Could not init dump dir: Unknown error -95
[ERROR] :  E/JavaDumper:FW(  663):  utils.c(248): mkdir (/data/crashdata) failed. File exists
[ERROR] :  E/JavaDumper:FW(  663):  ramdump_framework.c(315): fp is NULL
[ERROR] :  E/JavaDumper:FW(  663):  ramdump_framework.c(495): Read-only file system
[ERROR] :  E/NetworkScheduler.SR( 4894): Invalid parameter app
[ERROR] :  E/NetworkScheduler.SR( 4894): Invalid package name : Perhaps you didn't include a PendingIntent in the extras?
[ERROR] :  E/Drive.UninstallOperation( 3093): Package still installed trending.android.app
[ERROR] :  I/MSM-irqbalance(  721): Decided to move IRQ115 from CPU3 to CPU1
[ERROR] :  D/mx-android( 5879): CCApplication.onCreate@88: initUserAgent()
[ERROR] :  D/mx-android( 5879): CCApplication.onCreate@90: initSignatureHash()
[ERROR] :  D/mx-android( 5879): CCApplication.onCreate@92: onCreate() bye
[ERROR] :  V/ApplicationReceiver:onReceive( 6111): 2016-09-30 07:06:56-null-Application install message is received ver:1.2.0
[ERROR] :  V/ApplicationReceiver:onReceive( 6111): 2016-09-30 07:06:56-null-ApplicationReceiver detectes the installation of package:trending.android.app ver:1.2.0
[ERROR] :  V/ApplicationReceiver:onReceive(11086): 2016-09-30 07:06:56-4c3ad2e2-8bcf-423a-98da-89e73c1f4be0-Application install message is received ver:1.2.2
[ERROR] :  V/ApplicationReceiver:onReceive(11086): 2016-09-30 07:06:56-4c3ad2e2-8bcf-423a-98da-89e73c1f4be0-ApplicationReceiver detectes the installation of package:trending.android.app ver:1.2.2
[ERROR] :  V/ApplicationReceiver:onReceive( 6125): 2016-09-30 07:06:56-null-Application install message is received ver:1.2.0
[ERROR] :  V/ApplicationReceiver:onReceive( 6125): 2016-09-30 07:06:56-null-ApplicationReceiver detectes the installation of package:trending.android.app ver:1.2.0
[ERROR] :  V/ApplicationReceiver:onReceive( 2138): 2016-09-30 07:06:56-null-Application install message is received ver:1.2.0
[ERROR] :  V/ApplicationReceiver:onReceive( 2138): 2016-09-30 07:06:56-null-ApplicationReceiver detectes the installation of package:trending.android.app ver:1.2.0
[ERROR] :  E/NetworkScheduler.SR( 4894): Invalid parameter app
[ERROR] :  E/NetworkScheduler.SR( 4894): Invalid package name : Perhaps you didn't include a PendingIntent in the extras?
[ERROR] :  I/com.newrelic.agent.android( 6260): Loaded configuration: HarvestConfiguration{collect_network_errors=true, cross_process_id='XAIHU1dWGwIBVFlVAQcB', data_report_period=60, data_token=[11087666, 26874577], error_limit=50, report_max_transaction_age=600, report_max_transaction_count=1000, response_body_limit=2048, server_timestamp=1468882322, stack_trace_limit=100, activity_trace_max_size=65534, activity_trace_max_report_attempts=1, activity_trace_min_utilization=0.30000001192092896, at_capture=ActivityTraceConfiguration{maxTotalTraceCount=1}}
[ERROR] :  I/com.newrelic.agent.android( 6260): Application state monitor has started
[ERROR] :  I/com.newrelic.agent.android( 6260): Analytics Controller started.
[ERROR] :  I/MSM-irqbalance(  721): Decided to move IRQ332 from CPU3 to CPU0
[ERROR] :  I/com.newrelic.agent.android( 6260): Measurement Engine initialized.
[ERROR] :  I/com.newrelic.agent.android( 6260): New Relic Agent v5.6.1
[ERROR] :  I/com.newrelic.agent.android( 6260): Harvester: connected
[ERROR] :  I/com.newrelic.agent.android( 6260): Harvester: Sending 0 HTTP transactions.
[ERROR] :  I/com.newrelic.agent.android( 6260): Harvester: Sending 0 HTTP errors.
[ERROR] :  I/com.newrelic.agent.android( 6260): Harvester: Sending 0 activity traces.
[ERROR] :  I/com.newrelic.agent.android( 6260): Harvester: Sending 0 analytics events.
[ERROR] :  D/~!ETPush( 6260): Logging set to :5
[ERROR] :  I/        ( 3513): -----model:launcher_sec_det_result,length:2
[ERROR] :  I/        ( 3513): ---keyclass, value:0
[ERROR] :  I/        ( 3513): -----model:launcher_sec_det_error,length:2
[ERROR] :  I/        ( 3513): ---keyreason, value:3
[ERROR] :  W/com.facebook.internal.Validate( 6320): FacebookActivity is not declared in the AndroidManifest.xml, please add com.facebook.FacebookActivity to your AndroidManifest.xml file. See https://developers.facebook.com/docs/android/getting-started for more info.
[ERROR] :  W/InstanceID/Rpc( 6306): Found 10035
[ERROR] :  D/com.facebook.appevents.AppEventsLogger( 6320): To set source application the context of activateApp must be an instance of Activity
[ERROR] :  I/MSM-irqbalance(  721): Decided to move IRQ188 from CPU2 to CPU0
[ERROR] :  I/MSM-irqbalance(  721): Decided to move IRQ163 from CPU2 to CPU0
[ERROR] :  I/MSM-irqbalance(  721): Decided to move IRQ215 from CPU2 to CPU1
[ERROR] :  I/MSM-irqbalance(  721): Decided to move IRQ332 from CPU0 to CPU1
[ERROR] :  I/MSM-irqbalance(  721): Decided to move IRQ333 from CPU0 to CPU1

Ti.Draggable Not Supported by TitaniumSDK 5.0.0.GA

I copied the zip file to the root of my project but I am now getting this exception:

[ERROR] : Script Error Couldn't find module: ti.draggable for architecture: x86_64

Is there a 64 bit version?

Hi there,
Any plans for a compatible version?

WARN] : Could not find a valid Titanium module id=ti.draggable version=2.0.0 platform=ios,iphone,commonjs deploy-type=development
[ERROR] : Could not find all required Titanium Modules:
[ERROR] : id: ti.draggable version: 2.0.0 platform: ios,iphone,commonjs deploy-type: development
TRACE | titanium exited with exit code 1
ERROR | Error: ti run exited with error code 1
at ChildProcess. (/Users/raykahn/.appcelerator/install/5.0.1/package/node_modules/appc-cli-titanium/plugins/run.js:89:66)
at ChildProcess.EventEmitter.emit (events.js:117:20)
at Process.ChildProcess._handle.onexit (child_process.js:789:12)

Help with circle implementation

Hi animecyc,

Would really appriciate some help with adding circle bounds i have been working on this for the past few hours and i have working versions for cirlce bounds here.

http://jsfiddle.net/rdb3geob/

And here.

http://jsfiddle.net/z9vqLnsL/2/

I thought it would be a simple case of copying the code over to my titanium project using ti.draggable as follows.

var container = Ti.UI.createView({
        backgroundColor : 'blue',
borderRadius: 144,
        width : 288,
        height : 288
    });
var free = Draggable.createView({
        opacity : 0,
        backgroundColor : 'transparent',
        borderWidth : 4,
        borderColor : '#101010',
        borderRadius : 30,
        width : 60,
        height : 60,
        zIndex : 2
    });
free.addEventListener('move', function(e) {
                                var r = container.width / 2;
                var small_r = free.width / 2;
                var origin_x = r - small_r;
                var origin_y = r - small_r;
                var x = e.center.x - origin_x;
                var y = e.center.y - origin_y;
                var l = Math.sqrt(x * x + y * y);
                var l_in = Math.min(r - small_r, l);
                free.left = x / l * l_in + origin_x;
                free.top = y / l * l_in + origin_y;
});

But it is just really jumpy, was wonder if you had any suggests would be great functionality to add to the module.

Thanks

Ti.UI.FILL & locking on one axis

I wanted to use this great draggable module to create a dragging drawer.

First, I've noticed that if the parent and the draggable view have width & height set to Ti.UI.FILL, the draggable container becomes crazy large (far bigger than the parent view).

Second, so far, I haven't been able to lock dragging on one axis. Is there an example anywhere of that?

Thanks!

Draggable in Scrollableview

Hi,
A Draggable in a Scrollableview seems to disable its eventlisteners.
Anybody has a fix for this ?
Using latest sdks. tested on iOS
thanks

Create new release

Hi, can you create a new release with the 64-bit support?
The latest release version is 2.0.3 (23/01/2014).

Thank you.

Crash, null pointer exception

Received a null pointer exception, crash the app, when I move drag object to right most,

I call setConfig to set the minLeft and maxLeft.

function onKnobMove(e) {
    console.log(e.source.knob, e.center, e.source.center);

    //var leftX = knobLeft.center.x;
    //var   rightX = knobRight.center.x;

    var leftX = knobLeft.rect.x  +  knobLeft.rect.width / 2;//gs

    var leftX = knobLeft.rect.x;//gs
    var rightX = knobRight.rect.x  +  knobRight.rect.width / 2; //gs


    console.log('left x', knobLeft.rect.x, 'leFtx', leftX);
    console.log('rightX', rightX);

    //knobRight.minLeft = leftX + (WIDTH / 2);
    knobRight.draggable.setConfig('minLeft',  leftX + WIDTH);
    knobRight.draggable.setConfig('maxLeft', _params.width - WIDTH);

    knobLeft.draggable.setConfig('maxLeft', rightX - WIDTH - (WIDTH / 2));
    knobLeft.draggable.setConfig('minLeft', 0);

    console.log('knobRight minLeft', knobRight.draggableConfig.minLeft);
    console.log('knobLeft maxLeft', knobLeft.draggableConfig.maxLeft);

    fillView.applyProperties({
        left: leftX,
        width: rightX - leftX
    });


    //leftValue (leftX + (WIDTH / 2)) / distance  //original
    //GS begin
    var values = {};
    values.leftValue = leftX / distance;
    values.rightValue = (rightX + (WIDTH / 2)) / distance;

    console.log("actual ", values);

    if (values.leftValue <= 0.05) {
        values.leftValue = 0;
    }

    if (values.rightValue >= 0.96) {
        values.rightValue = 1;
    }

    console.log("adjusted ", values);



    view.fireEvent('change', values);
    //GS End

    //view.fireEvent('change', {leftValue: (leftX + (WIDTH / 2)) / distance, rightValue: (rightX + (WIDTH / 2)) / distance});

}

[INFO] : undefined undefined undefined
[ERROR] : InputEventReceiver: Exception dispatching input event.
[WARN] : dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xa4be7648)
[ERROR] : TiApplication: (main) [15760,15760] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 3.5.0,2015/01/12 15:33,0014f83
[ERROR] : TiApplication: java.lang.NullPointerException
[ERROR] : TiApplication: at ti.draggable.DraggableGesture.drag(DraggableGesture.java:163)
[ERROR] : TiApplication: at ti.draggable.DraggableGesture.onTouch(DraggableGesture.java:125)
[ERROR] : TiApplication: at android.view.View.dispatchTouchEvent(View.java:7379)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2205)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1940)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1954)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1954)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1954)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1954)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1954)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1954)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1954)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
[ERROR] : TiApplication: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1954)
[ERROR] : TiApplication: at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1966)
[ERROR] : TiApplication: at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1418)
[ERROR] : TiApplication: at android.app.Activity.dispatchTouchEvent(Activity.java:2424)
[ERROR] : TiApplication: at android.support.v7.app.ActionBarActivityDelegateICS$WindowCallbackWrapper.dispatchTouchEvent(ActionBarActivityDelegateICS.java:268)
[ERROR] : TiApplication: at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1914)
[ERROR] : TiApplication: at android.view.View.dispatchPointerEvent(View.java:7564)
[ERROR] : TiApplication: at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:3883)
[ERROR] : TiApplication: at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3778)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
[ERROR] : TiApplication: at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3483)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406)
[ERROR] : TiApplication: at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3540)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
[INFO] : lication: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
[ERROR] : TiApplication: at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5419)
[ERROR] : TiApplication: at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5399)
[ERROR] : TiApplication: at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5370)
[ERROR] : TiApplication: at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5493)
[ERROR] : TiApplication: at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:182)
[ERROR] : TiApplication: at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
[ERROR] : TiApplication: at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:174)
[ERROR] : TiApplication: at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:5472)
[ERROR] : TiApplication: at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:5512)
[ERROR] : TiApplication: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
[ERROR] : TiApplication: at android.view.Chore

bubbleParent: false on child view not respected

This could be a stupid question, so, feel free to tell me so :)

I'm working on an app that has a tableView inside of a draggableView. Everything works flawlessly until I added the ability to rearrange items in the table. It seems like when I'm rearranging items it's firing the start/move/end events on the draggable view (and I can only move the rows about 10px up and down from their original position).

My first thought was that's fine becuase I can just set bubbleParent to false on the table and it won't fire other events, but that didn't work. Here's what I tried:

1) On setting the table to moveable:

Set the DraggableView to enabled:false

2) On setting the table to moveable:

Set the DraggableView to enabled:false
Set the tableView to bubbleParent: false

3) On setting the table to moveable:

Set the DraggableView to enabled:false
Set the tableView to bubbleParent: false
Add the tableView to another view, and setting that to bubbleParent false as well

None of those seemed to work unfortunately.

I was curious if you had any suggestions that may point me in the right direction?

Also thanks for this amazing module :)

ti.draggable-android-2.1.4

ti.draggable-android-2.1.4 build with sdk 6.x.x ti will error Failed to sign apk.
any solution ? thanks.

minLeft, maxLeft is not working

I have used pec1985 ti.draggable, found that minLeft and maxLeft was working. Since found some crashes, moved to this branch, found that ti.draggable is not respecting minLeft, maxLeft properties, it can move to anywhere in the view.

Using in android, would appreciate if any code sample that works with minLeft and maxLeft.

Android build

is it possible to add the compiled Android build to this?
always have a little problem building modules.

Is it possible to allow clicks to a Draggable view to pass to views underneath?

Im trying to build a left menu using draggable.

I have a left menu hiding off screen, then when a user drags that left menu it will cover my main content.

Its all working perfectly, except that I have to leave a transparent edge of the left menu overlapping my main content (about 30% of the screen on the left). This transparent section allows the user to 'drag' the left menu into the view. The problem is that if the user tries to do a click on this transparent section, it does nothing on my main content.

So I tried touchEnabled:false which allows clicks to go through to the main content screen, but then the draggable is no longer draggable :( Is there any trick I can do, or can the module be enhanced to allow this somehow?

Thanks!!

Bind view to both axis?

I was looking to build a 15 puzzle slider using this module but I noticed you can only lock to one axis. I was wondering if it is somehow possible to lock to both x and y axis?

Version 2.0.4 buid link ?

Good morning,
Can you give me a link to the version 2.0.4, i am not able to compile it.
Because the version 2.0.3 cause crash on Android 6.0
Thanks

Map example

Do you have an example how to use the mapping of views?

Animate a draggable view?

So, I want to animate my view onto the stage, upon which it is then draggable. I did a 2DTransform and got a strange result. The view animated just fine, but when I dragged it the view snapped back to it's pre-transformation position and then dragged.

In my case, I just want my draggable view to slide in from the bottom with a bounce stop. Basically indicating that a drawer is there to be pulled open.

Thanks for the aid!

End event's e.top property on android

Hi guys,
I use TiDraggable and created a "snapping points" on iOS. That means, depending where you finish drag event, view automatically snaps to top, initial position or closes the parent view(I use it as a filter similar to Apple Maps.app).
When I moved my fully fuctional code from iOS to android, it wasn't working at all. Problem is, that iOS returns different value for width/height property than android(known difference).
So I discovered, that TiDraggable returns bad numbers as e.top in events and it needs to be divided by logical density factor to get results similar to iOS...
This is not really a bug, maybe a note to someone who is doing similar task as I do and have similar problem as I had. So maybe this note can help someone to quickly adopt code migrated from iOS to Android.
Thanks

Thanks

Hey Seth,

I updated my README, I'm not going to maintain my module any more, I'll redirect the request to this fork instead.

Thanks!
Pedro.

Request: Support longpress (or other event) to enable drag

I'd like to be able to have the same behaviour as in iOS's calendar, which is enable dragging after a long press and then have the view glued to the user's finger right away instead of needing to end the touch and then touch and hold again to drag. Understand what I mean?

My most ideal scenario would be to even wait creating the view to be dragged until the longpress:

someView.addEventListener('longpress', function(e) {
  var draggableView = Draggable.createView({
    draggableConfig: {
      handOver: e                 // telling the view to "hand over" the existing touch event (incl location)
    }
  });
});

An alternative could be to enable after the event:

draggableView.addEventListener('longpress', function(e) {

  // enabling drag and "handing over" the existing touch event (incl location)
  draggableView.draggable.setConfig('handover', e);

});

Mapping - lock axis and position

drag

Setup is like this:

var all = Ti.UI.View({width:600,height:100});
var handle =  Draggable.createView({
                width:20,
                height:100,
                backgroundColor:"#f00",
                right:0,
                top:0,
                draggableConfig : {
                    axis:"y",
                    ensureRight : true,
                    ensureBottom : true,
                    maps: [{
                        view:all,
                        parallaxAmount:1
                    }]
                }
            });

all.add(handle);

How can I prevent the red handle from moving outside and how can I set the axis for the mapped view to y only?

Can't package for iOS store

I need to update an app for iOS 64 bit, I've build the package, test and it's working in simulator and on my iPad. But when I try to package for iOS store, linker fail, on xCode I have this error:

Undefined symbols for architecture armv7:
"OBJC_CLASS$_TiUIiOSNavWindowProxy", referenced from:
objc-class-ref in libti.draggable.a(TiDraggableModule.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any help?

Seems like it needs to be recompiled for SDK 6.0.0

I only have this module in the app, and it crashes with this error:

[INFO] : MultiDex: VM has multidex support, MultiDex support library is disabled.
[WARN] : V8Object: (main) [260,282] Runtime disposed, cannot set property 'userAgent'
[DEBUG] : AndroidRuntime: Shutting down VM
[ERROR] : TiApplication: (main) [27,309] Sending event: exception on thread: main msg:java.lang.UnsatisfiedLinkError: dlopen failed: library "libstlport_shared.so" not found; Titanium 6.0.0,2016/11/13 01:23,undefined
[ERROR] : TiApplication: java.lang.UnsatisfiedLinkError: dlopen failed: library "libstlport_shared.so" not found
[ERROR] : TiApplication: at java.lang.Runtime.loadLibrary(Runtime.java:372)
[ERROR] : TiApplication: at java.lang.System.loadLibrary(System.java:1076)
[ERROR] : TiApplication: at org.appcelerator.kroll.runtime.v8.V8Runtime.loadExternalModules(V8Runtime.java:151)
[ERROR] : TiApplication: at org.appcelerator.kroll.runtime.v8.V8Runtime.initRuntime(V8Runtime.java:118)
[ERROR] : TiApplication: at org.appcelerator.kroll.KrollRuntime.doInit(KrollRuntime.java:205)
[ERROR] : TiApplication: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:114)
[ERROR] : TiApplication: at org.appcelerator.kroll.KrollRuntime.init(KrollRuntime.java:136)
[ERROR] : TiApplication: at com.bouncingfish.pronamel.GwcApplication.onCreate(GwcApplication.java:46)
[ERROR] : TiApplication: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
[ERROR] : TiApplication: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)
[ERROR] : TiApplication: at android.app.ActivityThread.-wrap1(ActivityThread.java)
[ERROR] : TiApplication: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
[ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:102)
[ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:148)
[ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5417)
[ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
[INFO] : art: Starting a blocking GC HeapTrim

Doesn't work on Android with SDK 3.5.1.GA

If i try to compile with Titanium SDK 3.5.1.GA, I get the following when starting any app:

[ERROR] dalvikvm: dlopen("/data/app-lib/com.example.something-2/libti.draggable.so") failed: dlopen failed: cannot locate symbol "__exidx_end" referenced by "libti.draggable.so"...

The "-2" after com.example.something is not something I have added, might be the cause?

touchend does not fire.

First of all I would like to thank you for this module.

While I was testing out my code I noticed that the touchend listener does not fire.

Thanks

Installation Instructions or Zip File

I'm working with 9.0.3 SDK and trying to get the ti.draggable module installed.

Is there a zip file with the android and ios module that will support x86_64?

How to create a snap effect?

Thanks for this great contribution. I make a small card game - the player draws cards and drags them to the bottom of the screen where there are a couple of empty card spots. Picking the card and dragging them works great.

How can I add a snap effect to the empty card spots? Do I have to create (another?) touchmove eventlistener? Any general advice is appreciated.

Need minBottom and maxBottom property

I want to implement an dragable menu from bottom,
which I can drag to the screens middle.

I need to set a fix bottom menu size, if I would set maxTop/minTop
the size of the menu will change depending on screen ratio.
bildschirmfoto 2015-09-11 um 12 32 17

minLeft is relative to original position and not to screen

I try to set the bounds of the draggable to the screen by setting minTop and minLeft to 0 and maxTop and maxLeft to the platform width/height minus the draggable width/height.

All works fine except for minLeft. If I set this to 0 the draggable can not be moved left of the original position.

Not compatiable for ti sdk 7.5.0.GA

I am trying to use this module for my iphone app with 7.5.0.GA i sdk but it says that
Couldn't find module for architecture : arm64.

Anyone has faced this kind of issue?

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.