Bryan Head committed 6cda830 Draft

Patches now only redraw on set_pcolor if the new_color is different than the old.

Comments (0)

Files changed (1)

 class Patch
   pcolor:  "black"
-  set_pcolor: (newColor) -> @pcolor = newColor; @draw()
+  set_pcolor: (newColor) ->
+    if newColor!=@pcolor
+      @pcolor = newColor
+      @draw()
   constructor: (@pxcor, @pycor) ->
   draw: ->
     # FIXME patches don't seem to always seem to paint perfectly in their cell.
     s = world.patch_size
     patchCtx.fillRect lPixX, tPixY, s, s
+@patch_no_wrap = (x, y) ->
+  rows = world.max_pycor-world.min_pycor+1
+  row = Math.round(y-world.min_pycor)
+  col = Math.round(x-world.min_pxcor)
+  patches[rows*col + row]
 @patch = (x, y) ->
   rows = world.max_pycor-world.min_pycor+1
   cols = world.max_pxcor-world.min_pxcor+1
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.