Git Product home page Git Product logo

Comments (3)

remkoboschker avatar remkoboschker commented on September 24, 2024

In draggable-object.js

  didInsertElement: function() {
    let self = this;
    //if there is a drag handle watch the mouse up and down events to trigger if drag is allowed
    if (this.get('dragHandle')) {
      //only start when drag handle is activated
      if (this.$(this.get('dragHandle'))) {
        //this.set('dragReady', false);
        this.$(this.get('dragHandle')).on('mouseover', function(){
          self.set('dragReady', true);
        });
        this.$(this.get('dragHandle')).on('mouseout', function(){
          self.set('dragReady', false);
        });
      }
    }

not setting the dragReady to false fixes the issue. I'm not sure if this introduces any other issues. I assume you did not put it there for nothing. @mharris717 @dgavey Could you please advise? Not setting the dragReady to false fails the Integration | Component | draggable object: Draggable Object is only draggable from handle and Integration | Component | sortable objects: sortable object renders draggable objects tests.

I can check if the dragHandle property is set on the component and initialise the dragReady to false at component initialisation. Would that solve any other issues? This passes the tests.

  init: function() {
    if (this.get('dragHandle')) {
      this.set('dragReady', false);
    }
    this._super.apply(this, arguments);
  },
  didInsertElement: function() {
    let self = this;
    //if there is a drag handle watch the mouse up and down events to trigger if drag is allowed
    if (this.get('dragHandle')) {
      //only start when drag handle is activated
      if (this.$(this.get('dragHandle'))) {
        this.$(this.get('dragHandle')).on('mouseover', function(){
          self.set('dragReady', true);
        });
        this.$(this.get('dragHandle')).on('mouseout', function(){
          self.set('dragReady', false);
        });
      }
    }
  },

Happy to prepare a pull request.

from ember-drag-drop.

dgavey avatar dgavey commented on September 24, 2024

Your solution should work ok. I'm still a bit baffled why that was causing so many performance issues. Other than it's known that setting visual changes in didInsertElement can cause performance issues.

If you could prepare a PR that would be awesome. Thanks for checking on the tests as well.

from ember-drag-drop.

remkoboschker avatar remkoboschker commented on September 24, 2024

Thank you for the quick response. I have made a pull request #37. I'm not sure why the page was stalling with just this simple redraw. Each time I clicked a handle the warning was raised 72 times.

from ember-drag-drop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.