From 68d6154a5e8de7686fb45682db01e57ed1e9c570 Mon Sep 17 00:00:00 2001 From: Andrey Savchenko Date: Fri, 6 Dec 2013 19:17:55 +0200 Subject: [PATCH] Switched handling of minimum event width to CSS --- css/laps.css | 1 + css/laps.less | 1 + src/class-laps.php | 16 ++-------------- views/laps.mustache | 2 +- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/css/laps.css b/css/laps.css index 6a10e11..11b3075 100644 --- a/css/laps.css +++ b/css/laps.css @@ -39,6 +39,7 @@ transition: width 0.6s ease; position: absolute; border-left: 1px solid #f5f5f5; + min-width: 2px; } #wpadminbar .laps-timeline .event-theme { background-color: #5cb85c; diff --git a/css/laps.less b/css/laps.less index c56650c..388be0d 100644 --- a/css/laps.less +++ b/css/laps.less @@ -51,6 +51,7 @@ .transition(width .6s ease); position: absolute; // disable stacking at start border-left: 1px solid @timeline-bg; + min-width: 2px; } .laps-timeline .event-theme { diff --git a/src/class-laps.php b/src/class-laps.php index 738f4c3..0613fb0 100644 --- a/src/class-laps.php +++ b/src/class-laps.php @@ -252,15 +252,9 @@ class Laps { if ( $offset == $last_offset ) { $key = count( $query_data ) - 1; $query_data[$key]['sql'] .= '
' . $sql; + $last_duration += $duration; - $width = round( $last_duration / $total * 100, 2 ); - - if ( 0 == $width ) { - $width = '2px'; - } else { - $width .= '%'; - } - + $width = round( $last_duration / $total * 100, 2 ); $query_data[$key]['width'] = $width; continue; @@ -270,12 +264,6 @@ class Laps { $last_offset = $offset; $last_duration = $duration; - if ( 0 == $width ) { - $width = '2px'; - } else { - $width .= '%'; - } - $query_data[] = compact( 'sql', 'duration', 'offset', 'width', 'category' ); } } diff --git a/views/laps.mustache b/views/laps.mustache index 93e1bef..5c51e97 100644 --- a/views/laps.mustache +++ b/views/laps.mustache @@ -7,7 +7,7 @@ {{#savequeries}}
{{#queries}} -
+
{{/queries}}
{{/savequeries}}