Dragable plugins/hotspots

  • Hi Klaus.

    Other may have asked the same but I would like the possibility of dragable plugins and hotspots; through an attribute could be, and then three events to handle that:
    - ondragstart
    - ondrag
    - ondragend

    like many other visual applications have, by example, google maps markers.

    Thanks

    Regards,
    Ciul

  • You can already do this, though admittedly it takes a bit of scripting. See the xml-usage/slider-blend-cubes example.

    That's the point. I ask for it as a common plugin/hotspot attribute and with it's plugin/hotspot events as well.
    Please take as an example google maps, you make markers draggable only by set that marker option, and that's it, no scripting needed, and that's the way how it should be.

    Best regards,
    Ciul

  • This is a great idea.
    The slider plugin looks like it has all the right functions, only need to be modified slightly. But the OP has a good point.
    The editor adds the functions automatically when the hotspots have the editor tag specified. Perhaps these functions could be posted, so that they can work on idevices as well.

  • I could make a plugin that would allow one to make plugins/hotspots draggable, and add the mentioned events to these objects. However one would have to wonder how useful this is without some method to send the result to a server or something like that.

    So before I put time towards a plugin that makes plugins/hotspots draggable, do you have the knowhow of dealing with the dragged elements? And would you be willing to donate towards the development of the plugin? I don't need it myself (yet).

  • It'd have to be pure xml, so that it could work on the iPad.
    Functionality would be like photo tagging, online hotspot editing, annotating, scene linking etc
    What is the best way to send data to a server? I haven't seen any xml only examples.
    plugin url with get variables?
    This would be the most important part to save your changes.
    I wouldn't be ready to implement anything for awhile since I'm deep in development myself, but I could donate when I reach this point.

  • I could implement the plugin as both a swf and a js plugin so it would work for both flash and ios devices.

    The best way to send data to the server would probably be through javascript and ajax, ie: browserside scripting

  • Oh yeah, javascript calls. That'd work fine. I sometimes have difficulty thinking outside all that is krpano.
    The slider example updates the plugins x coordinate using mouse.x all in a function fired ondown
    Why wouldn't that work just fine for flash?
    Klaus's keyboard UI isn't that hot for rotating,scaling etc.. some little icons next to the hotspot would have been better. Heck, I bet we could make a really cool ui for manipulating draggable hotspots.
    All that's needed is a really great reason to spend all the time!
    ;)

  • Hi pals.

    Once again, you seem don't understand my point.

    This would not be a plugin, neither swf, neither js (I already do this by js for both flash capable and mobile devices).
    This would not be a xml script neither.

    It would be a natural property and respective events of hotspots and plugins. That's my request. Otherway different than that has no sense.

    I want to remind the example of google maps markers, they are draggable, they have the property one can change to even toggle if they are draggable or not, and has events to know when they are being dragged and when not.

    Something like:

    <plugin name="pluginName"
    x="0" y="0"

    draggable="true"
    onDragStart="showtext(I started being dragged);"
    onDrag="showtext(I am constantly being dragged and this is fired while dragging);"
    onDragEnd="showtext(I ended being dragged);"
    />


    Best regards.

  • I do perfectly understand your request, but I cannot add it to krpano itself. The best I can do is write a plugin. You would include the plugin in your xml file once, and from then on you would get your "draggable", "ondragstart", "ondrag" and "ondragend" properties.

    But if you don't want me to spend time on a plugin, you will have to wait for Klaus to implement it in krpano itself.

  • Hi,

    there is no plugin needed for that, this could be done with xml only,

    e.g. here a style named "dragable" - just use that for your <plugin> element and it would be dragable and fire "onDragStart", "onDrag" and "onDragEnd" events:

    Code
    <style name="dragable"
           dragging="if(pressed, sub(dx,mouse.stagex,drag_stagex); sub(dy,mouse.stagey,drag_stagey); mul(dx,dragsx); mul(dy,dragsy); add(x,drag_currentx,dx); add(y,drag_currenty,dy); if(onDrag!==null, onDrag() ); delayedcall(0,dragging());, if(onDragEnd!==null, onDragEnd() ); );"
           ondown="copy(drag_currentx,x); copy(drag_currenty,y); copy(drag_stagex,mouse.stagex); copy(drag_stagey,mouse.stagey);  set(dragsx,+1); set(dragsy,+1); if(align==righttop,set(dragsx,-1)); if(align==right,set(dragsx,-1)); if(align==rightbottom,set(dragsx,-1);set(dragsy,-1)); if(align==bottom,set(dragsy,-1)); if(align==leftbottom,set(dragsy,-1)); if(onDragStart!==null, onDragStart() ); dragging();"
           />

    example usage:

    Code
    <plugin name="testimage" url="testimage.jpg" align="center" x="0" y="0" style="dragable"
            onDragStart="trace(I started being dragged);"
            onDrag="trace(I am constantly being dragged and this is fired while dragging);"
            onDragEnd="trace(I ended being dragged);"
            />

    best regards,
    Klaus

  • One more - and here a style for dragable hotspots:

    Code
    <style name="dragablehotspot"
           dragging="if(pressed, sub(dx,mouse.stagex,drag_adjustx); sub(dy,mouse.stagey,drag_adjusty); screentosphere(dx,dy,ath,atv); if(onDrag!==null, onDrag() ); delayedcall(0,dragging()); , if(onDragEnd!==null, onDragEnd() ); );"
           ondown="spheretoscreen(ath,atv,hotspotcenterx,hotspotcentery); sub(drag_adjustx,mouse.stagex,hotspotcenterx); sub(drag_adjusty,mouse.stagey,hotspotcentery); if(onDragStart!==null, onDragStart() ); dragging();"
           />

    example:

    Code
    <hotspot name="testimage" url="testimage.jpg" ath="0" atv="0" zoom="true" distorted="true" 
             style="dragablehotspot" 
             onDragStart="trace(I started being dragged);"
             onDrag="trace(I am constantly being dragged and this is fired while dragging);"
             onDragEnd="trace(I ended being dragged);"
             />

    best regards,
    Klaus

  • Not very helpfull without any code example, Andrey *tongue* The point of this forum is to evolve krpano and the daily used routines. Don´t get me wrong, I think your orangescroll-plugin is really worth it´s money, but may I suggest that you either share some information on how you did the inertia scrolling, or limit your sales promotion to the orangescroll-thread.

    @TOPIC
    I too working on a inertia scrolling-plugin which can be used to either build scrollable menus for flash- and HTML5-tours, or like Andrey did, for scrollable textfields using Klauses code. I´ll post the full plugin when it´s finished.

    Best regards
    Nupsi

  • Hi!
    Oh... sorry, it's realy looks like promotion
    it never happen again *rolleyes*

    Don´t be silly, Andrey *wink* Like I said, your orangescroll-plugin(s) are really great and well worth the money. So there´s no reason to not post a link to it. And at least from my pov there´s no need that you share your code if you don´t want to. I don´t share all of my work as well *g*
    What I meant is that it´s more helpfull for the community to share at least some informations (not necessarily code) on how you solved a problem, to learn from and to discuss about. But thanks anyway for sharing the code! I´m curious about how you achieved the inertia scrolling.

    Btw...this is how I keep a dragable plugin clickable:
    onup="if(drag_currentx !== plugin[%1].x,action(whatever_you_want))"
    It checks if the plugin was moved or not. If not, an action is called to replace the onclick-tag. Very easy, but maybe helpfull for someone.

    Best regards
    Nupsi

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!