Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

double click to fold/unfold a lite

  • Loading branch information...
commit 806d8c4d2b6ce09b85ee6435180b7f7afa27f93f 1 parent 25e1f66
@cognominal authored
Showing with 25 additions and 4 deletions.
  1. +0 −1  TBD
  2. +25 −2 js/LiteViewport.js
  3. +0 −1  src/LiteViewport.coffee
View
1  TBD
@@ -23,7 +23,6 @@ Need folding too.
## TBD
* fix the current token highlighting when hoevering over the parse path pane
-* double click fold/unfold a lite
* simple click should freeze a lite, esc should unfreeze it
* Implement a recorder and a demo mode
* Parse path barpaned to be scrollable
View
27 js/LiteViewport.js
@@ -2,7 +2,7 @@
(function() {
$(function() {
- var cloneLiteViewport, dehilite, dynamicHiliteP, generateLite, generateLitePortviewContent, hilite, insertParseTree, j, liteId, markupForLiteViewport, paneId, ruleNm, showParsePath, showRule, _i, _len, _ref, _results;
+ var cloneLiteViewport, dehilite, dynamicHiliteP, generateLite, generateLitePortviewContent, hilite, insertParseTree, j, liteId, markupForLiteViewport, paneId, ruleNm, showParsePath, showRule, toggleLiteViewport, _i, _len, _ref, _results;
dynamicHiliteP = true;
markupForLiteViewport = function(viewportId) {
var idAndClass;
@@ -28,6 +28,26 @@
ev.stopPropagation();
return hilite(ev);
});
+ toggleLiteViewport = function(lid) {
+ var currentRulePane, display, none, parsePathPane;
+ currentRulePane = $("" + lid + " .currentRulePane");
+ parsePathPane = $("" + lid + " .parsePathPane");
+ none = currentRulePane.css("display") === 'none' || parsePathPane.css("display") === 'none';
+ display = none ? 'block' : 'none';
+ if (none) {
+ currentRulePane.show('slow');
+ return parsePathPane.show('slow');
+ } else {
+ currentRulePane.hide('slow');
+ return parsePathPane.hide('slow');
+ }
+ };
+ $('.liteViewport').live('dblclick', function(ev) {
+ var elt, lid;
+ elt = ev.currentTarget;
+ lid = liteId(elt);
+ return toggleLiteViewport(lid);
+ });
$(".parsePathItem").live('vmouseover', function(ev) {
var elt;
return elt = ev.currentTarget;
@@ -45,9 +65,12 @@
});
paneId = function(elt, paneNm) {
var id, match, re;
- id = $(elt).parents().filter(".liteViewport").attr('id');
+ id = $(elt).parents().add($(elt)).filter(".liteViewport").attr('id');
re = /-(\w+)$/;
match = re.exec(id);
+ if (!match) {
+ console.log('wtf');
+ }
if (!(match != null ? match.length : void 0)) {
alert;
View
1  src/LiteViewport.coffee
@@ -110,7 +110,6 @@ $ ->
# get the html id of a pane named `paneNm` that is a parent of `elt`
paneId = (elt, paneNm) ->
# get the id of the viewport to extract the unique suffix
- id = $(elt).parents().filter(".liteViewport").attr('id')
re = /-(\w+)$/;
match = re.exec(id)
alert unless match?.length
Please sign in to comment.
Something went wrong with that request. Please try again.