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

  • Home
  • SEARCH
  • 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 7911395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:13:59+00:00 2026-06-03T13:13:59+00:00

This function builds an NxN grid on a canvas and returns the layer for

  • 0

This function builds an NxN grid on a canvas and returns the layer for use. On mouseover, it changes the color of the cells. But what i need is to run mouseover only on mousedown, like a brush. How do I do it?

function buildGrid(config){
    var layer = new Kinetic.Layer(),i, j;
    for(i=0;i<config.y;i++){
        for(j=0;j<config.x;j++){
            (function(i,j){
                var cell = new Kinetic.Rect({
                    x: j * config.width,
                    y: i * config.height,
                    width: config.width,
                    height: config.height,
                    fill: "#00D2FF",
                    stroke: "black",
                    strokeWidth: 1
                })
                cell.on('mouseover',function(){
                    this.setFill('#F00');
                    layer.draw();
                });
                layer.add(cell)
            }(i,j));
        }
    }    
    return layer;
}
  • 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-06-03T13:14:00+00:00Added an answer on June 3, 2026 at 1:14 pm

    have you tried “dragmove” instead of “mouseover”?


    what about having mousedown set a variable that is checked for by the mouseover code?

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

Sidebar

Related Questions

How do I modify this function that dynamically builds a drop down list so
I have a function that builds and returns an XML document. I then want
I need to repeatedly generate a Win32 DLL with a registration information function. This
I have a function which builds html controls dynamically with jQuery and Knockout, but
Is this the right place to call the function that builds the RSS? its
I'm attempting to build a simple plugin like this (function($) { $.fn.gpSlideOut = function(options,
This function declaration gives me errors: ostream& operator<<(ostream& os, hand& obj); The errors are:
This function is written in ActionScirpt. What kind of decryption this is? Is there
This function of mine keeps on failing an autograder, I am trying to figure
This function creates & stores a cookie, and here it stores the name of

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.