Skip to content

Commit 170555a

Browse files
authored
usa tecla command ao invés de ctrl no macos
1 parent 18c9312 commit 170555a

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

rede/templates/rede_template.html

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
gparam.inicioToque = 0;
7272
gparam.mobile = gparam.inicio.mobile;
7373
gparam.safari = false;
74+
gparam.macos = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
7475
gparam.eventclick = 'click'; //no safari ='touchend'
7576
//gparam.bRotulosCompletos = true;
7677
gparam.kTipoRotulo = 0; //rotulo completo,
@@ -503,6 +504,10 @@
503504
return imagem;
504505
} //function iconeF
505506

507+
function teclaCtrlF(event) {
508+
return gparam.macos ? event.metaKey: event.ctrlKey;
509+
}
510+
506511
graphics.node(function(node) {
507512
// This time it's a group of elements: http://www.w3.org/TR/SVG/struct.html#Groups
508513
let ui = Viva.Graph.svg('g');
@@ -624,7 +629,7 @@
624629
return;
625630
}
626631

627-
if (!event.ctrlKey) {
632+
if (!teclaCtrlF(event)) {
628633
event.preventDefault();
629634
selecionaNoid(node.id, event.shiftKey);
630635
//pinarNoTemp(node.id, 500); //pausar layout é melhor que só pinar o nó
@@ -913,11 +918,19 @@
913918
Setup:function() {
914919
/*seleção retangular */
915920
var multiSelectOverlay;
921+
gparam.whichCTRLKey = 17;
922+
if (gparam.macos) {
923+
{% if parametros.firefox %}
924+
gparam.whichCTRLKey = 224;
925+
{% else %}
926+
gparam.whichCTRLKey = 91;
927+
{% endif %}
928+
}
916929
document.addEventListener('keydown', function(e) {
917-
if (e.which === 17 && !multiSelectOverlay) { // ctrl key
930+
if (e.which === gparam.whichCTRLKey && !multiSelectOverlay) { // ctrl key
918931
multiSelectOverlay = gparam.AreaSelecaoRetangular.startMultiSelect(graph, gparam.renderer, gparam.layout);
919932
}
920-
if (e.which != 17 && multiSelectOverlay) { // pressionou outro botão (corrige problema quando se pressiona CTRL+botão para outro comando, que o tipo de cursor não mudava para o padrão
933+
if (e.which != gparam.whichCTRLKey && multiSelectOverlay) { // pressionou outro botão (corrige problema quando se pressiona CTRL+botão para outro comando, que o tipo de cursor não mudava para o padrão
921934
multiSelectOverlay.destroy();
922935
multiSelectOverlay = null;
923936
}
@@ -5364,22 +5377,20 @@
53645377
function evento_teclasDown(e) {
53655378
function testa(keyIn, pressShift, pressCtrl) {
53665379
//não dá para usar alt key, porque isso abre o menu do navegador
5367-
if (keyIn!=e.code) {
5368-
return false;
5369-
} else if (pressShift!=e.shiftKey) {
5370-
return false;
5371-
} else if (pressCtrl!=e.ctrlKey) {
5380+
//if ((keyIn==e.code) && (pressShift==e.shiftKey) && (pressCtrl==e.ctrlKey)) {
5381+
if ((keyIn==e.code) && (pressShift==e.shiftKey) && (pressCtrl==teclaCtrlF(e))) {
5382+
return true;
5383+
} else {
53725384
return false;
5373-
}
5374-
return true;
5375-
}
5385+
}
5386+
} //.function testa
53765387
if ((e.code.startsWith('Digit') && (e.code.length==6)) || (e.code.startsWith('Numpad') && (e.code.length==7) && (e.getModifierState('NumLock')))){
53775388
var ns = e.code.substr(-1);
53785389
var tipo = 'cnpj';
5379-
if (e.shiftKey && !e.ctrlKey) {
5390+
if (e.shiftKey && !teclaCtrlF(e)) {
53805391
tipo = 'links';
53815392
//} else if (!e.shiftKey && e.ctrlKey) {
5382-
} else if (e.ctrlKey) {
5393+
} else if (teclaCtrlF(e)) {
53835394
tipo = 'caminhos';
53845395
}
53855396
if (('0' <= ns) && (ns <='9')) {
@@ -5780,9 +5791,9 @@
57805791
<button class='botaosuperior' type="button" onclick="javascript:menu_rendererAtivarParar(true, true);" title='Ativar Leiaute (Barra de Espaço)'><i class="fa fa-play"></i></button>
57815792
<button class='botaosuperior' type="button" onclick="javascript:menu_rendererAtivarParar(false, true);" title='Parar Leiaute (Barra de Espaço)'><i class="fa fa-stop"></i></button>
57825793
{% endif %}
5783-
<button class='botaosuperior' type="button" onclick="javascript:menu_zoomin(event.shiftKey, event.ctrlKey);" title='Aumenta visualização. A roda do mouse também faz isso. Pressionando SHIFT+click aumenta apenas o tamanho das ligações.'><i class="fa fa-search-plus"></i></button>
5794+
<button class='botaosuperior' type="button" onclick="javascript:menu_zoomin(event.shiftKey, teclaCtrlF(event));" title='Aumenta visualização. A roda do mouse também faz isso. Pressionando SHIFT+click aumenta apenas o tamanho das ligações.'><i class="fa fa-search-plus"></i></button>
57845795
{% if not parametros.mobile %}
5785-
<button class='botaosuperior' type="button" onclick="javascript:menu_zoomout(event.shiftKey, event.ctrlKey);" title='Diminui visualização. A roda do mouse também faz isso. Pressionando SHIFT+click diminui apenas o tamanho das ligações.'><i class="fa fa-search-minus"></i></button>
5796+
<button class='botaosuperior' type="button" onclick="javascript:menu_zoomout(event.shiftKey, teclaCtrlF(event));" title='Diminui visualização. A roda do mouse também faz isso. Pressionando SHIFT+click diminui apenas o tamanho das ligações.'><i class="fa fa-search-minus"></i></button>
57865797
{% endif %}
57875798
<button class='botaosuperior' type="button" onclick="gparam.renderer.reset();" title='Reinicia escala de visualização'><i class="fa fa-compress"></i></button>
57885799

@@ -5792,7 +5803,7 @@
57925803
onfocusin="ativaAtalhos(false)" onfocusout="ativaAtalhos(true);"
57935804
title='Digite {% if parametros.bBaseReceita %} CNPJ, Razão Social, Nome Fantasia, CPF de sócio ou Nome de sócio {% endif %}e pressione Enter. Os nomes podem ter acentuação ou estar com letras minúsculas, pois o texto é convertido em maiúsculas sem acentuação. CNPJS e CPFs podem ter pontos, traços ou barras. Para buscar por Unidade Gestora, coloque UG_NNNNNN, onde NNNNNN é o código da UG. A busca por endereço, por telefone ou por email ainda não foi implementada.'>
57945805
{% endif %}
5795-
<button id='botao_inserir' class='botaosuperior' type="button" onclick="javascript:menu_inserir(null, event.shiftKey, event.ctrlKey);" title='Inserir{% if parametros.bBaseReceita %} CNPJ ou CPF do Banco de Dados {% endif %}(Tecla I)'><i class="fa fa-user-plus"></i></button>
5806+
<button id='botao_inserir' class='botaosuperior' type="button" onclick="javascript:menu_inserir(null, event.shiftKey, teclaCtrlF(event));" title='Inserir{% if parametros.bBaseReceita %} CNPJ ou CPF do Banco de Dados {% endif %}(Tecla I)'><i class="fa fa-user-plus"></i></button>
57965807
<button class='botaosuperior' type="button" onclick="javascript:menu_dados(event.shiftKey);" title='Exibir Dados do Item (D). SHIFT+Click ou SHIFT+D abre os dados de CNPJ em nova aba.'><i class="fa fa-newspaper"></i></button>
57975808

57985809
{% if not parametros.mobile %}

0 commit comments

Comments
 (0)