Giter Site home page Giter Site logo

Comments (4)

lavrton avatar lavrton commented on May 11, 2024

Why do you need such method? You can create Konva.Text instance. And then use width() and height() functions.

from konva.

sprice237 avatar sprice237 commented on May 11, 2024

You're absolutely right, that works out perfectly. I will make sure I research the rest of the framework thoroughly before I propose a change in the future.

from konva.

lavrton avatar lavrton commented on May 11, 2024

I want to reopen issue. Now I think this code might be useful. Currently if you want to create your own shape you have to use this:

var triangle = new Konva.Shape({
      sceneFunc: function(context) {
        context.beginPath();
        context.moveTo(20, 50);
        context.lineTo(220, 80);
        context.quadraticCurveTo(150, 100, 260, 170);
        context.closePath();
        context.fillStrokeShape(this);
      },
      fill: '#00D2FF',
      stroke: 'black',
      strokeWidth: 4
    });

context argument is not native canvas context. It is Konva wrapper. But users expect here native context (and all available methods from context). So I want to make possible to work with this wrapper in completely same way as with native context.
One more example if want to change context attributes on this function you have to write:

context.setAttr('globalCompositeOperation', 'destination-over');
// or
var nativeContext = context._context;
nativeContext .globalCompositeOperation =  'destination-over';

It is all unclear.

from konva.

lavrton avatar lavrton commented on May 11, 2024

close by 18cce13

from konva.

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.