Giter VIP home page Giter VIP logo

Comments (7)

vlaaad avatar vlaaad commented on May 23, 2024 1

Yep, that's what I do. Not 100% happy about it, but it works good enough.

from cljfx.

vlaaad avatar vlaaad commented on May 23, 2024 1

I released a new version 1.6.7 which adds :on-width-changed and :on-height-changed props for a scene as well: it does not include window title bar.

Some day I'll go through all read-only properties and add change listener props for them...

from cljfx.

vlaaad avatar vlaaad commented on May 23, 2024

Lifecycle is a behavior that manages how things get created from description, changed to other value from previously created when description changes, and destroyed when description no longer exists. There are many of them for different kinds of situations.
As a user, you can consider lifecycle/event-handler and lifecycle/change-listener an implementation details that are irrelevant and just remeber this rule: all props for observing changes accept either a function or a map:

;; with this description it'll print whenever width is changed, useful for 
;; trying props for observing changes

{:fx/type :stage
 :on-width-changed #(prn :on-width-changed %)}

;; with this description your map event handler will receive map like 
;; {:foo "bar" :fx/event new-value}

{:fx/type :stage
 :on-width-changed {:foo "bar"}}

Hooking up another entry in my event handler multimethod doesn't seem to be working properly

Can you tell me how it is not working properly? Your renderer setup looks perfectly fine, I think, the only thing I would have changed there is replace (fx/wrap-map-desc assoc :fx/type root) with (fx/wrap-map-desc #(assoc % :fx/type root)) so it will access root through var lookup: it allows redefining root during development be reflected in app updates.

from cljfx.

kxygk avatar kxygk commented on May 23, 2024

I guess I was on the right track :) The issue turned out to be just an old version of cljfx that didn't have that property. Now everything is hooked up and working sorta

In your workflow how do you typically go about inspecting the available props from the REPL? Do you just open up the cljfx source a poke around?

from cljfx.

kxygk avatar kxygk commented on May 23, 2024

Thanks again for your help and guidance :)

from cljfx.

kxygk avatar kxygk commented on May 23, 2024

Hey @vlaaad , I think I found a lingering issue with using :on-height-changed stage/window events

It seem to ends up including the height of the window titlebar. And there is no clear way to subtract the title bar size. I can bake in some value for my machine, but the title bar will change between machines?

Do you have some workaround for tracking the actual size of the scene?

it's a bit silly, but I have a sub element that is rendered in a separate library, so i need to calculate the size it has available and then render it to the correct size so it fits

from cljfx.

kxygk avatar kxygk commented on May 23, 2024

Thank you for pushing that addition :)) . I'm sorry I'm not able to make a PR myself. I'm still trying to grok the internals

from cljfx.

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.