-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A few random Data Interactive API issues and questions (both docs and implementation) #221
Comments
Another issue (or not). I'm trying to obtain the size of the interactive iframe set by user, but it doesn't seem to work. Dimensions are always I wanted to achive something like this:
The code I was trying to use: this.doCommand({action: 'get', resource: 'interactiveFrame'}, function (resp) {
if (resp.success) {
var existingConfig = resp.values;
var newIframeConfig = {
name: this.frameConfig.title,
title: this.frameConfig.title
};
// Update dimensions only if they are not set. So, only when the interactive is added to CODAP
// for the first time. Then, authors can adjust size of the interactive and it should be respected.
if (existingConfig.dimensions === null) {
newIframeConfig.dimensions = {
width: DEF_CODAP_WIDTH,
height: DEF_CODAP_WIDTH / this.frameConfig.aspectRatio
};
}
this.doCommand({
action: 'update',
resource: 'interactiveFrame',
values: newIframeConfig
});
}
}.bind(this)); The problem is that Not a big deal, but it would be cool feature for Lab. Using this thread as a notes for you that you may consider or not. |
@pjanik I haven't looked at the code, but it may a timing issue, e.g. during the document loading process CODAP may not know yet what the saved dimensions were. What I did in concord-consortium/sensor-interactive#22 is use
|
@pjanik , the "codap-present" message is a historical artifact and is, I believe, set regardless of game or data-interactive API. I agree it should be documented. I will do so. Yes, the 'codap-game' argument in the argument is to establish the API, and is the wrong value for this API. I will fix this, too. Concerning, setting dimensions, I am not sure why the dimensions are always null, but @kswenson's advise is right on target. |
Right, I thought about, but it requires developers to implement state handling that they wouldn't need to do otherwise. And this |
Docs say:
I might be misinterpreting this, but |
Initial message sent to Data Interactive
{message: 'codap-present'}
is not documented. It seems pretty useful, though. Other thing is that it doesn't really follow{action: ..., reseource: ..., value: ...}
format, but it doesn't seem to matter.Also, I've noticed that new API docs: https://github.com/concord-consortium/codap/wiki/CODAP-Data-Interactive-Plugin-API mention
codap-game
identifier instead ofdata-interactive
(just in one spot). I'm assuming that this identifier is used to decide whether API v1 or v2 will be used.I'm working on Lab upgrade (CODAP API v1 => v2), so I'm looking at these docs now. I can use this thread to add more feedback if I find anything interesting or worth fixing.
The text was updated successfully, but these errors were encountered: