Giter Club home page Giter Club logo

Comments (3)

Aerilius avatar Aerilius commented on June 13, 2024

I am definitely interested. I was already looking into it, when I thought about exposing Ruby object properties as hierarchical trees (maybe by embedding Firefox's lazy loading object trees and implementing REPS protocol, but that single feature would have multiplied this extension's code).

It would not be too difficult to hard-code a single new visualization type in addition to the existing ones, but in the long-term I need to figure out an interface to make it extendible with more visualizations without blowing up the code.

from sketchup-console-plus.

thomthom avatar thomthom commented on June 13, 2024

Can you point me to where I'd start in trying to add such a prototype visualizer? Would it be in Ruby or JS?

from sketchup-console-plus.

Aerilius avatar Aerilius commented on June 13, 2024

The interactivity is added client-side in JavaScript, after tokenization and highlighting (with Ace's highlighter). So the output is already split into colorized HTML tags and annotated with CSS classes depending on the type of token. Look into feature_highlight_entity.js.

  • Define a regexp pattern to detect transformations in the output from their Ruby inspect string, and capture its object id. (If the desired string has been split into multiple HTML tags, one can avoid that by adding the string as a new token in mode-ruby_sketchup.js). But #<Geom::Transformation:...> is probably a single HTML tag with class sketchup.entity.
  • Define a function analog to addEntityHighlight that is given the matched HTMLElement and current state of the Regexp object and does something with it. For transformation, you could register an onclick event handler which will toggle a child element containing the matrix table.
  • In detectVisualizableElements, add a pattern match and call that function.
  • You can register an action callback
    dialog.on('get_transformation_matrix') { |action_context, object_id| ... }
    in feature_highlight_entity.rb and then do
    Bridge.get("get_transformation_matrix", object_id).then(function(matrix){ ... })
    where you receive the matrix and generate the HTML table.

from sketchup-console-plus.

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.