cesium icon indicating copy to clipboard operation
cesium copied to clipboard

CreditDisplay.addDefaultCredit can't be shown in the lightbox

Open ggetz opened this issue 8 years ago • 13 comments

CreditDisplay.addDefaultCredit doesn't take Credit.showOnScreen into account, but CreditDisplay.addCredit does.

From the forum: https://groups.google.com/forum/#!topic/cesium-dev/3qiLgbwJCZI

ggetz avatar Feb 13 '18 22:02 ggetz

This was more-or-less by design, but it shouldn't be too hard to change

hpinkos avatar Feb 13 '18 23:02 hpinkos

@hpinkos Is there a particular reason not to show additional credits in the lightbox? Someone on the forum was looking to do just that. If it's on purpose, we should at least clarify in the docs.

ggetz avatar Feb 14 '18 15:02 ggetz

We just made the assumption that a default credit is probably something important and should always show on screen. Like I said, I don't think it will be too hard to change it though.

hpinkos avatar Feb 14 '18 15:02 hpinkos

Maybe I'm just confused but what exactly is the difference between addCredit and addDefaultCredit other than the showOnScreen option? I guess I don't understand why we need two functions anymore.

mramato avatar Feb 14 '18 15:02 mramato

addCredit is for credits that depend on the view (imagery/terrain credits), and have to be re-added every frame. addDefaultCredit is for credits that are just always there (the cesium logo)

showOnScreen controls whether the credits are shown in the lightbox or at the bottom of the screen.

hpinkos avatar Feb 14 '18 15:02 hpinkos

Our documentation on this is pretty sparse. We should probably consider changing the names of these functions and expanding their documentation (as well as adding better summary documentation to CreditDisplay overall). Also sounds like showOnScreen should be supported in all cases.

I can't imagine end users ever calling addCredit themselves, they would need to call it every frame, right? Perhaps addCreditToNextFrame would make more sense? And addDefaultCredit just becomes addCredit at some point (though we should eventually make this a collection like we do elsewhere).

mramato avatar Feb 14 '18 15:02 mramato

If we're cleaning this up, we should probably make creditDisplay a member of scene as well. Right now you have to go through the frameState: viewer.scene.frameState.creditDisplay

ggetz avatar Feb 14 '18 15:02 ggetz

I think it makes sense that CreditDisplay is part of the frameState, I wouldn't move it.

hpinkos avatar Feb 14 '18 15:02 hpinkos

I think it does make sense to expose it at a higher level though, we do this elsewhere. So a getter property like viewer.credits or viewer.creditDisplay makes total sense.

mramato avatar Feb 14 '18 16:02 mramato

addCredit is public API for people making their own imagery or terrain provider.

shunter avatar Feb 14 '18 16:02 shunter

@shunter good point, the name is still terrible though :)

mramato avatar Feb 14 '18 20:02 mramato

Just 👍 here that we should expose addDefaultCredit in the public API. I recently had to do something like this, and not seeing anything in the public API, ended up just grabbing the div and adding what I needed there directly.

OmarShehata avatar Jun 10 '19 11:06 OmarShehata

Also reported by @cmcleese in https://github.com/CesiumGS/cesium/issues/10789.

ggetz avatar Sep 16 '22 13:09 ggetz

Hello, is this the current recommendation to grab the html of the lightbox and inject the custom credits there? Because this seems like a hack.

I'd like to add some custom credits in the lightbox. I don't need them in the credits container. Neither addCredits nor addDefaultCredits is doing the job. Since this issue is already 5 years old, is there any chance this gets fixed anytime soon?

Moreover, the credit display is only accessible through viewer.scene._frameState, with frameState not being part of the public API.

https://sandcastle.cesium.com/#c=1ZNNa8MwDIb/ivGlLRSbXbc0rE2Ogx0KOxmKYiutqeMEW2npfv2cBEbZCtsOg+1irEdfr2SsWx+JnSyeMbAV83hmBUbbN+JlZHPF9WgXrSewHoPiiwfllZ9yRNToUezqAA1uCQiFDmgslTZ2Di4CjClGMFeeXdd/p4pmGbBDwHql+IGoi/dSTk2FbhupOCMIe6Tk3lUO/FHxPIsdeEaWHCYMAImt1+tMDjzPJOSz5dCQsRpcxPG+SOek/SfqS6yhd/T7Q1RVldhms/nmEH/pAbTWiRVFcUM7hf5f7N8Yk1hZll/PwJc8i3RxmE9uxh5t07WBWB/cXAhJ2CT9hFFWvT4iCR3jMPoQmspfpWbGnpg1qxv/jGkHMSZP3Tu3ta84SJYp/lOqa8FYv38+YUhbG8IOd/nTBIUQmUzm7UxqW1dB+FD5DQ

anne-gropler avatar Apr 04 '23 08:04 anne-gropler