viewer.js
3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// ******* SITEMAP TOOLBAR VIEWER ACTIONS ******** //
$axure.internal(function ($ax) {
var userTriggeredEventNames = ['onClick', 'onDoubleClick', 'onMouseOver', 'onMouseMove', 'onMouseOut', 'onMouseDown', 'onMouseUp',
'onKeyDown', 'onKeyUp', 'onFocus', 'onLostFocus', 'onTextChange', 'onSelectionChange', 'onSelectedChange', 'onSelect', 'onUnselect',
'onSwipeLeft', 'onSwipeRight', 'onSwipeUp', 'onSwipeDown', 'onDragStart', 'onDrag', 'onDragDrop', 'onScroll', 'onContextMenu', 'onMouseHover', 'onLongClick'];
$ax.messageCenter.addMessageListener(function(message, data) {
//If annotation toggle message received from sitemap, toggle footnotes
if(message == 'annotationToggle') {
if(data == true) {
$('div.annotation').show();
$('div.annnotelabel').show();
$('div.annnoteimage').show();
} else {
$('div.annotation').hide();
$('div.annnotelabel').hide();
$('div.annnoteimage').hide();
}
}
});
var lastSelectedWidgetNote;
$ax.messageCenter.addMessageListener(function (message, data) {
//If annotation toggle message received from sitemap, toggle footnotes
if(message == 'toggleSelectWidgetNote') {
if(lastSelectedWidgetNote == data) {
$('#' + lastSelectedWidgetNote).removeClass('widgetNoteSelected');
lastSelectedWidgetNote = null;
return;
}
if(lastSelectedWidgetNote) $('#' + lastSelectedWidgetNote).removeClass('widgetNoteSelected');
$('#' + data).addClass('widgetNoteSelected');
lastSelectedWidgetNote = data;
}
});
var highlightEnabled = false;
$ax.messageCenter.addMessageListener(function(message, data) {
if(message == 'highlightInteractive') {
highlightEnabled = data == true;
_applyHighlight($ax('*'));
}
});
var _applyHighlight = $ax.applyHighlight = function(query, ignoreUnset) {
if(ignoreUnset && !highlightEnabled) return;
var pulsateClassName = 'legacyPulsateBorder';
//Find all widgets with a defined userTriggeredEventName specified in the array above
var $matchingElements = query.filter(function(obj) {
if(obj.interactionMap) {
for(var index in userTriggeredEventNames) {
if(obj.interactionMap[userTriggeredEventNames[index]]) return true;
}
} else if ($ax.public.fn.IsVector(obj.type) && obj.referencePageUrl) {
return true;
}
return false;
}).$();
var isHighlighted = $matchingElements.is('.' + pulsateClassName);
//Toggle the pulsate class on the matched elements
if(highlightEnabled && !isHighlighted) {
$matchingElements.addClass(pulsateClassName);
} else if(!highlightEnabled && isHighlighted) {
$matchingElements.removeClass(pulsateClassName);
}
};
});