 
   events: ->
     super(arguments...).concat
-      'mousemove .render-area canvas': @mouseMoveRenderAreaCanvas
-
-  mouseMoveRenderAreaCanvas: (event) ->
+      'mousemove .render-area canvas': @onMouseMoveRenderAreaCanvas
+
+  onMouseMoveRenderAreaCanvas: (event) ->
     return unless surfaceHelpers = @surfaceHelpers()
-
-    mousePosition = new THREE.Vector3 event.offsetX, event.offsetY, 0
-    direction = surfaceHelpers.rayTarget.clone().sub(mousePosition).normalize()
-
-    @lightRayDirection direction
+    keyboardState = AC.Keyboard.getState()
+
+    if keyboardState.isKeyDown AC.Keys.m
+      mousePosition = new THREE.Vector3 event.offsetX, event.offsetY, 0
+      direction = surfaceHelpers.rayTarget.clone().sub(mousePosition).normalize()
+
+      @lightRayDirection direction
+
+    else
+      surfaceCanvas = @surfaceCanvas()
+      size = @size()
+
+      surfaceCanvas.context.fillStyle = 'white'
+
+      if keyboardState.isKeyDown AC.Keys[1]
+        brushWidth = 1
+
+      else if keyboardState.isKeyDown AC.Keys[2]
+        brushWidth = 3
+
+      else if keyboardState.isKeyDown AC.Keys[3]
+        brushWidth = 5
+
+      else if keyboardState.isKeyDown AC.Keys[4]
+        brushWidth = 7
+
+      if keyboardState.isKeyDown AC.Keys.e
+        surfaceCanvas.context.fillStyle = 'black'
+
+      if brushWidth
+        x = Math.floor(event.offsetX / size.width * surfaceCanvas.width) + 0.5
+        y = Math.floor(event.offsetY / size.height * surfaceCanvas.height) + 0.5
+        h = brushWidth / 2
+
+        surfaceCanvas.context.fillRect x - h, y - h, brushWidth, brushWidth
+
+        @surfaceCanvas surfaceCanvas
 
   class @MaterialId extends @DataInputComponent
     @register 'Artificial.Reality.Pages.Chemistry.Materials.Scattering.MaterialId'


  onCreated: ->
    super arguments...

    @app = @ancestorComponent Retronator.App
    @app.addComponent @


      _.sortBy options, 'name'

    save: ->
      super arguments...

      @parentComponent.$('select').blur()

  class @SurfaceImageUrl extends @DataInputComponent
    @register 'Artificial.Reality.Pages.Chemistry.Materials.Scattering.SurfaceImageUrl'

