Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strokeScaleEnabled set to false Line object failed to fire mouseover and mouseout event #530

Closed
AlvinPLeung opened this issue Jul 16, 2013 · 3 comments
Labels

Comments

@AlvinPLeung
Copy link

When strokeScaleEnabled is set to false for Line object, the mouseover and mouseout event failed to fire. May be the hit region's strokeScaleEnabled did not set to false.

I am using FireFox 22.0. If mouse passes over the red line, the mouse pointer does not change. If mouse passes over the green line, the mouser pointer changes from arrow to finger pointer. Same issue exits for 4.4.3.

Example

<style> body { margin: 0px; padding: 0px; } </style>
<script src="http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.5.4.min.js"></script> <script defer="defer"> var scale = 0.1;
  var stage = new Kinetic.Stage({
    container: 'container',
    width: 578,
    height: 200
  });
  var layer = new Kinetic.Layer();

  var group = new Kinetic.Group({
     scale: [scale, scale],
  });

  var line1 = new Kinetic.Line({
    points: [73, 70, 340, 23, 450, 60, 500, 20],
    stroke: 'red',
    strokeScaleEnabled: false,
    strokeWidth: 5,
    lineCap: 'round',
    lineJoin: 'round'
  });

  line1.on('mouseover', function(evt) {
     document.body.style.cursor = "pointer";
  });

  line1.on('mouseout', function(evt) {
     document.body.style.cursor = "default";
  });
  group.add(line1);

  var line2 = new Kinetic.Line({
    points: [73, 70, 340, 23, 450, 60, 500, 20],
    stroke: 'green',
    strokeWidth: 5 / scale,
    lineCap: 'round',
    lineJoin: 'round'
  });

  line2.on('mouseover', function(evt) {
     document.body.style.cursor = "pointer";
  });

  line2.on('mouseout', function(evt) {
     document.body.style.cursor = "default";
  });

  group.add(line2);

  line1.move(100, 100);
  line2.move(100, 550);

  layer.add(group);
  stage.add(layer);

</script>
@ericdrowell
Copy link
Owner

Interesting, I'll add this to my todo list. Thank you!

@lavrton
Copy link
Contributor

lavrton commented Feb 27, 2014

Problem still exists. I made small fiddle for demonstration: http://jsfiddle.net/lavrton/h927F/

zachkinstner added a commit to zachkinstner/KineticJS that referenced this issue Aug 7, 2014
This fix involves copying some logic from Kinetic.SceneContext._stroke() to Kinetic.HitContext._stroke(). This fix resolves the immediate issues I'm having today -- I haven't tested other scenarios.
@lavrton
Copy link
Contributor

lavrton commented Jan 22, 2015

Fixed at fork. https://github.com/lavrton/KineticJS

@lavrton lavrton closed this as completed Jan 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants