Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/psychopy/psychopy
Browse files Browse the repository at this point in the history
  • Loading branch information
peircej committed Aug 14, 2018
2 parents 5c6b764 + 548e84f commit 40ee254
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
20 changes: 14 additions & 6 deletions psychopy/experiment/components/mouse/__init__.py
Expand Up @@ -149,16 +149,24 @@ def _writeClickableObjectsCodeJS(self, buff):
code = (
"// check if the mouse was inside our 'clickable' objects\n"
"my.gotValidClick = false;\n"
"for (const obj of [{clickable}]) {{\n"
"for (const obj of {clickable}) {{\n"
" if (obj.contains({name})) {{\n"
" my.gotValidClick = true;\n"
" {name}.clicked_name.push(obj.name);\n"
" console.log('INSIDE ' + obj.name);\n"
" }}\n"
"}}\n")
" my.gotValidClick = true;\n")
buff.writeIndentedLines(code.format(name=self.params['name'],
clickable=self.params['clickable']))

buff.setIndentLevel(+2, relative=True)
dedent = 2
code = ''
for paramName in self._clickableParamsList:
code += "%s.clicked_%s.push(obj.%s)\n" % (self.params['name'],
paramName, paramName)

buff.writeIndentedLines(code % self.params)
for dents in range(dedent):
buff.setIndentLevel(-1, relative=True)
buff.writeIndented('}\n')

def writeInitCode(self, buff):
code = ("%(name)s = event.Mouse(win=win)\n"
"x, y = [None, None]\n"
Expand Down
3 changes: 2 additions & 1 deletion psychopy/experiment/components/polygon/__init__.py
Expand Up @@ -211,13 +211,14 @@ def writeInitCodeJS(self, buff):
code = ("{name} = new Rect ({{\n"
" win: my.window, name: '{name}',\n"
" units: my.window.units,\n"
" width: [.5, 1][0], height: [.5, 1][1],\n"
" width: {size}[0], height: {size}[1],\n"
" ori: 0, pos: {pos},\n"
" lineWidth: 1, lineColor: new Color({lineColor}),\n"
" fillColor: new Color({fillColor}),\n"
" opacity: 1, depth: -1.0, interpolate: true,\n"
"}});\n")
buff.writeIndentedLines(code.format(name=self.params['name'],
pos=self.params['pos'],
size=self.params['size'],
lineColor=self.params['lineColor'],
fillColor=self.params['fillColor']))

0 comments on commit 40ee254

Please sign in to comment.