Skip to content
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

Update act2model.json #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

prasht63
Copy link

The bug is fixed.The second atom is restored to its earlier position when reshown and does not disturb the first atom when hidden.However I have used a very crude method of storing the position parameters of the second atom.I stored them in velocity of the first atom as it didn't create any problem.the fix can be improved by using global variables to store the position parameter.

The bug is fixed.The second atom is restored to its earlier position when reshown and does not disturb the first atom when hidden.However I have used a very crude method of storing the position parameters of the second atom.I stored them in velocity of the first atom as it didn't create any problem.the fix can be improved by using global variables to store the position parameter.
@scytacki
Copy link
Member

There is a lot of noise in the diff. Probably because you pasted in what was saved by interactive editor. Can you start with the original file in git, and then just change the part that needs to be changed to fix the issue?

You can either click the edit button again on the original file. Which will make a new pull request.

Or you can clone your fork of lab-interactive-site locally and then revise or amend the commit in your patch-1 branch, and force push it back to your fork on github. Do that will update this pull request.

@ddamelin
Copy link
Contributor

Is there a reason you did not use new parameters to store this value. The use of an atom's vx and vy was a creative solution, but not one we would want to merge unless there were not a way to use the parameters to store this.

You can define your own parameters and these act like global variables. Take a look at how the parameters are used in some other interactives.

-Dan

On Mar 15, 2014, at 11:45 AM, prasht63 wrote:

The bug is fixed.The second atom is restored to its earlier position when reshown and does not disturb the first atom when hidden.However I have used a very crude method of storing the position parameters of the second atom.I stored them in velocity of the first atom as it didn't create any problem.the fix can be improved by using global variables to store the position parameter.

You can merge this Pull Request by running

git pull https://github.com/prasht63/lab-interactives-site patch-1
Or view, comment on, or merge it at:

#1

Commit Summary

Update act2model.json
File Changes

M src/interactives/interactions/act2model.json (114)
Patch Links:

https://github.com/concord-consortium/lab-interactives-site/pull/1.patch
https://github.com/concord-consortium/lab-interactives-site/pull/1.diff

Reply to this email directly or view it on GitHub.

@prasht63
Copy link
Author

Hi ,
@scytacki It seems the whole code got pasted thats why the noise in the diff.I will take care of it next time.
@ddamelin I am trying to define a parameter but no luck till now. will it be possible for you to send me some link where there is a example?

}
],
"propertiesToRetain": [],
"parameters": [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the section where parameters are defined. Only name and initialValue are required. Here is where you could define parameters to store the position of the second atom.

You use get('parameter-name') and set('parameter-name', value) to work with them. Here is an example of an interactive that uses a lot of parameters: http://lab.concord.org/interactives.html#interactives/inquiry-space/1-pendulum.json

@prasht63
Copy link
Author

Hi
"parameters": [
{
"name": "buffer_x",
"initialValue": 1.23

},
{   
  "name": "buffer_y",
  "initialValue": 1.23

},
{   
  "name": "show-second-atom",
  "initialValue": false,
  "onChange": [
    "if (value) {",
    "  addAtom({ element:2,",
    "                 x: buffer_x,",
    "                 y: buffer_y,",
    "                 charge:2,",
    "                 vx: 0,",
    "                 vy: 0});",
    "} else {","buffer_x:getAtomProperties(1).x", "buffer_y:getAtomProperties(1).y",

    "  removeAtom(1);",
    "}"

I am trying it this way but I think the buffer_x and buffer_y parameters are not global in their scope , because when onChange function gets triggered it gives a error message that buffer_x , buffer_y are not defined. Can you correct me where I am going wrong?

@ddamelin
Copy link
Contributor

You need to use the set and get functions I described above. See the example interactive I referenced to see those functions in action.

@prasht63
Copy link
Author

I fixed the bug as you suggested , going to submit a pull request.

scytacki pushed a commit that referenced this pull request Apr 17, 2014
New directory structure for norwegian nynorsk
sfentress added a commit that referenced this pull request Nov 3, 2014
Since Electric PE interactives #1 and #2 do not include a run button,
and allow dragging when stopped, this change will have no effect on
those models.

[#81553958]
ddamelin pushed a commit that referenced this pull request Feb 26, 2015
Update breaking-molecular-bond.json
pjanik pushed a commit that referenced this pull request Aug 21, 2017
Pull from Concord (contains Greek 5-amino-acids.json)
pjanik pushed a commit that referenced this pull request Jan 27, 2020
@pjanik pjanik force-pushed the master branch 2 times, most recently from 0ae8009 to 10a0b84 Compare January 27, 2020 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants