Permalink
Browse files

breadboard: added no-tooltip option to hardware

  • Loading branch information...
luto committed Jan 17, 2015
1 parent ed152ac commit d4fe107aff78e24def8b7507eb94ff38b2cfa5d3
Showing with 20 additions and 17 deletions.
  1. +1 −0 doc/hardware/breadboard.md
  2. +19 −17 src/app/js/editor/breadboard/breadboard.js
@@ -49,6 +49,7 @@ if (!yasp.BreadBoardTypes) yasp.BreadBoardTypes = { };
// where to show the tooltip which contains additional information such as used pin
// possible values: left, right, top, bottom (default = top)
+ // to disable the tooltip entirely, set 'tooltip' to false
tooltip: {
placement: "bottom"
},
@@ -100,27 +100,29 @@ if (typeof yasp == 'undefined') yasp = { };
$wrapper.css('top', (appear.top / image.height) * 100 + "%");
$wrapper.css('left', (appear.left / image.width) * 100 + "%");
- var tooltipTitle = "";
-
- if(definition.pins.length) {
- tooltipTitle = "Pin: " + definition.pins[0].emulator;
- } else {
- tooltipTitle = "Pins:<br>";
- for (var i = 0; i < definition.pins.length; i++) {
- var pin = definition.pins[i];
- tooltipTitle += pin.hardware + "\u2794" + pin.emulator;
-
- if(i != definition.pins.length - 1) {
- tooltipTitle += "<br>";
+ if(definition.tooltip !== false) {
+ var tooltipTitle = "";
+
+ if (definition.pins.length) {
+ tooltipTitle = "Pin: " + definition.pins[0].emulator;
+ } else {
+ tooltipTitle = "Pins:<br>";
+ for (var i = 0; i < definition.pins.length; i++) {
+ var pin = definition.pins[i];
+ tooltipTitle += pin.hardware + "\u2794" + pin.emulator;
+
+ if (i != definition.pins.length - 1) {
+ tooltipTitle += "<br>";
+ }
}
}
- }
- $wrapper.attr('title', tooltipTitle);
+ $wrapper.attr('title', tooltipTitle);
- var tooltipOptions = definition.tooltip || {};
- tooltipOptions.html = true;
- $wrapper.tooltip(tooltipOptions);
+ var tooltipOptions = definition.tooltip || {};
+ tooltipOptions.html = true;
+ $wrapper.tooltip(tooltipOptions);
+ }
if(appear.height)
$wrapper.css('height', (appear.height / image.height) * 100 + "%");

0 comments on commit d4fe107

Please sign in to comment.