Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 887589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:15:10+00:00 2026-05-15T13:15:10+00:00

I have found a script that adds mouse trail on Opera’s mouse gesture. Very

  • 0

I have found a script that adds mouse trail on Opera’s mouse gesture. Very nice done but with one problem. It detects when the mouse button is down and starts to draw a line BUT it doesn’t detect when the mouse button is released. The trail is displayed for an amount of time (1 second). Can the script be updated so that the trail is present on screen as long as the button mouse is pressed ?

The script was found in http://extendopera.org/userjs/content/gesture-tails

var GestureTrail={
//options:
  opacity:1,
  color:'#f27',


        canvas:null,
        _2d:null,
        start:null,
        cur:null,
        isdown:false,
        init:function(){

        /* create a transparent canvas element the size of
           the full window and insert it into the document */
          var canvas=document.createElement('canvas');
          canvas.height=window.innerHeight;
          canvas.width=window.innerWidth;
          document.body.appendChild(canvas);
          canvas.style="position:fixed;top:0;display:none;z-index:-999;left:0;opacity:"+this.opacity+";";
          this.canvas=canvas;

        /* grab the 2d methods for the canvas element */
          this._2d=this.canvas.getContext('2d');

    window.addEventListener("mousemove",function(e){GestureTrail.draw(e);},0);
    window.addEventListener("mouseup",function(e){GestureTrail.release();},0);
        },
        click:function(e){
          if(e.button!=2){return true;} // if not rightclick
          this.start={x:e.clientX,y:e.clientY}; // set the line start-point to the mouse position
                this._2d.strokeStyle=this.color;
          this.isdown=true;
          setTimeout(function(){GestureTrail.release();},1000); // thanks to Somh for thinking of this
          },
        draw:function(e){
          if(!this.isdown){return;} // if the mouse isn't down
          this.canvas.style.zIndex="999";    // bring the canvas element to the top 
          this.canvas.style.display="block"; /* (must be done on move - if done on mousedown
                                                it obscures text selection (HotClick) context menu) */
                this.cur={x:e.clientX,y:e.clientY}; // set point to begin drawing from
    this._2d.beginPath();
                this._2d.moveTo(this.start.x,this.start.y);
                this._2d.lineTo(this.cur.x,this.cur.y);
                this._2d.stroke();
    this.start=this.cur; /* sets the startpoint for the next mousemove to the
                             current point, otherwise the line constantly restarts
                             from the first point and you get a kind of fan-like pattern */
        },
        release:function(){
          this._2d.clearRect(0,0,window.innerWidth,window.innerHeight); // wipe the trails from the entire window
          this.isdown=false;
          this.canvas.style.zIndex="-999"; // send the canvas element back down below the page
          }
};

window.opera.addEventListener("BeforeEvent.mousedown",function(e){GestureTrail.click(e.event);},0);
window.addEventListener('DOMContentLoaded',function(){GestureTrail.init();},0);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:15:11+00:00Added an answer on May 15, 2026 at 1:15 pm

    remove:

      setTimeout(function(){GestureTrail.release();},1000); // thanks to Somh for thinking of this
    

    thats at the end of the click function. that should be all

    but that is a site for real programming questions, not for customers to look for programms to do their work without payment

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.