From 912bd53ea7a631dce774bb7dd380e77dfd0e0680 Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Sat, 17 Oct 2015 14:41:22 -0400 Subject: [PATCH] fix hover --- main.coffee | 7 +++---- style.styl | 33 ++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/main.coffee b/main.coffee index 3ed08db..1f4edfc 100644 --- a/main.coffee +++ b/main.coffee @@ -235,7 +235,7 @@ init = -> ] svg.appendChild json_to_svg style: type: 'text/css' - contents: '.box.normal,.box.selected{filter: url(#crayon)}' + contents: '.box.normal{filter: url(#crayon)}' # create canvas border svg.appendChild json_to_svg rect: @@ -397,10 +397,9 @@ init = -> w.drag x: rel_x, y: rel_y else hit = closest_in_layers xy - return unless hit? - return if hit.s is hovered - if hovered + if hovered and hovered isnt hit?.s hovered.set_hover false + return unless hit? hovered = hit.s hovered.set_hover true return diff --git a/style.styl b/style.styl index 5cd95d3..ca5a197 100644 --- a/style.styl +++ b/style.styl @@ -17,9 +17,10 @@ color_dragging = #9e9373 color_controls = #000 color_controls_hover = #222 color_controls_selected = #444 +color_controls_dragging = #666 .crayon_mockup svg - path.polyline + .polyline fill: none stroke-width: 5 stroke-linecap: butt @@ -28,10 +29,9 @@ color_controls_selected = #444 stroke-opacity: 1 stroke-dasharray: none // fails in firefox (must be inline) filter: url(#crayon) - rect - fill: none - rect.canvas_border + .canvas_border overflow: hidden + fill: none stroke: #ccc stroke-width: 2 stroke-linecap: butt @@ -39,24 +39,27 @@ color_controls_selected = #444 stroke-dasharray:2 4 stroke-dashoffset:1 //stroke-opacity:1;marker:none;enable-background:accumulate - rect.box + .box stroke: color_crayon + fill: none stroke-width: 4 stroke-linecap: butt stroke-linejoin:miter // this doesn't work in firefox: filter: url(#crayon) - rect.box, path.polyline + .box, .polyline stroke: color_crayon - rect.box.hover, path.polyline.hover - stroke: color_hover - rect.box.dragging, path.polyline.dragging - stroke: color_dragging - rect.box.selected, path.polyline.selected + .box.selected, .polyline.selected stroke: color_selected - circle.control_point + .box.dragging, .polyline.dragging + stroke: color_dragging + .box.normal.hover, .polyline.normal.hover + stroke: color_hover + .control_point stroke: none fill: color_controls - circle.control_point.hover - fill: color_controls_hover - circle.control_point.selected + .control_point.selected fill: color_controls_selected + .control_point.dragging + fill: color_controls_dragging + .control_point.normal.hover + fill: color_controls_hover -- 1.7.10.4