Open prasht63 opened 10 years ago
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.
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:
https://github.com/concord-consortium/lab-interactives-site/pull/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.
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?
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?
You need to use the set and get functions I described above. See the example interactive I referenced to see those functions in action.
I fixed the bug as you suggested , going to submit a pull request.
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.