Author Topic: mouse_drag mouse drags should not activate links  (Read 603 times)

Ecnassianer

  • Sr. Member
  • ****
  • Posts: 126
    • Carpe Chaos
mouse_drag mouse drags should not activate links
« on: May 06, 2010, 03:05:53 am »
I have my book set to mouse_drag.

When I grab a page to drag, and release the mouse button over nothing, all is good.

When I grab a page to drag, then release the mouse button over a link element, it opens the link. That's not good.

The way I interpret mouse gestures like click-to-scroll is that where I release my mouse on the screen doesn't matter, what matters is how far I've scrolled when I release my mouse.  The location of the mouse when I release it is determined by how far I scrolled the page, so it should not be treated as a user input.

I would like it very much if links were only activated when the distance between the mouse press and mouse release is very small.
« Last Edit: May 06, 2010, 03:58:16 am by Ecnassianer »
See my megazine at CarpeChaos.com

Ecnassianer

  • Sr. Member
  • ****
  • Posts: 126
    • Carpe Chaos
Re: mouse_drag mouse drags should not activate links
« Reply #1 on: May 13, 2010, 07:50:51 am »
I'm using full page ads that I want to be clickable, but I also want to use mouse drag. Having a bunch of accidental clicks on my ad pages poisons my CTR tracking, so I need a workaround. This nasty hack slightly reduces the amount of accidental clicks.

What I ended up going with was this python script:
Code: [Select]
page_width = 640
page_height = 720
box_width = 100
box_height = 100
URL = "INSERT_AD_URL_HERE"

h, w = 0, 0
while h < ( page_height + box_height ):
    while w < ( page_width + box_width ):
        print '<area width="' + str(box_width) + '" height="' + str(box_height) + '" left="' + str(w) + '" top="' + str(h) + '" url="' + URL + '" overlay="color(0,0,0)"/>'
        w += box_width
    w = 0
    h += box_height

That generates a block of xml that looks like this:
Code: (xml)
  1. <area width="100" height="100" left="0" top="0" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  2. <area width="100" height="100" left="100" top="0" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  3. <area width="100" height="100" left="200" top="0" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  4. <area width="100" height="100" left="300" top="0" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  5. <area width="100" height="100" left="400" top="0" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  6. <area width="100" height="100" left="500" top="0" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  7. <area width="100" height="100" left="600" top="0" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  8. <area width="100" height="100" left="700" top="0" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  9. <area width="100" height="100" left="0" top="100" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  10. <area width="100" height="100" left="100" top="100" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  11. <area width="100" height="100" left="200" top="100" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  12. <area width="100" height="100" left="300" top="100" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  13. <area width="100" height="100" left="400" top="100" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  14. <area width="100" height="100" left="500" top="100" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  15. <area width="100" height="100" left="600" top="100" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  16. <area width="100" height="100" left="700" top="100" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  17. <area width="100" height="100" left="0" top="200" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  18. <area width="100" height="100" left="100" top="200" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  19. <area width="100" height="100" left="200" top="200" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  20. <area width="100" height="100" left="300" top="200" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  21. <area width="100" height="100" left="400" top="200" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  22. <area width="100" height="100" left="500" top="200" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  23. <area width="100" height="100" left="600" top="200" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  24. <area width="100" height="100" left="700" top="200" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  25. <area width="100" height="100" left="0" top="300" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  26. <area width="100" height="100" left="100" top="300" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  27. <area width="100" height="100" left="200" top="300" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  28. <area width="100" height="100" left="300" top="300" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  29. <area width="100" height="100" left="400" top="300" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  30. <area width="100" height="100" left="500" top="300" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  31. <area width="100" height="100" left="600" top="300" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  32. <area width="100" height="100" left="700" top="300" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  33. <area width="100" height="100" left="0" top="400" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  34. <area width="100" height="100" left="100" top="400" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  35. <area width="100" height="100" left="200" top="400" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  36. <area width="100" height="100" left="300" top="400" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  37. <area width="100" height="100" left="400" top="400" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  38. <area width="100" height="100" left="500" top="400" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  39. <area width="100" height="100" left="600" top="400" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  40. <area width="100" height="100" left="700" top="400" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  41. <area width="100" height="100" left="0" top="500" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  42. <area width="100" height="100" left="100" top="500" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  43. <area width="100" height="100" left="200" top="500" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  44. <area width="100" height="100" left="300" top="500" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  45. <area width="100" height="100" left="400" top="500" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  46. <area width="100" height="100" left="500" top="500" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  47. <area width="100" height="100" left="600" top="500" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  48. <area width="100" height="100" left="700" top="500" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  49. <area width="100" height="100" left="0" top="600" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  50. <area width="100" height="100" left="100" top="600" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  51. <area width="100" height="100" left="200" top="600" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  52. <area width="100" height="100" left="300" top="600" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  53. <area width="100" height="100" left="400" top="600" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  54. <area width="100" height="100" left="500" top="600" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  55. <area width="100" height="100" left="600" top="600" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  56. <area width="100" height="100" left="700" top="600" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  57. <area width="100" height="100" left="0" top="700" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  58. <area width="100" height="100" left="100" top="700" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  59. <area width="100" height="100" left="200" top="700" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  60. <area width="100" height="100" left="300" top="700" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  61. <area width="100" height="100" left="400" top="700" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  62. <area width="100" height="100" left="500" top="700" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  63. <area width="100" height="100" left="600" top="700" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  64. <area width="100" height="100" left="700" top="700" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  65. <area width="100" height="100" left="0" top="800" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  66. <area width="100" height="100" left="100" top="800" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  67. <area width="100" height="100" left="200" top="800" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  68. <area width="100" height="100" left="300" top="800" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  69. <area width="100" height="100" left="400" top="800" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  70. <area width="100" height="100" left="500" top="800" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  71. <area width="100" height="100" left="600" top="800" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>
  72. <area width="100" height="100" left="700" top="800" url="INSERT_AD_URL_HERE" overlay="color(0,0,0)"/>

You can change the initial values of the script (like the URL variable) to generate new XML blocks. I'll be layering these on all my ad pages, essentially making the whole page clickable. BUT, with the code above, if a user moves thier mouse at most more than 141 pixels with the mouse button down, it won't register as a click on the ad. I'd like to make these boxes even smaller (really they should be about 10x10, so if the mouse moves 15 pixels it's not a click), but I also don't want to be adding many hundreds of lines to my .mz3 file.

A batcharea plugin based on batchpages would be a much better workaround.
« Last Edit: May 28, 2010, 09:00:08 pm by Ecnassianer »
See my megazine at CarpeChaos.com

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1985
  • MegaZine3 Developer
    • MegaZine3
Re: mouse_drag mouse drags should not activate links
« Reply #2 on: May 23, 2010, 01:01:44 pm »
Page content being interactive during drags/page turning was actually unintentional, I'm pretty sure it was blocked once, must have broken something somewhen. It's fixed again in the latest revision (410) and will be in 2.0.8.
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

Ecnassianer

  • Sr. Member
  • ****
  • Posts: 126
    • Carpe Chaos
Re: mouse_drag mouse drags should not activate links
« Reply #3 on: May 28, 2010, 08:39:21 am »
I'm still having my original problem in 2.0.8.

There might be a misunderstanding about what I'm requesting.

I'm not talking about dragging pages to turn them (that works fine).

I don't like mouse_move to move my oversized book around. I changed the .... I forget it's name, the container the book is in, to use mouse_drag, so you can drag the book around by "grabbing" it with a click.

If the "grab" click and following click-release are over the same linked area, the link is activated.

This behavior is undesirable in my situation, but it also seems undesirable in any container where mouse_drag is used. The completion of the task to add a user preference to toggle mouse_move and mouse_drag will aggravate this even more, since publishers who default to mouse_move are unlikely to test and discover this undesirable behavior when a user selects mouse_drag.
See my megazine at CarpeChaos.com

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1985
  • MegaZine3 Developer
    • MegaZine3
Re: mouse_drag mouse drags should not activate links
« Reply #4 on: May 29, 2010, 01:32:18 pm »
Ah, now I see. I indeed misunderstood, thought that were two separate issues. Guess I'll look into that issue then.

// Edit: have a look at revision 416, should work now (i.e. normal clicks still work, but as soon as a drag takes place the clicks will be blocked).
« Last Edit: May 29, 2010, 02:34:20 pm by Florian Nücke »
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.