You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

ciul

Trainee

  • "ciul" started this thread

Posts: 149

Location: Colombia

Occupation: Creative developer guy

  • Send private message

1

Friday, April 8th 2011, 8:30pm

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

2

Saturday, April 9th 2011, 12:35pm

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

ciul

Trainee

  • "ciul" started this thread

Posts: 149

Location: Colombia

Occupation: Creative developer guy

  • Send private message

3

Saturday, April 9th 2011, 3:15pm

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

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

4

Saturday, April 9th 2011, 4:22pm

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.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

5

Saturday, April 9th 2011, 7:25pm

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

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

6

Saturday, April 9th 2011, 8:15pm

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.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

7

Saturday, April 9th 2011, 8:28pm

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

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

8

Saturday, April 9th 2011, 8:55pm

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!
;)
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

ciul

Trainee

  • "ciul" started this thread

Posts: 149

Location: Colombia

Occupation: Creative developer guy

  • Send private message

9

Wednesday, April 13th 2011, 1:07pm

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.

10

Wednesday, April 13th 2011, 4:09pm

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.

11

Wednesday, April 13th 2011, 9:32pm

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:

Source code

1
2
3
4
<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:

Source code

1
2
3
4
5
<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

12

Wednesday, April 13th 2011, 9:46pm

One more - and here a style for dragable hotspots:

Source code

1
2
3
4
<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:

Source code

1
2
3
4
5
6
<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

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

13

Thursday, April 14th 2011, 12:43am

Neat it works on the iphone too. Although the performance isn't that great. Just replacing mouse.stagex with mouse.x etc
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

mindlessboss

Professional

Posts: 1,081

Location: Russia, Kaliningrad

  • Send private message

14

Thursday, April 14th 2011, 6:26am

Klaus the best! as always *thumbup*
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

15

Wednesday, September 28th 2011, 2:03pm

Hi,

here a small online example where this code will be used:
http://krpano.com/examples/draggingtest/

best regards,
Klaus

jpdeglet69

Intermediate

Posts: 212

Location: France

Occupation: VR Maker and Document Management Expert

  • Send private message

16

Wednesday, September 28th 2011, 5:30pm

Thanks a lot Klaus,

very interesting and useful ;-)
Best regards,
JPhD
VR-Guide®/Eleana CEO
https://vr-guide.online

mindlessboss

Professional

Posts: 1,081

Location: Russia, Kaliningrad

  • Send private message

17

Monday, October 3rd 2011, 7:20am

Just a little upgrade of dragable style


DEMO

Andrey *thumbup*
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

18

Monday, October 3rd 2011, 9:53am

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

mindlessboss

Professional

Posts: 1,081

Location: Russia, Kaliningrad

  • Send private message

19

Monday, October 3rd 2011, 11:33am

Hi!
Oh... sorry, it's realy looks like promotion
it never happen again *rolleyes*
This is the upgrade of Klaus drag actions, and of course i can share the code
But remember, it's included in ScrollBar plugin ;-)

XML


You're welcome.
Andrey *thumbup*
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

20

Monday, October 3rd 2011, 12:35pm

Hi!
Oh... sorry, it's realy looks like promotion
it never happen again *rolleyes*
Don´t be silly, Andrey ;-) 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