Giter Site home page Giter Site logo

Comments (4)

mnquintana avatar mnquintana commented on July 22, 2024

I might be misunderstanding, but you shouldn't need to instantiate a Point directly – any Atom methods that accept Points also accept arrays of the coordinates, e.g. [0, 140]. Does that cover what you're looking for?

from text-buffer.

Byron avatar Byron commented on July 22, 2024

Thanks for getting back to me !
What I need is to use Point methods to aid my own computations. For this to work, I will want to instantiate points myself.

For example, here I set the cursor position, just to use that and obtain a point at the given position later. Doing that works but is more cumbersome than it has to be.

A viable solution could already be to use the constructor directly, such as in new myPointInstance.constructor(0, 1). When looking at my code, I believe this is a viable way to do this.

Even though I am closing this ticket, it might be worth discussing whether utility types should provide a way to be instantiated from plugins as well.

from text-buffer.

lee-dohm avatar lee-dohm commented on July 22, 2024

You should be able to get a hold of Atom's Point class (along with many other of Atom's utility classes) by using (in CoffeeScript):

{Point} = require 'atom'

from text-buffer.

Byron avatar Byron commented on July 22, 2024

Thank you, this works perfectly.
It's interesting to know and finally understand that the atom instance is not to be confused with the atom module.

from text-buffer.

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.