@thibezer/ui-components-kit 2.24.2 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/botao.cjs +1 -1
- package/dist/botao.js +1 -1
- package/dist/camadas.cjs +1 -1
- package/dist/camadas.js +2 -2
- package/dist/campo-texto.cjs +1 -1
- package/dist/campo-texto.js +1 -1
- package/dist/canvas.cjs +1 -1
- package/dist/canvas.js +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/components/ui-canvas-prancha/index.d.ts +1 -1
- package/dist/components/ui-canvas-prancha/prancha-teclado.d.ts +13 -5
- package/dist/components/ui-canvas-prancha/ui-canvas-prancha-base.d.ts +6 -1
- package/dist/components/ui-canvas-prancha/ui-canvas-prancha.d.ts +2 -2
- package/dist/components/ui-editor-prancha/editor-barra.d.ts +19 -0
- package/dist/components/ui-editor-prancha/editor-modos.d.ts +26 -1
- package/dist/components/ui-editor-prancha/ui-editor-prancha.d.ts +32 -9
- package/dist/core/alvo-digitavel.d.ts +3 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +4 -4
- package/dist/cores.cjs +1 -1
- package/dist/cores.js +3 -3
- package/dist/custom-elements.json +12330 -11963
- package/dist/data.cjs +1 -1
- package/dist/data.js +1 -1
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.js +1 -1
- package/dist/forms.cjs +1 -1
- package/dist/forms.js +11 -11
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/kit-base-BmkPi5Rz.cjs +2 -0
- package/dist/{kit-base-_THn4w3u.js → kit-base-CBXA66aM.js} +119 -114
- package/dist/mapa.cjs +1 -1
- package/dist/mapa.js +1 -1
- package/dist/modal.cjs +1 -1
- package/dist/modal.js +1 -1
- package/dist/prancha.cjs +6 -6
- package/dist/prancha.js +1707 -1470
- package/dist/register.cjs +1 -1
- package/dist/register.js +1 -1
- package/dist/seletor-mapa-base.cjs +1 -1
- package/dist/seletor-mapa-base.js +1 -1
- package/dist/tabela.cjs +1 -1
- package/dist/tabela.js +1 -1
- package/dist/tipos-elementos.d.ts +2 -2
- package/dist/tipos-vue.d.ts +2 -2
- package/dist/tools.cjs +1 -1
- package/dist/tools.js +1 -1
- package/dist/{ui-seletor-cor-B_twSm-V.js → ui-seletor-cor-CPjA9vhZ.js} +1 -1
- package/dist/{ui-seletor-cor-BGw8SBPm.cjs → ui-seletor-cor-D_ifitEN.cjs} +1 -1
- package/package.json +1 -1
- package/dist/kit-base-CGqj9aiD.cjs +0 -2
package/dist/prancha.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (t,
|
|
1
|
+
var Qe = Object.defineProperty;
|
|
2
|
+
var Ye = (t, e, a) => e in t ? Qe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
|
|
3
|
+
var m = (t, e, a) => Ye(t, typeof e != "symbol" ? e + "" : e, a);
|
|
4
4
|
/* empty css */
|
|
5
|
-
import { IndicePrancha as
|
|
6
|
-
import { DIMENSOES_FOLHA as
|
|
7
|
-
import { n as
|
|
8
|
-
import { K as
|
|
9
|
-
import { E as
|
|
10
|
-
import { S as
|
|
11
|
-
const
|
|
12
|
-
function
|
|
5
|
+
import { IndicePrancha as at, Historico as et, normalizarElementos as tt, analisarElemento as rt, compor as Fa, translacao as k, escala as H, mapaDeCamadas as it, normalizarCamadas as ot, expandirGrupos as st, buscarSnapPrancha as se, ESPESSURA_TRACO_PADRAO_MM as nt, COR_PADRAO_PRANCHA as lt, rotacao as za, espelharElementos as ct, ehMatrizFinita as ne, transformarElementos as I, definirRaiosDoRetangulo as ut, normalizarElemento as dt, moverAncoras as le, excluirAncora as ce, centroDaSelecao as ht, criarRetangulo as mt, criarElipse as ft, criarPoligonoRegular as pt, criarEstrela as gt, transformarElemento as ue, criarLinha as vt, ESPACO_PLANO as bt, criarCaminho as _a, paraMm as yt, criarTexto as At, caixaDeCantos as St, reordenar as Pt, agrupar as Mt, desagrupar as zt, alinhar as xt, distribuir as Et, ordenarPorEmpilhamento as U, aplicarAparencia as de, criarMascara as Ct, liberarMascara as Tt, unirCaminhos as wt, dividirComLinha as Dt, deslocarCaminho as It, duplicarElementos as he, simplificarCaminho as Ft, contornoDoTraco as _t, converterEmCaminho as Nt, desenharElementos as $, caixaOrientada as Ot, ancorasDoElemento as xa, alcasDoElemento as me, caixaDaSelecao as Ea, posicoesDasAlcas as fe, contornoNaFolha as Ca, aplicar as Rt, posicaoLocalDaAlca as Lt, ALCAS_ESCALA as kt, raiosEfetivos as pe, profundidadeNoCanto as ge, limitesNaFolha as Y, comRaioDeCanto as qt, moverAlcaDaAncora as Bt, moverAncora as jt, rotacaoPorArrasto as Gt, matrizDeCisalhamentoPorAlca as Ht, matrizDeEscalaPorAlca as $t, guiasInteligentes as Vt, marcasDosCantos as Kt, envelopeNaFolha as Wt, elementoNoTopo as na, trechoMaisProximo as Ut, adicionarAncora as Xt, ancoraMaisProxima as Zt, converterAncora as Jt, elementosNaCaixa as Qt, deMm as Yt, caixaDoQuadro as ve, OPERACOES_BOOLEANAS as ar, aplicarPathfinder as er, ehUnidadePrancha as tr, temMedidorTexto as rr, definirMedidorTexto as ir, saneada as or, ehPredefinicao as sr, gerarPredefinicao as nr, envelopeVisual as Na, exportarSvg as lr, ehPropriedadePrancha as cr, ehPropriedadeDeGeometria as ur, comPropriedade as dr, rotacaoEmGraus as hr, MODOS_MESCLAGEM as mr, valorDaPropriedade as fr, resolverAparencia as pr, ITENS_PREDEFINICOES as Oa } from "./prancha-nucleo.js";
|
|
6
|
+
import { DIMENSOES_FOLHA as So, EPSILON_DETERMINANTE as Po, ESCALA_MINIMA as Mo, ESPESSURA_PADRAO_MM as zo, ESTILOS_TRACO as xo, ESTILO_DO_TIPO_LINHA as Eo, FAIXAS_MAXIMO as Co, FAIXAS_PADRAO as To, FONTE_PADRAO as wo, FORMATOS_ABNT as Do, IDENTIDADE as Io, IDS_PROPRIEDADES_PRANCHA as Fo, KAPPA as _o, LIMITE_PONTA_PADRAO as No, MAX_LINHAS_HACHURA as Oo, MESCLAGEM_CSS as Ro, MM_POR_PX as Lo, MM_POR_UNIDADE as ko, PREDEFINICOES as qo, PRIORIDADE_SNAP_PRANCHA as Bo, ROTULOS_PREDEFINICOES as jo, SOMBRA_PADRAO as Go, TIPO_LINHA_DO_ESTILO as Ho, adaptarContextoRelativo as $o, ajustarAparenciaEmLote as Vo, ajustarElementosACaixa as Ko, aparenciaDe as Wo, aplicarTodos as Uo, aplicarVetor as Xo, areaComSinal as Zo, areaDosPoligonos as Jo, avisarUmaVez as Qo, caixaDoQuadroAbnt as Yo, caixaDoTexto as as, caixaNormalizada as es, caminhoDoContorno as ts, caminhoFinito as rs, caminhoParaSvg as is, cisalhamento as os, comoCaminhoNaFolha as ss, comprimentoDaPonta as ns, contornoElipse as ls, contornoEstrela as cs, contornoLocal as us, contornoLocalEmCache as ds, contornoPoligonoRegular as hs, contornoRetangulo as ms, corComOpacidade as fs, corNaPosicao as ps, decompor as gs, desenharPlano as vs, determinante as bs, diagnosticarContexto as ys, direcaoNaPonta as As, ehFechado as Ss, ehIdentidade as Ps, ehSingular as Ms, elementosNoLaco as zs, elementosNoPonto as xs, emTornoDe as Es, espelhamento as Cs, faixasDoGradienteLinear as Ts, feicaoDoElemento as ws, fonteSegura as Ds, geometriaDaPonta as Is, girarElementos as Fs, iguais as _s, inverter as Ns, limitesLocais as Os, linhasDeHachura as Rs, mapearPontoNaCaixa as Ls, margensAbnt as ks, matriz as qs, matrizDoElemento as Bs, meiaEspessura as js, modoDeTransformacao as Gs, moverElemento as Hs, multiplicar as $s, normalizarAparencia as Vs, normalizarGeometriaElemento as Ks, normalizarGradiente as Ws, normalizarHachura as Us, normalizarParaOrigem as Xs, operacaoBooleana as Zs, padraoTipoLinhaMm as Js, pivoNaFolha as Qs, planejar as Ys, planejarElemento as an, planejarElementos as en, planoDe as tn, pontoNoAnel as rn, raiosCabiveis as on, recompor as sn, redefinirAvisoContexto as nn, regiaoDoElemento as ln, resolverSombra as cn, resumirAparencia as un, temPreenchimento as dn, testarElemento as hn, transformarContorno as mn, varreduraDoArco as fn } from "./prancha-nucleo.js";
|
|
7
|
+
import { n as gr, T as vr } from "./geometria-px-DHMPUsxC.js";
|
|
8
|
+
import { K as be, M as Ra, N as br, O as yr, U as ye, S as Ae, L as Ta, d as Se } from "./kit-base-CBXA66aM.js";
|
|
9
|
+
import { E as gn } from "./feature_caixa-BVc5LenS.js";
|
|
10
|
+
import { S as Ar } from "./feature_desenho-CC8Mp5Gp.js";
|
|
11
|
+
const Sr = ":host{--ui-prancha-mesa: var(--ui-cor-fundo);--ui-prancha-papel: var(--ui-cor-papel);--ui-prancha-borda-papel: var(--ui-cor-borda);--ui-prancha-grade: var(--ui-cor-grade-papel);--ui-prancha-selecao: var(--ui-cor-primaria);--ui-prancha-alca: var(--ui-cor-superficie);--ui-prancha-guia: var(--ui-cor-guia);--ui-prancha-guia-inteligente: var(--ui-cor-guia-inteligente);--ui-prancha-snap: var(--ui-cor-destaque);--ui-prancha-regua: var(--ui-cor-fundo-elevado);--ui-prancha-texto-regua: var(--ui-cor-texto-secundario);--ui-prancha-tamanho-regua: 20px;display:block;position:relative;min-height:240px;min-width:240px;height:100%;background:var(--ui-cor-fundo);color:var(--ui-cor-texto);font-family:var(--ui-fonte-base);outline:none;contain:layout paint}:host([hidden]){display:none}.raiz{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;grid-template-columns:var(--ui-prancha-tamanho-regua) 1fr;grid-template-rows:var(--ui-prancha-tamanho-regua) 1fr}:host([sem-reguas]) .raiz{grid-template-columns:0 1fr;grid-template-rows:0 1fr}:host([sem-reguas]) .regua,:host([sem-reguas]) .canto{display:none}.canto{background:var(--ui-prancha-regua);border-right:1px solid var(--ui-cor-borda);border-bottom:1px solid var(--ui-cor-borda)}.regua{display:block;width:100%;height:100%;background:var(--ui-prancha-regua);cursor:default;touch-action:none}.regua-h{border-bottom:1px solid var(--ui-cor-borda);cursor:s-resize}.regua-v{border-right:1px solid var(--ui-cor-borda);cursor:e-resize}.viewport{position:relative;overflow:hidden;background:var(--ui-prancha-mesa);touch-action:none;cursor:default}.viewport:focus-visible{outline:2px solid var(--ui-cor-primaria);outline-offset:-2px}.viewport[data-cursor=mao]{cursor:grab}.viewport[data-cursor=arrastando]{cursor:grabbing}.viewport[data-cursor=mira]{cursor:crosshair}.viewport[data-cursor=mover]{cursor:move}.viewport[data-cursor=girar]{cursor:alias}.viewport[data-cursor=ancora]{cursor:pointer}.camada{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;display:block;pointer-events:none}.status{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}@media (pointer: coarse){:host{--ui-prancha-tamanho-regua: 24px}}";
|
|
12
|
+
function Pr() {
|
|
13
13
|
return `
|
|
14
|
-
<style>${
|
|
14
|
+
<style>${Sr}</style>
|
|
15
15
|
<div class="raiz" part="base">
|
|
16
16
|
<div class="canto" part="canto-reguas" aria-hidden="true"></div>
|
|
17
17
|
<canvas class="regua regua-h" id="regua-h" part="regua regua-horizontal" aria-hidden="true"></canvas>
|
|
@@ -26,82 +26,82 @@ function ur() {
|
|
|
26
26
|
</div>
|
|
27
27
|
`;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const
|
|
29
|
+
function La(t, e) {
|
|
30
|
+
const a = new Map(t.map((o) => [o.id, o])), r = new Map(e.map((o) => [o.id, o])), i = { adicionados: [], atualizados: [], removidos: [] };
|
|
31
31
|
for (const [o, s] of r) {
|
|
32
|
-
const n =
|
|
32
|
+
const n = a.get(o);
|
|
33
33
|
n ? n !== s && i.atualizados.push(s) : i.adicionados.push(s);
|
|
34
34
|
}
|
|
35
|
-
for (const [o, s] of
|
|
35
|
+
for (const [o, s] of a) r.has(o) || i.removidos.push(s);
|
|
36
36
|
return i;
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
class
|
|
38
|
+
const Aa = (t) => t.adicionados.length + t.atualizados.length + t.removidos.length === 0;
|
|
39
|
+
class Mr {
|
|
40
40
|
constructor() {
|
|
41
41
|
m(this, "lista", []);
|
|
42
42
|
m(this, "porId", /* @__PURE__ */ new Map());
|
|
43
43
|
m(this, "posicoes", /* @__PURE__ */ new Map());
|
|
44
44
|
m(this, "_selecao", []);
|
|
45
|
-
m(this, "indice", new
|
|
46
|
-
m(this, "historico", new
|
|
45
|
+
m(this, "indice", new at());
|
|
46
|
+
m(this, "historico", new et({ limite: 100, janelaRajadaMs: 1e3 }));
|
|
47
47
|
/** Contador de mudanças do documento (carga, edição, desfazer/refazer, renomear): base do `modificado` do componente. */
|
|
48
48
|
m(this, "revisao", 0);
|
|
49
49
|
m(this, "ouvinteMudanca", null);
|
|
50
50
|
}
|
|
51
51
|
/** Registra quem é avisado depois de cada mudança do documento (o componente avalia o `modificado`). */
|
|
52
|
-
ouvirMudancas(
|
|
53
|
-
this.ouvinteMudanca =
|
|
52
|
+
ouvirMudancas(e) {
|
|
53
|
+
this.ouvinteMudanca = e;
|
|
54
54
|
}
|
|
55
55
|
mudou() {
|
|
56
|
-
var
|
|
56
|
+
var e;
|
|
57
57
|
this.revisao++;
|
|
58
58
|
try {
|
|
59
|
-
(
|
|
59
|
+
(e = this.ouvinteMudanca) == null || e.call(this);
|
|
60
60
|
} catch {
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
get elementos() {
|
|
64
64
|
return this.lista;
|
|
65
65
|
}
|
|
66
|
-
obter(
|
|
67
|
-
return this.porId.get(
|
|
66
|
+
obter(e) {
|
|
67
|
+
return this.porId.get(e);
|
|
68
68
|
}
|
|
69
69
|
get selecao() {
|
|
70
70
|
return this._selecao;
|
|
71
71
|
}
|
|
72
72
|
elementosSelecionados() {
|
|
73
|
-
return this._selecao.map((
|
|
73
|
+
return this._selecao.map((e) => this.porId.get(e)).filter((e) => !!e);
|
|
74
74
|
}
|
|
75
75
|
/** Troca tudo (carga de documento): normaliza, recomeça o histórico e limpa a seleção. */
|
|
76
|
-
definir(
|
|
77
|
-
const
|
|
78
|
-
return this.aplicar(
|
|
76
|
+
definir(e) {
|
|
77
|
+
const a = tt(e);
|
|
78
|
+
return this.aplicar(a.elementos), this.indice.definir(a.elementos), this.historico.limpar(), this._selecao = [], this.mudou(), a;
|
|
79
79
|
}
|
|
80
|
-
aplicar(
|
|
81
|
-
this.lista =
|
|
80
|
+
aplicar(e) {
|
|
81
|
+
this.lista = e, this.porId = new Map(e.map((a) => [a.id, a])), this.posicoes = new Map(e.map((a, r) => [a.id, r]));
|
|
82
82
|
}
|
|
83
83
|
/** Os elementos na ordem da lista do documento (o índice espacial devolve em outra ordem). */
|
|
84
|
-
naOrdemDoDocumento(
|
|
85
|
-
return [...
|
|
84
|
+
naOrdemDoDocumento(e) {
|
|
85
|
+
return [...e].sort((a, r) => (this.posicoes.get(a.id) ?? 0) - (this.posicoes.get(r.id) ?? 0));
|
|
86
86
|
}
|
|
87
87
|
/** Mudança central: grava o passo no histórico, atualiza índice e seleção e devolve a diferença. */
|
|
88
|
-
substituir(
|
|
89
|
-
const r = this.lista, i =
|
|
90
|
-
return
|
|
88
|
+
substituir(e, a = {}) {
|
|
89
|
+
const r = this.lista, i = La(r, e);
|
|
90
|
+
return Aa(i) && r.length === e.length && r.every((o, s) => o === e[s]) || (a.registrar !== !1 && this.historico.registrar(r, { chave: a.chave, agora: a.agora }), this.aplicar(e), this.sincronizarIndice(i), this._selecao = this._selecao.filter((o) => this.porId.has(o)), this.mudou()), i;
|
|
91
91
|
}
|
|
92
|
-
sincronizarIndice(
|
|
93
|
-
for (const r of
|
|
94
|
-
const
|
|
95
|
-
|
|
92
|
+
sincronizarIndice(e) {
|
|
93
|
+
for (const r of e.removidos) this.indice.remover(r.id);
|
|
94
|
+
const a = [...e.adicionados, ...e.atualizados];
|
|
95
|
+
a.length > 0 && this.indice.atualizarVarios(a);
|
|
96
96
|
}
|
|
97
97
|
/** Aplica o lote do app (normalizado; ids repetidos e inválidos recusados). */
|
|
98
|
-
aplicarLote(
|
|
99
|
-
const r = { adicionados: [], atualizados: [], removidos: [], recusados: [] }, i = new Map(this.lista.map((d) => [d.id, d])), o = this.lista.map((d) => d.id), s = new Set((Array.isArray(
|
|
98
|
+
aplicarLote(e, a = !0) {
|
|
99
|
+
const r = { adicionados: [], atualizados: [], removidos: [], recusados: [] }, i = new Map(this.lista.map((d) => [d.id, d])), o = this.lista.map((d) => d.id), s = new Set((Array.isArray(e == null ? void 0 : e.remover) ? e.remover : []).filter((d) => typeof d == "string"));
|
|
100
100
|
for (const d of s)
|
|
101
101
|
i.delete(d) && r.removidos.push(d);
|
|
102
102
|
const n = (d, h) => {
|
|
103
103
|
Array.isArray(d) && d.forEach((u, f) => {
|
|
104
|
-
const p =
|
|
104
|
+
const p = rt(u);
|
|
105
105
|
if (typeof p == "string") {
|
|
106
106
|
r.recusados.push({ indice: f, motivo: p });
|
|
107
107
|
return;
|
|
@@ -118,100 +118,100 @@ class dr {
|
|
|
118
118
|
h === "adicionar" && o.push(p.id), i.set(p.id, p), (h === "adicionar" ? r.adicionados : r.atualizados).push(p.id);
|
|
119
119
|
});
|
|
120
120
|
};
|
|
121
|
-
n(
|
|
121
|
+
n(e == null ? void 0 : e.adicionar, "adicionar"), n(e == null ? void 0 : e.atualizar, "atualizar");
|
|
122
122
|
const l = /* @__PURE__ */ new Set(), c = [];
|
|
123
123
|
for (const d of o) {
|
|
124
124
|
const h = i.get(d);
|
|
125
125
|
h && !l.has(d) && (l.add(d), c.push(h));
|
|
126
126
|
}
|
|
127
|
-
return { resultado: r, diferenca: this.substituir(c, { registrar:
|
|
127
|
+
return { resultado: r, diferenca: this.substituir(c, { registrar: a }) };
|
|
128
128
|
}
|
|
129
129
|
desfazer() {
|
|
130
|
-
const
|
|
131
|
-
return
|
|
130
|
+
const e = this.historico.desfazer(this.lista);
|
|
131
|
+
return e ? this.restaurar(e) : null;
|
|
132
132
|
}
|
|
133
133
|
refazer() {
|
|
134
|
-
const
|
|
135
|
-
return
|
|
134
|
+
const e = this.historico.refazer(this.lista);
|
|
135
|
+
return e ? this.restaurar(e) : null;
|
|
136
136
|
}
|
|
137
|
-
restaurar(
|
|
138
|
-
const
|
|
139
|
-
return this.aplicar(
|
|
137
|
+
restaurar(e) {
|
|
138
|
+
const a = La(this.lista, e);
|
|
139
|
+
return this.aplicar(e), this.sincronizarIndice(a), this._selecao = this._selecao.filter((r) => this.porId.has(r)), this.mudou(), a;
|
|
140
140
|
}
|
|
141
141
|
/** Troca o id de um elemento em tudo (lista, índice, seleção e histórico). `false` se não existe ou o novo já existe. */
|
|
142
|
-
renomear(
|
|
143
|
-
if (typeof
|
|
144
|
-
const r = (o) => o.map((s) => s.id ===
|
|
145
|
-
return this.indice.remover(
|
|
142
|
+
renomear(e, a) {
|
|
143
|
+
if (typeof a != "string" || !a.trim() || !this.porId.has(e) || this.porId.has(a)) return !1;
|
|
144
|
+
const r = (o) => o.map((s) => s.id === e ? { ...s, id: a } : s), i = r(this.lista);
|
|
145
|
+
return this.indice.remover(e), this.aplicar(i), this.indice.atualizar(this.porId.get(a)), this.historico.transformar(r), this._selecao = this._selecao.map((o) => o === e ? a : o), this.mudou(), !0;
|
|
146
146
|
}
|
|
147
147
|
/** Muda a seleção; devolve se mudou. Só ids existentes, não bloqueados nem ocultos, sem repetição, na ordem dada. */
|
|
148
|
-
selecionar(
|
|
149
|
-
const r =
|
|
148
|
+
selecionar(e, a = "substituir") {
|
|
149
|
+
const r = e.filter((n, l) => {
|
|
150
150
|
const c = this.porId.get(n);
|
|
151
|
-
return !!c && !c.bloqueado && !c.oculto &&
|
|
151
|
+
return !!c && !c.bloqueado && !c.oculto && e.indexOf(n) === l;
|
|
152
152
|
}), i = this._selecao;
|
|
153
153
|
let o;
|
|
154
|
-
|
|
154
|
+
a === "substituir" ? o = r : a === "adicionar" ? o = [...i, ...r.filter((n) => !i.includes(n))] : a === "remover" ? o = i.filter((n) => !r.includes(n)) : o = [...i.filter((n) => !r.includes(n)), ...r.filter((n) => !i.includes(n))];
|
|
155
155
|
const s = o.length !== i.length || o.some((n, l) => n !== i[l]);
|
|
156
156
|
return s && (this._selecao = o), s;
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
const
|
|
160
|
-
class
|
|
159
|
+
const W = 96 / 25.4, pa = W * 0.02, ga = W * 64, E = (t) => typeof t == "number" && Number.isFinite(t);
|
|
160
|
+
class zr {
|
|
161
161
|
constructor() {
|
|
162
|
-
m(this, "zoom",
|
|
162
|
+
m(this, "zoom", W);
|
|
163
163
|
m(this, "pan", [0, 0]);
|
|
164
164
|
m(this, "largura", 0);
|
|
165
165
|
m(this, "altura", 0);
|
|
166
166
|
m(this, "dpr", 1);
|
|
167
167
|
}
|
|
168
168
|
get zoomPercentual() {
|
|
169
|
-
return this.zoom /
|
|
169
|
+
return this.zoom / W * 100;
|
|
170
170
|
}
|
|
171
171
|
/** Folha (mm) → px CSS da área de desenho. */
|
|
172
172
|
matrizTela() {
|
|
173
|
-
return
|
|
173
|
+
return Fa(H(this.zoom), k(this.pan[0], this.pan[1]));
|
|
174
174
|
}
|
|
175
175
|
/** Folha (mm) → px do dispositivo (com o dpr): a matriz do pintor. */
|
|
176
176
|
matrizDispositivo() {
|
|
177
|
-
return
|
|
177
|
+
return Fa(H(this.zoom), k(this.pan[0], this.pan[1]), H(this.dpr));
|
|
178
178
|
}
|
|
179
|
-
paraFolha(
|
|
180
|
-
return [(
|
|
179
|
+
paraFolha(e, a) {
|
|
180
|
+
return [(e - this.pan[0]) / this.zoom, (a - this.pan[1]) / this.zoom];
|
|
181
181
|
}
|
|
182
|
-
paraTela(
|
|
183
|
-
return [
|
|
182
|
+
paraTela(e) {
|
|
183
|
+
return [e[0] * this.zoom + this.pan[0], e[1] * this.zoom + this.pan[1]];
|
|
184
184
|
}
|
|
185
185
|
/** Muda o tamanho da área de desenho (px CSS) e o dpr; valores inválidos são ignorados. */
|
|
186
|
-
redimensionar(
|
|
187
|
-
|
|
186
|
+
redimensionar(e, a, r = 1) {
|
|
187
|
+
E(e) && e >= 0 && (this.largura = e), E(a) && a >= 0 && (this.altura = a), E(r) && r > 0 && (this.dpr = Math.min(r, 4));
|
|
188
188
|
}
|
|
189
189
|
/** Zoom absoluto mantendo parado o ponto de tela `foco` (padrão: o centro). Devolve se mudou. */
|
|
190
|
-
definirZoom(
|
|
191
|
-
if (!
|
|
192
|
-
const r = Math.min(
|
|
190
|
+
definirZoom(e, a) {
|
|
191
|
+
if (!E(e) || e <= 0) return !1;
|
|
192
|
+
const r = Math.min(ga, Math.max(pa, e));
|
|
193
193
|
if (r === this.zoom) return !1;
|
|
194
|
-
const i =
|
|
194
|
+
const i = a && E(a[0]) && E(a[1]) ? a : [this.largura / 2, this.altura / 2], o = this.paraFolha(i[0], i[1]);
|
|
195
195
|
return this.zoom = r, this.pan = [i[0] - o[0] * r, i[1] - o[1] * r], !0;
|
|
196
196
|
}
|
|
197
|
-
zoomRelativo(
|
|
198
|
-
return
|
|
197
|
+
zoomRelativo(e, a) {
|
|
198
|
+
return E(e) && e > 0 ? this.definirZoom(this.zoom * e, a) : !1;
|
|
199
199
|
}
|
|
200
|
-
deslocar(
|
|
201
|
-
return !
|
|
200
|
+
deslocar(e, a) {
|
|
201
|
+
return !E(e) || !E(a) || e === 0 && a === 0 ? !1 : (this.pan = [this.pan[0] + e, this.pan[1] + a], !0);
|
|
202
202
|
}
|
|
203
203
|
/** Zoom absoluto mantendo o CENTRO da caixa (mm) no centro da área de desenho (usado no teto de zoom do enquadramento). */
|
|
204
|
-
definirZoomCentrado(
|
|
205
|
-
return !
|
|
204
|
+
definirZoomCentrado(e, a) {
|
|
205
|
+
return !E(e) || e <= 0 || !a || ![a.x, a.y, a.largura, a.altura].every(E) ? !1 : (this.zoom = Math.min(ga, Math.max(pa, e)), this.pan = [this.largura / 2 - (a.x + a.largura / 2) * this.zoom, this.altura / 2 - (a.y + a.altura / 2) * this.zoom], !0);
|
|
206
206
|
}
|
|
207
207
|
/** Enquadra a caixa (mm) com `margem` px em volta. Sem tamanho de área de desenho, não faz nada. */
|
|
208
|
-
enquadrar(
|
|
209
|
-
if (!
|
|
210
|
-
const r = Math.max(
|
|
211
|
-
return this.zoom = Math.min(
|
|
208
|
+
enquadrar(e, a = 24) {
|
|
209
|
+
if (!e || ![e.x, e.y, e.largura, e.altura].every(E) || this.largura <= 0 || this.altura <= 0) return !1;
|
|
210
|
+
const r = Math.max(e.largura, 1e-6), i = Math.max(e.altura, 1e-6), o = Math.max(1, this.largura - 2 * a), s = Math.max(1, this.altura - 2 * a);
|
|
211
|
+
return this.zoom = Math.min(ga, Math.max(pa, Math.min(o / r, s / i))), this.pan = [this.largura / 2 - (e.x + r / 2) * this.zoom, this.altura / 2 - (e.y + i / 2) * this.zoom], !0;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function xr() {
|
|
215
215
|
return {
|
|
216
216
|
hoverId: null,
|
|
217
217
|
caixaSelecao: null,
|
|
@@ -228,10 +228,10 @@ function mr() {
|
|
|
228
228
|
copiasEmGesto: []
|
|
229
229
|
};
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function V(t) {
|
|
232
232
|
t.caixaSelecao = null, t.substitutos = /* @__PURE__ */ new Map(), t.previa = null, t.pontosPrevia = [], t.snap = null, t.linhasInteligentes = [], t.guiaArrastada = null, t.rotulo = null, t.copiasEmGesto = [];
|
|
233
233
|
}
|
|
234
|
-
const
|
|
234
|
+
const ka = Object.freeze({
|
|
235
235
|
mesa: "--ui-prancha-mesa",
|
|
236
236
|
papel: "--ui-prancha-papel",
|
|
237
237
|
bordaPapel: "--ui-prancha-borda-papel",
|
|
@@ -243,7 +243,7 @@ const La = Object.freeze({
|
|
|
243
243
|
snap: "--ui-prancha-snap",
|
|
244
244
|
regua: "--ui-prancha-regua",
|
|
245
245
|
textoRegua: "--ui-prancha-texto-regua"
|
|
246
|
-
}),
|
|
246
|
+
}), Sa = Object.freeze({
|
|
247
247
|
mesa: "#0b0b0d",
|
|
248
248
|
papel: "#ffffff",
|
|
249
249
|
bordaPapel: "rgba(255, 255, 255, 0.08)",
|
|
@@ -256,23 +256,23 @@ const La = Object.freeze({
|
|
|
256
256
|
regua: "#1a1a1e",
|
|
257
257
|
textoRegua: "#9696a6"
|
|
258
258
|
});
|
|
259
|
-
function
|
|
259
|
+
function Er(t) {
|
|
260
260
|
var r;
|
|
261
|
-
const
|
|
262
|
-
if (!t || typeof getComputedStyle != "function") return
|
|
263
|
-
let
|
|
261
|
+
const e = { ...Sa };
|
|
262
|
+
if (!t || typeof getComputedStyle != "function") return e;
|
|
263
|
+
let a = null;
|
|
264
264
|
try {
|
|
265
|
-
|
|
265
|
+
a = getComputedStyle(t);
|
|
266
266
|
} catch {
|
|
267
|
-
return
|
|
267
|
+
return e;
|
|
268
268
|
}
|
|
269
|
-
for (const i of Object.keys(
|
|
270
|
-
const o = (r =
|
|
271
|
-
o && (
|
|
269
|
+
for (const i of Object.keys(ka)) {
|
|
270
|
+
const o = (r = a.getPropertyValue(ka[i])) == null ? void 0 : r.trim();
|
|
271
|
+
o && (e[i] = gr(o, Sa[i]));
|
|
272
272
|
}
|
|
273
|
-
return
|
|
273
|
+
return e;
|
|
274
274
|
}
|
|
275
|
-
const
|
|
275
|
+
const Cr = {
|
|
276
276
|
selecao: "Seleção",
|
|
277
277
|
"selecao-direta": "Seleção direta",
|
|
278
278
|
mao: "Mão",
|
|
@@ -287,24 +287,24 @@ const pr = {
|
|
|
287
287
|
caneta: "Caneta",
|
|
288
288
|
texto: "Texto"
|
|
289
289
|
};
|
|
290
|
-
function
|
|
290
|
+
function Tr(t) {
|
|
291
291
|
return t <= 0 ? "Nenhum elemento selecionado" : t === 1 ? "1 elemento selecionado" : `${t} elementos selecionados`;
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
return `Ferramenta ${
|
|
293
|
+
function wr(t) {
|
|
294
|
+
return `Ferramenta ${Cr[t] ?? t}`;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function la(t) {
|
|
297
297
|
return `Zoom ${Math.round(t)}%`;
|
|
298
298
|
}
|
|
299
|
-
function
|
|
300
|
-
t && t.textContent !==
|
|
299
|
+
function Dr(t, e) {
|
|
300
|
+
t && t.textContent !== e && (t.textContent = e);
|
|
301
301
|
}
|
|
302
|
-
class
|
|
303
|
-
constructor(
|
|
304
|
-
m(this, "doc", new
|
|
305
|
-
m(this, "vista", new
|
|
306
|
-
m(this, "ui",
|
|
307
|
-
m(this, "cores", { ...
|
|
302
|
+
class Ir {
|
|
303
|
+
constructor(e) {
|
|
304
|
+
m(this, "doc", new Mr());
|
|
305
|
+
m(this, "vista", new zr());
|
|
306
|
+
m(this, "ui", xr());
|
|
307
|
+
m(this, "cores", { ...Sa });
|
|
308
308
|
m(this, "guias", []);
|
|
309
309
|
m(this, "ferramenta", "selecao");
|
|
310
310
|
m(this, "opcoesFerramentas", {});
|
|
@@ -330,46 +330,46 @@ class yr {
|
|
|
330
330
|
m(this, "cacheMapa", null);
|
|
331
331
|
/** Elementos para a base: os do documento com os substitutos do gesto em andamento no lugar. */
|
|
332
332
|
m(this, "cacheBase", null);
|
|
333
|
-
this.dep =
|
|
333
|
+
this.dep = e, this.gerarId = (a) => `${a}-${Date.now().toString(36)}-${(++this.sequencia).toString(36)}`;
|
|
334
334
|
}
|
|
335
|
-
emitir(
|
|
336
|
-
return this.dep.emitir(
|
|
335
|
+
emitir(e, a, r = !1) {
|
|
336
|
+
return this.dep.emitir(e, a, r);
|
|
337
337
|
}
|
|
338
338
|
agendar() {
|
|
339
339
|
this.dep.agendar();
|
|
340
340
|
}
|
|
341
|
-
anunciar(
|
|
342
|
-
this.dep.anunciar(
|
|
341
|
+
anunciar(e) {
|
|
342
|
+
this.dep.anunciar(e);
|
|
343
343
|
}
|
|
344
|
-
recusar(
|
|
345
|
-
this.emitir("prancha-recusa", r === void 0 ? { acao:
|
|
344
|
+
recusar(e, a, r) {
|
|
345
|
+
this.emitir("prancha-recusa", r === void 0 ? { acao: e, motivo: a } : { acao: e, motivo: a, id: r });
|
|
346
346
|
}
|
|
347
347
|
/** Regras das camadas atuais (em cache pela lista). */
|
|
348
348
|
mapa() {
|
|
349
|
-
return (!this.cacheMapa || this.cacheMapa.camadas !== this.camadas) && (this.cacheMapa = { camadas: this.camadas, mapa:
|
|
349
|
+
return (!this.cacheMapa || this.cacheMapa.camadas !== this.camadas) && (this.cacheMapa = { camadas: this.camadas, mapa: it(this.camadas) }), this.cacheMapa.mapa;
|
|
350
350
|
}
|
|
351
351
|
/** Pode ser selecionado agora: visível, destravado (ele e a camada), não é máscara e está no grupo isolado, se houver. */
|
|
352
|
-
podeSelecionar(
|
|
353
|
-
const
|
|
354
|
-
return !!
|
|
352
|
+
podeSelecionar(e) {
|
|
353
|
+
const a = this.mapa();
|
|
354
|
+
return !!e && !e.mascara && a.visivel(e) && !a.travado(e) && (this.isolado === null || e.grupoId === this.isolado);
|
|
355
355
|
}
|
|
356
356
|
/** Elementos perto do ponto (pelo índice), visíveis, na ordem do documento (para o desempate do empilhamento). */
|
|
357
|
-
candidatosEm(
|
|
357
|
+
candidatosEm(e, a) {
|
|
358
358
|
const r = this.mapa();
|
|
359
|
-
return this.doc.naOrdemDoDocumento(this.doc.indice.consultarPonto(
|
|
359
|
+
return this.doc.naOrdemDoDocumento(this.doc.indice.consultarPonto(e, a).filter((i) => r.visivel(i)));
|
|
360
360
|
}
|
|
361
|
-
definirCamadas(
|
|
362
|
-
this.camadas =
|
|
361
|
+
definirCamadas(e) {
|
|
362
|
+
this.camadas = ot(e), this.camadaAtiva && !this.camadas.some((a) => a.id === this.camadaAtiva) && (this.camadaAtiva = null), this.emitir("prancha-camadas", { camadas: this.camadas.map((a) => ({ ...a })) }), this.podarSelecao(), this.agendar();
|
|
363
363
|
}
|
|
364
364
|
/** Isola um grupo (só os membros se selecionam; o resto fica esmaecido) ou sai do isolamento (`null`). */
|
|
365
|
-
isolar(
|
|
366
|
-
const
|
|
367
|
-
|
|
365
|
+
isolar(e) {
|
|
366
|
+
const a = typeof e == "string" && this.doc.elementos.some((r) => r.grupoId === e) ? e : null;
|
|
367
|
+
a !== this.isolado && (this.isolado = a, this.emitir("prancha-isolamento", { grupoId: a }), this.anunciar(a ? "Grupo isolado" : "Saiu do grupo"), this.podarSelecao(), this.agendar());
|
|
368
368
|
}
|
|
369
369
|
/** Tira da seleção o que deixou de ser selecionável (camada oculta ou bloqueada, fora do grupo isolado). */
|
|
370
370
|
podarSelecao() {
|
|
371
|
-
const
|
|
372
|
-
|
|
371
|
+
const e = this.doc.selecao.filter((a) => this.podeSelecionar(this.doc.obter(a)));
|
|
372
|
+
e.length !== this.doc.selecao.length && this.selecionar(e, "substituir", !1);
|
|
373
373
|
}
|
|
374
374
|
/**
|
|
375
375
|
* Elementos da BASE: os do documento, sem os que estão num gesto (arrasto, alça, âncora). A lista fica a mesma durante o
|
|
@@ -377,252 +377,252 @@ class yr {
|
|
|
377
377
|
* (`elementosEmGesto`), por cima, como a prévia de arrasto dos editores vetoriais.
|
|
378
378
|
*/
|
|
379
379
|
elementosVisiveis() {
|
|
380
|
-
const
|
|
381
|
-
if (
|
|
382
|
-
const
|
|
383
|
-
if (r && r.elementos === this.doc.elementos && r.ids ===
|
|
384
|
-
const i = this.doc.elementos.filter((o) => !
|
|
385
|
-
return this.cacheBase = { elementos: this.doc.elementos, ids:
|
|
380
|
+
const e = this.ui.substitutos;
|
|
381
|
+
if (e.size === 0) return this.doc.elementos;
|
|
382
|
+
const a = [...e.keys()].join("\0"), r = this.cacheBase;
|
|
383
|
+
if (r && r.elementos === this.doc.elementos && r.ids === a) return r.base;
|
|
384
|
+
const i = this.doc.elementos.filter((o) => !e.has(o.id));
|
|
385
|
+
return this.cacheBase = { elementos: this.doc.elementos, ids: a, base: i }, i;
|
|
386
386
|
}
|
|
387
387
|
/** Elementos transformados pelo gesto em andamento, na ordem de empilhamento. */
|
|
388
388
|
elementosEmGesto() {
|
|
389
|
-
const
|
|
390
|
-
return this.ui.copiasEmGesto.length > 0 ? [...
|
|
389
|
+
const e = this.ui.substitutos, a = e.size === 0 ? [] : this.doc.elementos.filter((r) => e.has(r.id)).map((r) => e.get(r.id));
|
|
390
|
+
return this.ui.copiasEmGesto.length > 0 ? [...a, ...this.ui.copiasEmGesto] : a;
|
|
391
391
|
}
|
|
392
392
|
/** Emite os eventos da diferença (criados, atualizados, removidos) com o motivo. */
|
|
393
|
-
emitirDiferenca(
|
|
394
|
-
|
|
393
|
+
emitirDiferenca(e, a) {
|
|
394
|
+
e.adicionados.length > 0 && this.emitir("prancha-elemento-criado", { elementos: e.adicionados, motivo: a }), e.atualizados.length > 0 && this.emitir("prancha-elemento-atualizado", { elementos: e.atualizados, motivo: a }), e.removidos.length > 0 && this.emitir("prancha-elemento-removido", { ids: e.removidos.map((r) => r.id), elementos: e.removidos, motivo: a });
|
|
395
395
|
}
|
|
396
396
|
emitirHistorico() {
|
|
397
397
|
this.emitir("prancha-historico", { podeDesfazer: this.doc.historico.podeDesfazer, podeRefazer: this.doc.historico.podeRefazer });
|
|
398
398
|
}
|
|
399
399
|
/** Mudança do usuário: histórico + eventos + repintura. `chave` junta rajadas (setas, scrubber) num passo. */
|
|
400
|
-
aplicar(
|
|
401
|
-
const i = this.doc.selecao.join("\0"), o = this.doc.elementos.map((l) => l.id).join("\0"), s = this.doc.substituir(
|
|
402
|
-
return this.doc.elementos.map((l) => l.id).join("\0") !== o && s.adicionados.length === 0 && s.removidos.length === 0 && (this.emitir("prancha-ordem", { ids: this.doc.elementos.map((l) => l.id), motivo:
|
|
400
|
+
aplicar(e, a, r) {
|
|
401
|
+
const i = this.doc.selecao.join("\0"), o = this.doc.elementos.map((l) => l.id).join("\0"), s = this.doc.substituir(e, { chave: r });
|
|
402
|
+
return this.doc.elementos.map((l) => l.id).join("\0") !== o && s.adicionados.length === 0 && s.removidos.length === 0 && (this.emitir("prancha-ordem", { ids: this.doc.elementos.map((l) => l.id), motivo: a }), Aa(s) && this.emitirHistorico()), Aa(s) || (this.emitirDiferenca(s, a), this.emitirHistorico(), this.ui.edicao && !this.doc.obter(this.ui.edicao.id) && (this.ui.edicao = null), this.doc.selecao.join("\0") !== i && this.emitirSelecao()), this.agendar(), s;
|
|
403
403
|
}
|
|
404
404
|
/** Substitui elementos pelo id (os demais ficam como estão). */
|
|
405
|
-
aplicarSubstituicoes(
|
|
406
|
-
const i = new Map(
|
|
407
|
-
return this.aplicar(this.doc.elementos.map((o) => i.get(o.id) ?? o),
|
|
405
|
+
aplicarSubstituicoes(e, a, r) {
|
|
406
|
+
const i = new Map(e.map((o) => [o.id, o]));
|
|
407
|
+
return this.aplicar(this.doc.elementos.map((o) => i.get(o.id) ?? o), a, r);
|
|
408
408
|
}
|
|
409
409
|
emitirSelecao() {
|
|
410
|
-
const
|
|
411
|
-
this.emitir("prancha-selecao", { ids:
|
|
410
|
+
const e = this.doc.elementosSelecionados();
|
|
411
|
+
this.emitir("prancha-selecao", { ids: e.map((a) => a.id), elementos: e }), this.anunciar(Tr(e.length));
|
|
412
412
|
}
|
|
413
413
|
/**
|
|
414
414
|
* Muda a seleção. Fora do isolamento, um membro de grupo seleciona o grupo inteiro (`expandir`). Só entra o que pode ser
|
|
415
415
|
* selecionado (camadas, máscara, isolamento).
|
|
416
416
|
*/
|
|
417
|
-
selecionar(
|
|
418
|
-
const i = Array.isArray(
|
|
419
|
-
return this.doc.selecionar(o,
|
|
417
|
+
selecionar(e, a = "substituir", r = !0) {
|
|
418
|
+
const i = Array.isArray(e) ? e.filter((n) => typeof n == "string") : [], o = (r && this.isolado === null ? st(this.doc.elementos, i) : i).filter((n) => a === "remover" || this.podeSelecionar(this.doc.obter(n)));
|
|
419
|
+
return this.doc.selecionar(o, a) ? (this.ui.pivo = null, this.ui.edicao && !this.doc.selecao.includes(this.ui.edicao.id) && this.encerrarEdicao(), this.emitirSelecao(), this.agendar(), !0) : !1;
|
|
420
420
|
}
|
|
421
|
-
definirFerramenta(
|
|
422
|
-
|
|
421
|
+
definirFerramenta(e) {
|
|
422
|
+
e !== this.ferramenta && (V(this.ui), e !== "selecao-direta" && this.ui.edicao && this.encerrarEdicao(), this.ferramenta = e, this.emitir("prancha-ferramenta", { ferramenta: e }), this.anunciar(wr(e)), this.agendar());
|
|
423
423
|
}
|
|
424
|
-
iniciarEdicao(
|
|
424
|
+
iniciarEdicao(e) {
|
|
425
425
|
var r;
|
|
426
|
-
const
|
|
427
|
-
return
|
|
426
|
+
const a = this.doc.obter(e);
|
|
427
|
+
return a ? a.bloqueado ? (this.recusar("editar-ancoras", "bloqueado", e), !1) : a.geometria.tipo === "texto" ? (this.recusar("editar-ancoras", "texto-sem-ancoras", e), !1) : (((r = this.ui.edicao) == null ? void 0 : r.id) === e || (this.ui.edicao && this.encerrarEdicao(), this.ui.edicao = { id: e, ancoras: [] }, this.doc.selecionar([e]), this.emitirSelecao(), this.emitir("prancha-edicao-iniciada", { elemento: a }), this.agendar()), !0) : !1;
|
|
428
428
|
}
|
|
429
429
|
encerrarEdicao() {
|
|
430
|
-
const
|
|
431
|
-
if (!
|
|
430
|
+
const e = this.ui.edicao;
|
|
431
|
+
if (!e) return;
|
|
432
432
|
this.ui.edicao = null;
|
|
433
|
-
const
|
|
434
|
-
|
|
433
|
+
const a = this.doc.obter(e.id);
|
|
434
|
+
a && this.emitir("prancha-edicao-concluida", { elemento: a }), this.agendar();
|
|
435
435
|
}
|
|
436
436
|
desfazer() {
|
|
437
|
-
const
|
|
438
|
-
return
|
|
437
|
+
const e = this.doc.desfazer();
|
|
438
|
+
return e ? (this.posHistorico(e, "desfazer"), !0) : (this.recusar("desfazer", "nada-a-desfazer"), !1);
|
|
439
439
|
}
|
|
440
440
|
refazer() {
|
|
441
|
-
const
|
|
442
|
-
return
|
|
441
|
+
const e = this.doc.refazer();
|
|
442
|
+
return e ? (this.posHistorico(e, "refazer"), !0) : (this.recusar("refazer", "nada-a-refazer"), !1);
|
|
443
443
|
}
|
|
444
|
-
posHistorico(
|
|
445
|
-
|
|
444
|
+
posHistorico(e, a) {
|
|
445
|
+
V(this.ui), this.ui.edicao && !this.doc.obter(this.ui.edicao.id) && (this.ui.edicao = null), this.emitirDiferenca(e, a), this.emitirHistorico(), this.anunciar(a === "desfazer" ? "Desfeito" : "Refeito"), this.agendar();
|
|
446
446
|
}
|
|
447
447
|
/** Tolerância de snap em px (toque precisa de mais). */
|
|
448
|
-
toleranciaPx(
|
|
449
|
-
return
|
|
448
|
+
toleranciaPx(e = !1) {
|
|
449
|
+
return e ? 16 : 8;
|
|
450
450
|
}
|
|
451
451
|
/**
|
|
452
452
|
* Snap do ponto (mm) aos elementos perto (pelo índice), às guias e (opcional) à grade. Grava o resultado no estado
|
|
453
453
|
* (para a sobreposição marcar). Snap desligado ou Alt: devolve o próprio ponto.
|
|
454
454
|
*/
|
|
455
|
-
snapPonto(
|
|
456
|
-
if (!this.snapLigado ||
|
|
457
|
-
return this.ui.snap = null, { ponto:
|
|
458
|
-
const r = this.toleranciaPx(
|
|
455
|
+
snapPonto(e, a = {}) {
|
|
456
|
+
if (!this.snapLigado || a.desligado)
|
|
457
|
+
return this.ui.snap = null, { ponto: e, resultado: null };
|
|
458
|
+
const r = this.toleranciaPx(a.toque), i = r / this.vista.zoom + 1, o = this.candidatosEm(e, i).filter((n) => !n.mascara), s = se(e, o, this.vista.zoom, {
|
|
459
459
|
toleranciaPx: r,
|
|
460
460
|
guias: this.guias,
|
|
461
|
-
grade:
|
|
462
|
-
},
|
|
463
|
-
return this.ui.snap = s, { ponto: s ? s.coordenada :
|
|
461
|
+
grade: a.grade !== !1 && this.mostrarGrade ? { espacamento: this.grade } : null
|
|
462
|
+
}, a.excluir ?? []);
|
|
463
|
+
return this.ui.snap = s, { ponto: s ? s.coordenada : e, resultado: s };
|
|
464
464
|
}
|
|
465
465
|
/** Emite a vista (zoom/pan) e repinta. */
|
|
466
466
|
emitirVista() {
|
|
467
|
-
const
|
|
468
|
-
this.emitir("prancha-vista", { zoom:
|
|
467
|
+
const e = this.vista;
|
|
468
|
+
this.emitir("prancha-vista", { zoom: e.zoom, zoomPercentual: e.zoomPercentual, pan: [e.pan[0], e.pan[1]] }), this.agendar();
|
|
469
469
|
}
|
|
470
470
|
emitirGuias() {
|
|
471
|
-
this.emitir("prancha-guias", { guias: this.guias.map((
|
|
471
|
+
this.emitir("prancha-guias", { guias: this.guias.map((e) => ({ ...e })) }), this.agendar();
|
|
472
472
|
}
|
|
473
473
|
/** Aparência dos elementos novos (cópia; padrão traço preto 0,25 mm sem preenchimento). */
|
|
474
474
|
aparenciaNova() {
|
|
475
|
-
const
|
|
476
|
-
return
|
|
475
|
+
const e = this.opcoesFerramentas.aparencia;
|
|
476
|
+
return e ? JSON.parse(JSON.stringify(e)) : { traco: { cor: lt, espessura: nt }, preenchimento: null };
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
const
|
|
480
|
-
function
|
|
479
|
+
const Q = (t) => typeof t == "number" && Number.isFinite(t);
|
|
480
|
+
function ha(t, e) {
|
|
481
481
|
if (t.somenteLeitura)
|
|
482
|
-
return t.recusar(
|
|
483
|
-
const
|
|
484
|
-
return
|
|
485
|
-
}
|
|
486
|
-
function
|
|
487
|
-
if (!
|
|
488
|
-
const i =
|
|
489
|
-
return i ? (t.aplicarSubstituicoes(
|
|
490
|
-
}
|
|
491
|
-
const
|
|
492
|
-
function
|
|
493
|
-
return t.ui.pivo ??
|
|
494
|
-
}
|
|
495
|
-
function
|
|
496
|
-
const i =
|
|
497
|
-
return
|
|
498
|
-
}
|
|
499
|
-
function
|
|
500
|
-
const o = r ??
|
|
501
|
-
return !
|
|
502
|
-
}
|
|
503
|
-
function
|
|
504
|
-
if (
|
|
505
|
-
const r =
|
|
506
|
-
return r ? (t.aplicarSubstituicoes(
|
|
507
|
-
}
|
|
508
|
-
function
|
|
509
|
-
const
|
|
510
|
-
if (!
|
|
511
|
-
const r = new Set(
|
|
512
|
-
return t.aplicar(t.doc.elementos.filter((i) => !r.has(i.id)),
|
|
482
|
+
return t.recusar(e, "somente-leitura"), null;
|
|
483
|
+
const a = t.doc.elementosSelecionados().filter((r) => !r.bloqueado);
|
|
484
|
+
return a.length === 0 ? (t.recusar(e, "sem-selecao"), null) : a;
|
|
485
|
+
}
|
|
486
|
+
function aa(t, e, a = "comando", r) {
|
|
487
|
+
if (!ne(e)) return !1;
|
|
488
|
+
const i = ha(t, "transformar");
|
|
489
|
+
return i ? (t.aplicarSubstituicoes(I(i, e), a, r), !0) : !1;
|
|
490
|
+
}
|
|
491
|
+
const Pe = (t, e, a, r = "comando", i) => Q(e) && Q(a) && aa(t, k(e, a), r, i);
|
|
492
|
+
function ma(t) {
|
|
493
|
+
return t.ui.pivo ?? ht(t.doc.elementosSelecionados());
|
|
494
|
+
}
|
|
495
|
+
function Me(t, e, a, r = "comando") {
|
|
496
|
+
const i = a ?? ma(t);
|
|
497
|
+
return Q(e) && !!i && aa(t, za(e * Math.PI / 180, i), r);
|
|
498
|
+
}
|
|
499
|
+
function Pa(t, e, a = e, r, i = "comando") {
|
|
500
|
+
const o = r ?? ma(t);
|
|
501
|
+
return !Q(e) || !Q(a) || e === 0 || a === 0 || !o ? !1 : aa(t, H(e, a, o), i);
|
|
502
|
+
}
|
|
503
|
+
function Fr(t, e, a = "comando") {
|
|
504
|
+
if (e !== "horizontal" && e !== "vertical") return !1;
|
|
505
|
+
const r = ha(t, "espelhar");
|
|
506
|
+
return r ? (t.aplicarSubstituicoes(ct(r, e, ma(t) ?? void 0), a), !0) : !1;
|
|
507
|
+
}
|
|
508
|
+
function ze(t, e = "remover") {
|
|
509
|
+
const a = ha(t, "remover");
|
|
510
|
+
if (!a) return !1;
|
|
511
|
+
const r = new Set(a.map((i) => i.id));
|
|
512
|
+
return t.aplicar(t.doc.elementos.filter((i) => !r.has(i.id)), e), !0;
|
|
513
513
|
}
|
|
514
|
-
function
|
|
515
|
-
return t.selecionar(t.doc.elementos.filter((
|
|
514
|
+
function xe(t) {
|
|
515
|
+
return t.selecionar(t.doc.elementos.filter((e) => !e.bloqueado && !e.oculto).map((e) => e.id));
|
|
516
516
|
}
|
|
517
|
-
function
|
|
518
|
-
const
|
|
519
|
-
if (
|
|
520
|
-
const r = t.doc.selecao[t.doc.selecao.length - 1], i =
|
|
517
|
+
function _r(t, e) {
|
|
518
|
+
const a = t.doc.elementos.filter((s) => !s.bloqueado && !s.oculto);
|
|
519
|
+
if (a.length === 0) return !1;
|
|
520
|
+
const r = t.doc.selecao[t.doc.selecao.length - 1], i = a.findIndex((s) => s.id === r), o = a[i < 0 ? e > 0 ? 0 : a.length - 1 : (i + e + a.length) % a.length];
|
|
521
521
|
return t.selecionar([o.id]);
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function F(t, e, a) {
|
|
524
524
|
var i;
|
|
525
525
|
if (t.somenteLeitura)
|
|
526
526
|
return t.recusar("criar", "somente-leitura"), [];
|
|
527
527
|
const r = [];
|
|
528
|
-
for (const o of
|
|
529
|
-
const s = ((i = o == null ? void 0 : o.geometria) == null ? void 0 : i.tipo) ?? "elemento", n = o != null && o.id && !t.doc.obter(o.id) && !r.some((d) => d.id === o.id) ? o.id : t.gerarId(s), l = !(o != null && o.camadaId) && t.camadaAtiva ? { camadaId: t.camadaAtiva } : {}, c =
|
|
528
|
+
for (const o of e) {
|
|
529
|
+
const s = ((i = o == null ? void 0 : o.geometria) == null ? void 0 : i.tipo) ?? "elemento", n = o != null && o.id && !t.doc.obter(o.id) && !r.some((d) => d.id === o.id) ? o.id : t.gerarId(s), l = !(o != null && o.camadaId) && t.camadaAtiva ? { camadaId: t.camadaAtiva } : {}, c = dt({ ...o, id: n, ...l });
|
|
530
530
|
c ? r.push(c) : t.recusar("criar", "geometria-invalida");
|
|
531
531
|
}
|
|
532
|
-
return r.length === 0 ? [] : (t.aplicar([...t.doc.elementos, ...r],
|
|
532
|
+
return r.length === 0 ? [] : (t.aplicar([...t.doc.elementos, ...r], a), t.selecionar(r.map((o) => o.id)), t.anunciar(r.length === 1 ? "Elemento criado" : `${r.length} elementos criados`), r);
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function Nr(t, e, a, r) {
|
|
535
535
|
const i = t.ui.edicao, o = i ? t.doc.obter(i.id) : void 0;
|
|
536
536
|
if (!i || !o || i.ancoras.length === 0) return !1;
|
|
537
|
-
const s =
|
|
537
|
+
const s = le(o, i.ancoras, e, a);
|
|
538
538
|
return s ? (t.aplicarSubstituicoes([s], "editar-ancoras", r), !0) : (t.recusar("editar-ancoras", "matriz-singular", o.id), !1);
|
|
539
539
|
}
|
|
540
|
-
function
|
|
541
|
-
const
|
|
542
|
-
let
|
|
543
|
-
if (!
|
|
540
|
+
function Or(t) {
|
|
541
|
+
const e = t.ui.edicao;
|
|
542
|
+
let a = e ? t.doc.obter(e.id) : void 0;
|
|
543
|
+
if (!e || !a || e.ancoras.length === 0) return !1;
|
|
544
544
|
let r = !1;
|
|
545
|
-
for (const i of [...
|
|
546
|
-
const o =
|
|
545
|
+
for (const i of [...e.ancoras].sort((o, s) => s - o)) {
|
|
546
|
+
const o = ce(a, i);
|
|
547
547
|
if (!o) {
|
|
548
|
-
t.recusar("excluir-ancora", "minimo-de-ancoras",
|
|
548
|
+
t.recusar("excluir-ancora", "minimo-de-ancoras", a.id);
|
|
549
549
|
break;
|
|
550
550
|
}
|
|
551
|
-
|
|
551
|
+
a = o, r = !0;
|
|
552
552
|
}
|
|
553
|
-
return r ? (
|
|
553
|
+
return r ? (e.ancoras = [], t.aplicarSubstituicoes([a], "editar-ancoras"), !0) : !1;
|
|
554
554
|
}
|
|
555
|
-
function
|
|
556
|
-
const
|
|
557
|
-
if (!
|
|
558
|
-
const r =
|
|
555
|
+
function Ee(t, e) {
|
|
556
|
+
const a = ha(t, "definir-raios");
|
|
557
|
+
if (!a) return !1;
|
|
558
|
+
const r = a.map((i) => ut(i, e)).filter((i) => !!i);
|
|
559
559
|
return r.length === 0 ? (t.recusar("definir-raios", "tipo-nao-suportado"), !1) : (t.aplicarSubstituicoes(r, "cantos"), !0);
|
|
560
560
|
}
|
|
561
|
-
const
|
|
562
|
-
function
|
|
563
|
-
let i =
|
|
564
|
-
if (
|
|
561
|
+
const oa = ["retangulo", "elipse", "poligono-regular", "estrela", "linha", "seta"], Ce = { polilinha: "linha", poligono: "poligono", caneta: "caneta" }, Rr = "__previa__", Lr = 3, kr = 8, qr = 400, Br = 4, ca = (t) => oa.includes(t) || t in Ce || t === "texto";
|
|
562
|
+
function qa(t, e, a, r) {
|
|
563
|
+
let i = e[0] - t[0], o = e[1] - t[1];
|
|
564
|
+
if (a) {
|
|
565
565
|
const s = Math.max(Math.abs(i), Math.abs(o));
|
|
566
566
|
i = (i < 0 ? -1 : 1) * s, o = (o < 0 ? -1 : 1) * s;
|
|
567
567
|
}
|
|
568
|
-
return r ? { x: t[0] - Math.abs(i), y: t[1] - Math.abs(o), largura: 2 * Math.abs(i), altura: 2 * Math.abs(o) } :
|
|
568
|
+
return r ? { x: t[0] - Math.abs(i), y: t[1] - Math.abs(o), largura: 2 * Math.abs(i), altura: 2 * Math.abs(o) } : St(t, [t[0] + i, t[1] + o]);
|
|
569
569
|
}
|
|
570
|
-
function
|
|
571
|
-
const
|
|
570
|
+
function jr(t, e) {
|
|
571
|
+
const a = e[0] - t[0], r = e[1] - t[1], i = Math.hypot(a, r), o = Math.round(Math.atan2(r, a) / (Math.PI / 4)) * (Math.PI / 4);
|
|
572
572
|
return [t[0] + i * Math.cos(o), t[1] + i * Math.sin(o)];
|
|
573
573
|
}
|
|
574
|
-
class
|
|
575
|
-
constructor(
|
|
574
|
+
class Gr {
|
|
575
|
+
constructor(e) {
|
|
576
576
|
m(this, "arrasto", null);
|
|
577
577
|
m(this, "sessao", null);
|
|
578
578
|
m(this, "puxandoAlca", !1);
|
|
579
579
|
m(this, "ultimoClique", null);
|
|
580
|
-
this.c =
|
|
580
|
+
this.c = e;
|
|
581
581
|
}
|
|
582
582
|
get emAndamento() {
|
|
583
583
|
return !!this.arrasto || !!this.sessao && this.sessao.nos > 0;
|
|
584
584
|
}
|
|
585
|
-
base(
|
|
586
|
-
return { id:
|
|
585
|
+
base(e = {}) {
|
|
586
|
+
return { id: Rr, aparencia: this.c.aparenciaNova(), ...e };
|
|
587
587
|
}
|
|
588
588
|
/** Elemento da forma de arrasto entre `inicio` e `atual` (null se degenerado). */
|
|
589
|
-
construir(
|
|
589
|
+
construir(e, a, r, i) {
|
|
590
590
|
const o = this.c.opcoesFerramentas;
|
|
591
|
-
if (
|
|
592
|
-
const s =
|
|
593
|
-
return
|
|
591
|
+
if (e === "retangulo" || e === "elipse") {
|
|
592
|
+
const s = qa(a, r, i.shift, i.alt);
|
|
593
|
+
return e === "retangulo" ? mt(this.base(), s, o.raioCantos) : ft(this.base(), s);
|
|
594
594
|
}
|
|
595
|
-
if (
|
|
596
|
-
const s = Math.hypot(r[0] -
|
|
595
|
+
if (e === "poligono-regular" || e === "estrela") {
|
|
596
|
+
const s = Math.hypot(r[0] - a[0], r[1] - a[1]), n = e === "poligono-regular" ? pt(this.base(), a, s, o.lados ?? 6) : gt(this.base(), a, s, s * (o.proporcaoInterna ?? 0.45), o.pontas ?? 5);
|
|
597
597
|
if (!n || i.shift) return n;
|
|
598
|
-
const l = Math.atan2(r[1] -
|
|
599
|
-
return
|
|
598
|
+
const l = Math.atan2(r[1] - a[1], r[0] - a[0]) + Math.PI / 2;
|
|
599
|
+
return ue(n, za(l, a));
|
|
600
600
|
}
|
|
601
|
-
if (
|
|
602
|
-
const s = i.shift ?
|
|
603
|
-
return
|
|
601
|
+
if (e === "linha" || e === "seta") {
|
|
602
|
+
const s = i.shift ? jr(a, r) : r, n = this.c.aparenciaNova();
|
|
603
|
+
return e === "seta" && (n.traco = { ...n.traco ?? {}, pontaFim: o.ponta ?? { estilo: "triangulo" } }), vt(this.base({ aparencia: n }), a, s);
|
|
604
604
|
}
|
|
605
605
|
return null;
|
|
606
606
|
}
|
|
607
|
-
pressionar(
|
|
608
|
-
const i = this.c.ferramenta, { ponto: o } = this.c.snapPonto(
|
|
609
|
-
if (
|
|
610
|
-
this.arrasto = { inicio: o, atual: o, inicioPx:
|
|
607
|
+
pressionar(e, a, r) {
|
|
608
|
+
const i = this.c.ferramenta, { ponto: o } = this.c.snapPonto(e, { toque: r.toque, desligado: r.alt && !oa.includes(i) });
|
|
609
|
+
if (oa.includes(i)) {
|
|
610
|
+
this.arrasto = { inicio: o, atual: o, inicioPx: a };
|
|
611
611
|
return;
|
|
612
612
|
}
|
|
613
613
|
if (i === "texto") {
|
|
614
614
|
this.solicitarTexto(o);
|
|
615
615
|
return;
|
|
616
616
|
}
|
|
617
|
-
const s =
|
|
617
|
+
const s = Ce[i];
|
|
618
618
|
if (!s) return;
|
|
619
|
-
this.sessao || (this.sessao = new
|
|
620
|
-
const n = this.sessao, l = Date.now(), c = !!this.ultimoClique && l - this.ultimoClique.t <=
|
|
621
|
-
this.ultimoClique = { t: l, x:
|
|
619
|
+
this.sessao || (this.sessao = new Ar(s, !1, { espaco: bt }));
|
|
620
|
+
const n = this.sessao, l = Date.now(), c = !!this.ultimoClique && l - this.ultimoClique.t <= qr && Math.hypot(a[0] - this.ultimoClique.x, a[1] - this.ultimoClique.y) <= Br;
|
|
621
|
+
this.ultimoClique = { t: l, x: a[0], y: a[1] };
|
|
622
622
|
const d = n.primeiro;
|
|
623
623
|
if (d && n.fechaNoPrimeiro) {
|
|
624
624
|
const h = this.c.vista.paraTela(d);
|
|
625
|
-
if (Math.hypot(h[0] -
|
|
625
|
+
if (Math.hypot(h[0] - a[0], h[1] - a[1]) <= kr) {
|
|
626
626
|
this.finalizar(n.concluirFechando());
|
|
627
627
|
return;
|
|
628
628
|
}
|
|
@@ -633,270 +633,270 @@ class Ir {
|
|
|
633
633
|
}
|
|
634
634
|
n.clicar(o), s === "caneta" && (this.puxandoAlca = !0), this.atualizarPrevia();
|
|
635
635
|
}
|
|
636
|
-
mover(
|
|
636
|
+
mover(e, a, r) {
|
|
637
637
|
const i = this.c.ferramenta;
|
|
638
638
|
if (this.arrasto) {
|
|
639
|
-
const { ponto: o } = this.c.snapPonto(
|
|
639
|
+
const { ponto: o } = this.c.snapPonto(e, { toque: r.toque });
|
|
640
640
|
this.arrasto.atual = o, this.c.ui.previa = this.construir(i, this.arrasto.inicio, o, r);
|
|
641
|
-
const s =
|
|
641
|
+
const s = qa(this.arrasto.inicio, o, r.shift, r.alt), n = (l) => Math.round(l * 10) / 10;
|
|
642
642
|
this.c.ui.rotulo = { texto: `${n(s.largura)} × ${n(s.altura)} mm`, em: o }, this.c.agendar();
|
|
643
643
|
return;
|
|
644
644
|
}
|
|
645
645
|
if (this.sessao) {
|
|
646
|
-
const { ponto: o } = this.c.snapPonto(
|
|
646
|
+
const { ponto: o } = this.c.snapPonto(e, { toque: r.toque, desligado: r.alt });
|
|
647
647
|
this.puxandoAlca ? this.sessao.definirAlca(o) : this.sessao.mover(o), this.atualizarPrevia();
|
|
648
|
-
} else
|
|
648
|
+
} else ca(i) && (this.c.snapPonto(e, { toque: r.toque, desligado: r.alt }), this.c.agendar());
|
|
649
649
|
}
|
|
650
|
-
soltar(
|
|
650
|
+
soltar(e, a, r) {
|
|
651
651
|
this.puxandoAlca = !1;
|
|
652
652
|
const i = this.arrasto;
|
|
653
653
|
if (!i) return;
|
|
654
654
|
this.arrasto = null;
|
|
655
655
|
const o = this.c.ui.previa;
|
|
656
|
-
if (
|
|
656
|
+
if (V(this.c.ui), !o || Math.hypot(a[0] - i.inicioPx[0], a[1] - i.inicioPx[1]) < Lr) {
|
|
657
657
|
this.c.recusar("desenhar", "forma-pequena"), this.c.agendar();
|
|
658
658
|
return;
|
|
659
659
|
}
|
|
660
|
-
|
|
660
|
+
F(this.c, [{ ...o, id: "" }], "ferramenta");
|
|
661
661
|
}
|
|
662
662
|
atualizarPrevia() {
|
|
663
|
-
const
|
|
664
|
-
if (!
|
|
665
|
-
const
|
|
666
|
-
this.c.ui.previa =
|
|
667
|
-
}
|
|
668
|
-
finalizar(
|
|
669
|
-
if (this.sessao = null, this.ultimoClique = null,
|
|
670
|
-
const
|
|
671
|
-
|
|
663
|
+
const e = this.sessao;
|
|
664
|
+
if (!e) return;
|
|
665
|
+
const a = e.previa();
|
|
666
|
+
this.c.ui.previa = a && (a.tipo === "LineString" || a.tipo === "Polygon") ? _a(this.base(), a) : null, this.c.ui.pontosPrevia = e.ferramenta === "caneta" ? e.ancoras.map((r) => r.ponto) : [...e.pontos], this.c.agendar();
|
|
667
|
+
}
|
|
668
|
+
finalizar(e) {
|
|
669
|
+
if (this.sessao = null, this.ultimoClique = null, V(this.c.ui), e && (e.tipo === "LineString" || e.tipo === "Polygon")) {
|
|
670
|
+
const a = _a({ id: "", aparencia: this.c.aparenciaNova() }, e);
|
|
671
|
+
a && F(this.c, [a], "ferramenta");
|
|
672
672
|
} else
|
|
673
673
|
this.c.recusar("desenhar", "geometria-invalida");
|
|
674
674
|
this.c.agendar();
|
|
675
675
|
}
|
|
676
676
|
concluir() {
|
|
677
|
-
const
|
|
678
|
-
return !
|
|
677
|
+
const e = this.sessao;
|
|
678
|
+
return !e || !e.podeConcluir ? !1 : (this.finalizar(e.concluir()), !0);
|
|
679
679
|
}
|
|
680
680
|
cancelar() {
|
|
681
|
-
this.arrasto = null, this.sessao = null, this.puxandoAlca = !1, this.ultimoClique = null,
|
|
681
|
+
this.arrasto = null, this.sessao = null, this.puxandoAlca = !1, this.ultimoClique = null, V(this.c.ui), this.c.agendar();
|
|
682
682
|
}
|
|
683
683
|
/** Enter, Esc e Backspace durante o desenho; devolve se tratou. */
|
|
684
|
-
tecla(
|
|
685
|
-
return
|
|
684
|
+
tecla(e) {
|
|
685
|
+
return e === "Enter" && this.sessao ? this.concluir() || !0 : e === "Escape" && this.emAndamento ? (this.cancelar(), !0) : e === "Backspace" && this.sessao && this.sessao.nos > 0 ? (this.sessao.desfazer(), this.sessao.nos === 0 ? this.cancelar() : this.atualizarPrevia(), !0) : !1;
|
|
686
686
|
}
|
|
687
687
|
/** Teclado: Enter com a ferramenta ativa e nada em andamento cria a forma padrão (40 × 30 mm) no centro da vista. */
|
|
688
688
|
criarNoCentro() {
|
|
689
|
-
const
|
|
690
|
-
if (
|
|
689
|
+
const e = this.c.ferramenta, a = this.c.vista, r = a.largura > 0 ? a.paraFolha(a.largura / 2, a.altura / 2) : [this.c.folha.largura / 2, this.c.folha.altura / 2];
|
|
690
|
+
if (e === "texto")
|
|
691
691
|
return this.solicitarTexto(r), !0;
|
|
692
|
-
if (!
|
|
693
|
-
const i = this.construir(
|
|
694
|
-
return !!i &&
|
|
692
|
+
if (!oa.includes(e)) return !1;
|
|
693
|
+
const i = this.construir(e, [r[0] - 20, r[1] - 15], [r[0] + 20, r[1] + 15], { shift: !1, alt: !1 });
|
|
694
|
+
return !!i && F(this.c, [{ ...i, id: "" }], "ferramenta").length > 0;
|
|
695
695
|
}
|
|
696
|
-
solicitarTexto(
|
|
697
|
-
const
|
|
696
|
+
solicitarTexto(e) {
|
|
697
|
+
const a = this.c.opcoesFerramentas, r = a.tamanhoTexto && a.tamanhoTexto > 0 ? a.tamanhoTexto : yt(12, "pt"), i = (n) => {
|
|
698
698
|
var c;
|
|
699
|
-
const l =
|
|
700
|
-
return l ?
|
|
701
|
-
}, o = { posicao:
|
|
702
|
-
this.c.emitir("prancha-texto-solicitado", o, !0) || i(
|
|
699
|
+
const l = At({ id: "", aparencia: { preenchimento: { cor: ((c = this.c.aparenciaNova().traco) == null ? void 0 : c.cor) ?? void 0 } } }, e, n, r);
|
|
700
|
+
return l ? F(this.c, [l], "texto")[0] ?? null : null;
|
|
701
|
+
}, o = { posicao: e, concluir: (n) => i(typeof n == "string" ? n : String(n ?? "")) };
|
|
702
|
+
this.c.emitir("prancha-texto-solicitado", o, !0) || i(a.textoPadrao ?? "Texto");
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
const
|
|
706
|
-
function y(t,
|
|
705
|
+
const Z = 5, R = { elementos: [], colagens: 0 }, Ma = (t) => typeof t == "number" && Number.isFinite(t);
|
|
706
|
+
function y(t, e, a = 1) {
|
|
707
707
|
if (t.somenteLeitura)
|
|
708
|
-
return t.recusar(
|
|
708
|
+
return t.recusar(e, "somente-leitura"), null;
|
|
709
709
|
const r = t.doc.elementosSelecionados().filter((i) => !t.mapa().travado(i));
|
|
710
|
-
return r.length <
|
|
711
|
-
}
|
|
712
|
-
function Q(t, a, e) {
|
|
713
|
-
return "ok" in e ? e.ok : (t.recusar(a, e.motivo === "texto" ? "texto-sem-ancoras" : e.motivo === "tipos-incompativeis" || e.motivo === "sem-forma-fechada" ? "tipo-nao-suportado" : "geometria-invalida"), null);
|
|
710
|
+
return r.length < a ? (t.recusar(e, "sem-selecao"), null) : r;
|
|
714
711
|
}
|
|
715
|
-
function
|
|
716
|
-
|
|
717
|
-
return !e || !["frente", "tras", "avancar", "recuar"].includes(a) ? !1 : (t.aplicar(dt(t.doc.elementos, e.map((r) => r.id), a, t.camadas), "ordem"), !0);
|
|
712
|
+
function ea(t, e, a) {
|
|
713
|
+
return "ok" in a ? a.ok : (t.recusar(e, a.motivo === "texto" ? "texto-sem-ancoras" : a.motivo === "tipos-incompativeis" || a.motivo === "sem-forma-fechada" ? "tipo-nao-suportado" : "geometria-invalida"), null);
|
|
718
714
|
}
|
|
719
|
-
function
|
|
720
|
-
const a = y(t, "
|
|
721
|
-
return a ? (t.aplicar(
|
|
715
|
+
function O(t, e) {
|
|
716
|
+
const a = y(t, "ordem");
|
|
717
|
+
return !a || !["frente", "tras", "avancar", "recuar"].includes(e) ? !1 : (t.aplicar(Pt(t.doc.elementos, a.map((r) => r.id), e, t.camadas), "ordem"), !0);
|
|
722
718
|
}
|
|
723
|
-
function
|
|
724
|
-
const
|
|
725
|
-
|
|
726
|
-
const e = a.map((r) => r.id);
|
|
727
|
-
return t.isolado && a.some((r) => r.grupoId === t.isolado) && t.isolar(null), t.aplicar(mt(t.doc.elementos, e), "desagrupar"), !0;
|
|
719
|
+
function Te(t) {
|
|
720
|
+
const e = y(t, "agrupar", 2);
|
|
721
|
+
return e ? (t.aplicar(Mt(t.doc.elementos, e.map((a) => a.id), t.gerarId("grupo"), t.camadas), "agrupar"), !0) : !1;
|
|
728
722
|
}
|
|
729
|
-
function
|
|
730
|
-
const e = y(t,
|
|
723
|
+
function we(t) {
|
|
724
|
+
const e = y(t, "desagrupar");
|
|
731
725
|
if (!e) return !1;
|
|
732
|
-
const
|
|
733
|
-
return t.
|
|
726
|
+
const a = e.map((r) => r.id);
|
|
727
|
+
return t.isolado && e.some((r) => r.grupoId === t.isolado) && t.isolar(null), t.aplicar(zt(t.doc.elementos, a), "desagrupar"), !0;
|
|
728
|
+
}
|
|
729
|
+
function ua(t, e) {
|
|
730
|
+
const a = y(t, e === "bloqueado" ? "bloquear" : "ocultar");
|
|
731
|
+
if (!a) return !1;
|
|
732
|
+
const r = new Set(a.map((i) => i.id));
|
|
733
|
+
return t.selecionar([]), t.aplicar(t.doc.elementos.map((i) => r.has(i.id) ? { ...i, [e]: !0 } : i), e === "bloqueado" ? "bloquear" : "ocultar"), !0;
|
|
734
734
|
}
|
|
735
|
-
function
|
|
735
|
+
function da(t, e) {
|
|
736
736
|
if (t.somenteLeitura)
|
|
737
737
|
return t.recusar("liberar", "somente-leitura"), !1;
|
|
738
|
-
const
|
|
739
|
-
if (!i[
|
|
740
|
-
|
|
738
|
+
const a = [], r = t.doc.elementos.map((i) => {
|
|
739
|
+
if (!i[e]) return i;
|
|
740
|
+
a.push(i.id);
|
|
741
741
|
const o = { ...i };
|
|
742
|
-
return delete o[
|
|
742
|
+
return delete o[e], o;
|
|
743
743
|
});
|
|
744
|
-
return
|
|
744
|
+
return a.length === 0 ? !1 : (t.aplicar(r, e === "bloqueado" ? "bloquear" : "ocultar"), t.selecionar(a), !0);
|
|
745
745
|
}
|
|
746
|
-
function
|
|
746
|
+
function Hr(t, e, a = "selecao") {
|
|
747
747
|
const r = y(t, "alinhar");
|
|
748
748
|
if (!r) return !1;
|
|
749
749
|
let i = { tipo: "selecao" };
|
|
750
|
-
|
|
751
|
-
const o =
|
|
750
|
+
a === "folha" ? i = { tipo: "caixa", caixa: { x: 0, y: 0, largura: t.folha.largura, altura: t.folha.altura } } : a === "chave" ? i = { tipo: "chave", id: t.doc.selecao[0] } : a && typeof a == "object" && (i = { tipo: "caixa", caixa: a });
|
|
751
|
+
const o = xt(r, e, i);
|
|
752
752
|
return o.length === 0 ? !1 : (t.aplicarSubstituicoes(o, "alinhar"), !0);
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function $r(t, e, a = "espacos", r) {
|
|
755
755
|
const i = y(t, "distribuir", 2);
|
|
756
756
|
if (!i) return !1;
|
|
757
|
-
const o =
|
|
757
|
+
const o = Et(i, e === "vertical" ? "vertical" : "horizontal", a === "centros" ? "centros" : "espacos", Ma(r) ? r : void 0);
|
|
758
758
|
return o.length === 0 ? !1 : (t.aplicarSubstituicoes(o, "distribuir"), !0);
|
|
759
759
|
}
|
|
760
|
-
function
|
|
761
|
-
const i =
|
|
762
|
-
return
|
|
760
|
+
function wa(t, e, a, r) {
|
|
761
|
+
const i = he(U(e, t.camadas), t.gerarId, a);
|
|
762
|
+
return F(t, i, r);
|
|
763
763
|
}
|
|
764
|
-
function
|
|
765
|
-
const
|
|
766
|
-
if (!
|
|
767
|
-
const r =
|
|
764
|
+
function Vr(t, e = [Z, Z]) {
|
|
765
|
+
const a = y(t, "duplicar");
|
|
766
|
+
if (!a) return !1;
|
|
767
|
+
const r = Ma(e == null ? void 0 : e[0]) && Ma(e == null ? void 0 : e[1]) ? e : [Z, Z], i = wa(t, a, r, "duplicar");
|
|
768
768
|
return t.ultimaTransformacao = { matriz: k(r[0], r[1]), duplicar: !0 }, i.length > 0;
|
|
769
769
|
}
|
|
770
|
-
function
|
|
771
|
-
|
|
770
|
+
function Ba(t, e, a = !1) {
|
|
771
|
+
ne(e) && (t.ultimaTransformacao = { matriz: e, duplicar: a });
|
|
772
772
|
}
|
|
773
|
-
function
|
|
774
|
-
const
|
|
775
|
-
if (!
|
|
773
|
+
function De(t) {
|
|
774
|
+
const e = t.ultimaTransformacao;
|
|
775
|
+
if (!e)
|
|
776
776
|
return t.recusar("transformar-de-novo", "nada-a-refazer"), !1;
|
|
777
|
-
const
|
|
778
|
-
if (!
|
|
779
|
-
if (
|
|
780
|
-
const i =
|
|
781
|
-
return i.length === 0 ? !1 : (t.aplicarSubstituicoes(
|
|
777
|
+
const a = y(t, "transformar-de-novo");
|
|
778
|
+
if (!a) return !1;
|
|
779
|
+
if (e.duplicar) {
|
|
780
|
+
const i = wa(t, a, [0, 0], "duplicar");
|
|
781
|
+
return i.length === 0 ? !1 : (t.aplicarSubstituicoes(I(i, e.matriz), "transformar"), t.ultimaTransformacao = e, !0);
|
|
782
782
|
}
|
|
783
|
-
const r =
|
|
784
|
-
return t.ultimaTransformacao =
|
|
783
|
+
const r = aa(t, e.matriz, "transformar");
|
|
784
|
+
return t.ultimaTransformacao = e, r;
|
|
785
785
|
}
|
|
786
|
-
function
|
|
787
|
-
var
|
|
788
|
-
const
|
|
789
|
-
if (
|
|
786
|
+
function Da(t) {
|
|
787
|
+
var a, r, i, o;
|
|
788
|
+
const e = t.doc.elementosSelecionados();
|
|
789
|
+
if (e.length === 0)
|
|
790
790
|
return t.recusar("copiar", "sem-selecao"), !1;
|
|
791
|
-
|
|
791
|
+
R.elementos = JSON.parse(JSON.stringify(U(e, t.camadas))), R.colagens = 0;
|
|
792
792
|
try {
|
|
793
793
|
const s = typeof navigator < "u" ? navigator : void 0;
|
|
794
|
-
(o = (i = (r = (
|
|
794
|
+
(o = (i = (r = (a = s == null ? void 0 : s.clipboard) == null ? void 0 : a.writeText) == null ? void 0 : r.call(a, JSON.stringify({ tipo: "ui-canvas-prancha", elementos: R.elementos }))) == null ? void 0 : i.catch) == null || o.call(i, () => {
|
|
795
795
|
});
|
|
796
796
|
} catch {
|
|
797
797
|
}
|
|
798
|
-
return t.anunciar(
|
|
798
|
+
return t.anunciar(e.length === 1 ? "Elemento copiado" : `${e.length} elementos copiados`), !0;
|
|
799
799
|
}
|
|
800
|
-
function
|
|
801
|
-
const
|
|
802
|
-
if (!
|
|
803
|
-
const
|
|
804
|
-
return t.aplicar(t.doc.elementos.filter((r) => !
|
|
800
|
+
function Ie(t) {
|
|
801
|
+
const e = y(t, "recortar");
|
|
802
|
+
if (!e || !Da(t)) return !1;
|
|
803
|
+
const a = new Set(e.map((r) => r.id));
|
|
804
|
+
return t.aplicar(t.doc.elementos.filter((r) => !a.has(r.id)), "recortar"), !0;
|
|
805
805
|
}
|
|
806
|
-
function
|
|
807
|
-
if (
|
|
806
|
+
function Fe(t, e = !1) {
|
|
807
|
+
if (R.elementos.length === 0)
|
|
808
808
|
return t.recusar("colar", "sem-selecao"), !1;
|
|
809
809
|
if (t.somenteLeitura)
|
|
810
810
|
return t.recusar("colar", "somente-leitura"), !1;
|
|
811
|
-
|
|
812
|
-
const
|
|
813
|
-
return
|
|
814
|
-
}
|
|
815
|
-
function kr(t, a) {
|
|
816
|
-
const e = a.aparencia ? JSON.parse(JSON.stringify(a.aparencia)) : void 0;
|
|
817
|
-
t.emitir("prancha-conta-gotas", { elemento: a, aparencia: e });
|
|
818
|
-
const r = t.doc.elementosSelecionados().filter((i) => i.id !== a.id && !t.mapa().travado(i));
|
|
819
|
-
return r.length === 0 ? (t.opcoesFerramentas = { ...t.opcoesFerramentas, aparencia: e }, t.anunciar("Aparência guardada para as formas novas"), !0) : t.somenteLeitura ? (t.recusar("conta-gotas", "somente-leitura"), !1) : (t.aplicarSubstituicoes(ne(r, e), "conta-gotas"), !0);
|
|
811
|
+
R.colagens++;
|
|
812
|
+
const a = e ? 0 : Z * R.colagens;
|
|
813
|
+
return wa(t, R.elementos, [a, a], "colar").length > 0;
|
|
820
814
|
}
|
|
821
|
-
function
|
|
822
|
-
const
|
|
823
|
-
|
|
815
|
+
function Kr(t, e) {
|
|
816
|
+
const a = e.aparencia ? JSON.parse(JSON.stringify(e.aparencia)) : void 0;
|
|
817
|
+
t.emitir("prancha-conta-gotas", { elemento: e, aparencia: a });
|
|
818
|
+
const r = t.doc.elementosSelecionados().filter((i) => i.id !== e.id && !t.mapa().travado(i));
|
|
819
|
+
return r.length === 0 ? (t.opcoesFerramentas = { ...t.opcoesFerramentas, aparencia: a }, t.anunciar("Aparência guardada para as formas novas"), !0) : t.somenteLeitura ? (t.recusar("conta-gotas", "somente-leitura"), !1) : (t.aplicarSubstituicoes(de(r, a), "conta-gotas"), !0);
|
|
824
820
|
}
|
|
825
|
-
function
|
|
826
|
-
const
|
|
827
|
-
return
|
|
821
|
+
function Wr(t, e) {
|
|
822
|
+
const a = y(t, "aparencia");
|
|
823
|
+
return a ? (t.aplicarSubstituicoes(de(a, e ?? void 0), "aparencia"), !0) : !1;
|
|
828
824
|
}
|
|
829
|
-
function
|
|
830
|
-
const a = y(t, "
|
|
831
|
-
|
|
832
|
-
const e = Q(t, "mascara", gt(t.doc.elementos, a.map((r) => r.id), t.gerarId("grupo"), t.camadas));
|
|
833
|
-
return e ? (t.aplicar(e, "mascara"), !0) : !1;
|
|
825
|
+
function Ur(t, e) {
|
|
826
|
+
const a = y(t, "mover-camada");
|
|
827
|
+
return !a || typeof e != "string" || !t.camadas.some((r) => r.id === e) ? (a && t.recusar("mover-camada", "id-invalido", typeof e == "string" ? e : void 0), !1) : (t.aplicarSubstituicoes(a.map((r) => ({ ...r, camadaId: e })), "camada"), !0);
|
|
834
828
|
}
|
|
835
|
-
function
|
|
836
|
-
const
|
|
837
|
-
if (!
|
|
838
|
-
const
|
|
839
|
-
return
|
|
829
|
+
function _e(t) {
|
|
830
|
+
const e = y(t, "mascara", 2);
|
|
831
|
+
if (!e) return !1;
|
|
832
|
+
const a = ea(t, "mascara", Ct(t.doc.elementos, e.map((r) => r.id), t.gerarId("grupo"), t.camadas));
|
|
833
|
+
return a ? (t.aplicar(a, "mascara"), !0) : !1;
|
|
840
834
|
}
|
|
841
|
-
function
|
|
842
|
-
const e = y(t, "
|
|
835
|
+
function Ne(t) {
|
|
836
|
+
const e = y(t, "liberar-mascara");
|
|
843
837
|
if (!e) return !1;
|
|
844
|
-
const
|
|
838
|
+
const a = Tt(t.doc.elementos, e.map((r) => r.id));
|
|
839
|
+
return a.every((r, i) => r === t.doc.elementos[i]) ? (t.recusar("liberar-mascara", "tipo-nao-suportado"), !1) : (t.aplicar(a, "mascara"), !0);
|
|
840
|
+
}
|
|
841
|
+
function Oe(t, e = 0.01) {
|
|
842
|
+
const a = y(t, "unir", 2);
|
|
843
|
+
if (!a) return !1;
|
|
844
|
+
const r = U(a, t.camadas), i = ea(t, "unir", wt(r, e));
|
|
845
845
|
if (!i) return !1;
|
|
846
846
|
const o = new Set(r.slice(1).map((s) => s.id));
|
|
847
847
|
return t.aplicar(t.doc.elementos.filter((s) => !o.has(s.id)).map((s) => s.id === i.id ? i : s), "unir"), !0;
|
|
848
848
|
}
|
|
849
|
-
function
|
|
850
|
-
const
|
|
851
|
-
if (!
|
|
852
|
-
const
|
|
849
|
+
function Xr(t) {
|
|
850
|
+
const e = y(t, "dividir", 2);
|
|
851
|
+
if (!e) return !1;
|
|
852
|
+
const a = U(e, t.camadas), r = [...a].reverse().find((n) => n.geometria.tipo === "linha" || n.geometria.tipo === "caminho" && n.geometria.geometria.tipo === "LineString"), i = a.find((n) => n !== r);
|
|
853
853
|
if (!r || !i)
|
|
854
854
|
return t.recusar("dividir", "tipo-nao-suportado"), !1;
|
|
855
|
-
const o =
|
|
855
|
+
const o = ea(t, "dividir", Dt(i, r, t.gerarId));
|
|
856
856
|
if (!o) return !1;
|
|
857
857
|
const s = [];
|
|
858
858
|
for (const n of t.doc.elementos)
|
|
859
859
|
n.id !== r.id && (n.id === i.id ? s.push(...o) : s.push(n));
|
|
860
860
|
return t.aplicar(s, "dividir"), t.selecionar(o.map((n) => n.id)), !0;
|
|
861
861
|
}
|
|
862
|
-
function
|
|
863
|
-
const
|
|
864
|
-
if (!
|
|
865
|
-
const r =
|
|
866
|
-
return r.length > 0 &&
|
|
862
|
+
function Zr(t, e) {
|
|
863
|
+
const a = y(t, "deslocar-caminho");
|
|
864
|
+
if (!a) return !1;
|
|
865
|
+
const r = a.map((i) => ea(t, "deslocar-caminho", It(i, e, t.gerarId("caminho")))).filter((i) => !!i);
|
|
866
|
+
return r.length > 0 && F(t, r, "deslocar-caminho").length > 0;
|
|
867
867
|
}
|
|
868
|
-
function
|
|
869
|
-
const i = y(t,
|
|
868
|
+
function Ia(t, e, a, r) {
|
|
869
|
+
const i = y(t, e);
|
|
870
870
|
if (!i) return !1;
|
|
871
871
|
const o = [];
|
|
872
872
|
for (const s of i) {
|
|
873
|
-
const n = r(s), l = n && typeof n == "object" && ("ok" in n || "motivo" in n) ?
|
|
873
|
+
const n = r(s), l = n && typeof n == "object" && ("ok" in n || "motivo" in n) ? ea(t, e, n) : n;
|
|
874
874
|
l && o.push(l);
|
|
875
875
|
}
|
|
876
|
-
return o.length === 0 ? !1 : (t.aplicarSubstituicoes(o,
|
|
876
|
+
return o.length === 0 ? !1 : (t.aplicarSubstituicoes(o, a), !0);
|
|
877
877
|
}
|
|
878
|
-
const
|
|
879
|
-
function
|
|
880
|
-
if (
|
|
881
|
-
t.moveTo(
|
|
882
|
-
for (let r = 1; r <
|
|
883
|
-
|
|
878
|
+
const Jr = (t, e = 0.2) => Ia(t, "simplificar", "simplificar", (a) => Ft(a, e)), Qr = (t) => Ia(t, "contorno-traco", "contorno-traco", (e) => _t(e)), Yr = (t) => Ia(t, "converter-caminho", "converter-caminho", (e) => e.geometria.tipo === "caminho" ? null : Nt(e)), ai = 7, Re = 22, ja = 6, K = (t, e) => t.setTransform(e, 0, 0, e, 0, 0);
|
|
879
|
+
function z(t, e, a = !0) {
|
|
880
|
+
if (e.length !== 0) {
|
|
881
|
+
t.moveTo(e[0][0], e[0][1]);
|
|
882
|
+
for (let r = 1; r < e.length; r++) t.lineTo(e[r][0], e[r][1]);
|
|
883
|
+
a && t.closePath();
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
|
-
function
|
|
887
|
-
const o =
|
|
888
|
-
t.beginPath(),
|
|
886
|
+
function va(t, e, a, r, i) {
|
|
887
|
+
const o = a / 2;
|
|
888
|
+
t.beginPath(), z(t, [[e[0] - o, e[1] - o], [e[0] + o, e[1] - o], [e[0] + o, e[1] + o], [e[0] - o, e[1] + o]]), t.fillStyle = r, t.fill(), t.strokeStyle = i, t.stroke();
|
|
889
889
|
}
|
|
890
|
-
function
|
|
890
|
+
function ta(t, e, a) {
|
|
891
891
|
const r = [];
|
|
892
|
-
for (let i = 0; i < 16; i++) r.push([
|
|
893
|
-
|
|
894
|
-
}
|
|
895
|
-
function
|
|
896
|
-
const
|
|
897
|
-
if (!
|
|
898
|
-
const { vista: r, folha: i } =
|
|
899
|
-
let o =
|
|
892
|
+
for (let i = 0; i < 16; i++) r.push([e[0] + a * Math.cos(i * Math.PI / 8), e[1] + a * Math.sin(i * Math.PI / 8)]);
|
|
893
|
+
z(t, r);
|
|
894
|
+
}
|
|
895
|
+
function ei(t, e) {
|
|
896
|
+
const a = e.grade;
|
|
897
|
+
if (!a || !(a > 0)) return;
|
|
898
|
+
const { vista: r, folha: i } = e;
|
|
899
|
+
let o = a;
|
|
900
900
|
for (; o * r.zoom < 8; ) o *= 2;
|
|
901
901
|
const [s, n] = r.paraTela([0, 0]), [l, c] = r.paraTela([i.largura, i.altura]);
|
|
902
902
|
t.beginPath();
|
|
@@ -908,394 +908,394 @@ function $r(t, a) {
|
|
|
908
908
|
const h = Math.round(r.paraTela([0, d])[1]) + 0.5;
|
|
909
909
|
t.moveTo(s, h), t.lineTo(l, h);
|
|
910
910
|
}
|
|
911
|
-
t.strokeStyle =
|
|
911
|
+
t.strokeStyle = e.cores.grade, t.lineWidth = 1, t.setLineDash([]), t.globalAlpha = 1, t.stroke();
|
|
912
912
|
}
|
|
913
|
-
function
|
|
914
|
-
const i =
|
|
915
|
-
t.setTransform(i.a, i.b, i.c, i.d, i.e, i.f), t.globalAlpha = 0.6, t.fillStyle = r, t.fillRect(0, 0,
|
|
913
|
+
function ti(t, e, a, r) {
|
|
914
|
+
const i = e.matrizDispositivo();
|
|
915
|
+
t.setTransform(i.a, i.b, i.c, i.d, i.e, i.f), t.globalAlpha = 0.6, t.fillStyle = r, t.fillRect(0, 0, a.largura, a.altura);
|
|
916
916
|
}
|
|
917
|
-
function
|
|
918
|
-
const { vista:
|
|
919
|
-
t.save(),
|
|
920
|
-
const o =
|
|
921
|
-
|
|
922
|
-
const [s, n] =
|
|
923
|
-
t.beginPath(),
|
|
924
|
-
const d =
|
|
917
|
+
function ri(t, e) {
|
|
918
|
+
const { vista: a, folha: r, cores: i } = e;
|
|
919
|
+
t.save(), K(t, a.dpr), t.globalAlpha = 1, t.fillStyle = i.mesa, t.fillRect(0, 0, a.largura, a.altura), t.restore();
|
|
920
|
+
const o = a.matrizDispositivo();
|
|
921
|
+
$(t, [], { matriz: o, fundo: { cor: i.papel, largura: r.largura, altura: r.altura } }), t.save(), K(t, a.dpr), ei(t, e), t.restore(), $(t, e.elementos, { matriz: o, camadas: e.camadas }), e.isolados && e.isolados.length > 0 && (t.save(), ti(t, a, r, i.papel), t.restore(), $(t, e.isolados, { matriz: o, camadas: e.camadas })), t.save(), K(t, a.dpr);
|
|
922
|
+
const [s, n] = a.paraTela([0, 0]), [l, c] = a.paraTela([r.largura, r.altura]);
|
|
923
|
+
t.beginPath(), z(t, [[s, n], [l, n], [l, c], [s, c]]), t.strokeStyle = i.bordaPapel, t.lineWidth = 1, t.stroke();
|
|
924
|
+
const d = e.margens;
|
|
925
925
|
if (d && d.largura > 0 && d.altura > 0) {
|
|
926
|
-
const [h, u] =
|
|
927
|
-
t.beginPath(),
|
|
926
|
+
const [h, u] = a.paraTela([d.x, d.y]), [f, p] = a.paraTela([d.x + d.largura, d.y + d.altura]);
|
|
927
|
+
t.beginPath(), z(t, [[h, u], [f, u], [f, p], [h, p]]), t.strokeStyle = i.guiaInteligente, t.globalAlpha = 0.6, t.setLineDash([6, 4]), t.stroke(), t.setLineDash([]), t.globalAlpha = 1;
|
|
928
928
|
}
|
|
929
929
|
t.restore();
|
|
930
930
|
}
|
|
931
|
-
function
|
|
932
|
-
const r =
|
|
931
|
+
function Ga(t, e, a) {
|
|
932
|
+
const r = Ca(e);
|
|
933
933
|
if (!r) return;
|
|
934
934
|
const i = r.tipo === "Polygon" ? r.aneis : r.partes && r.partes.length > 1 ? r.partes : [r.coordenadas];
|
|
935
|
-
for (const o of i)
|
|
935
|
+
for (const o of i) z(t, o.map((s) => a.paraTela(s)), r.tipo === "Polygon");
|
|
936
936
|
}
|
|
937
|
-
function
|
|
938
|
-
return ["no", "ne", "se", "so"].map((
|
|
937
|
+
function Ha(t, e) {
|
|
938
|
+
return ["no", "ne", "se", "so"].map((a) => e.paraTela(Rt(t.quadro, Lt(t, a))));
|
|
939
939
|
}
|
|
940
|
-
function
|
|
941
|
-
if (
|
|
942
|
-
const r = Math.round(
|
|
943
|
-
t.moveTo(0, r), t.lineTo(
|
|
940
|
+
function $a(t, e, a) {
|
|
941
|
+
if (e.orientacao === "horizontal") {
|
|
942
|
+
const r = Math.round(a.paraTela([0, e.posicao])[1]) + 0.5;
|
|
943
|
+
t.moveTo(0, r), t.lineTo(a.largura, r);
|
|
944
944
|
} else {
|
|
945
|
-
const r = Math.round(
|
|
946
|
-
t.moveTo(r, 0), t.lineTo(r,
|
|
945
|
+
const r = Math.round(a.paraTela([e.posicao, 0])[0]) + 0.5;
|
|
946
|
+
t.moveTo(r, 0), t.lineTo(r, a.altura);
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
function
|
|
950
|
-
typeof t.fillText == "function" && (t.font = "11px sans-serif", t.fillStyle = r, t.fillText(
|
|
949
|
+
function ba(t, e, a, r) {
|
|
950
|
+
typeof t.fillText == "function" && (t.font = "11px sans-serif", t.fillStyle = r, t.fillText(e, a[0], a[1]));
|
|
951
951
|
}
|
|
952
|
-
function
|
|
953
|
-
const { vista:
|
|
954
|
-
t.save(),
|
|
955
|
-
for (const s of
|
|
956
|
-
t.strokeStyle = r.guia, t.stroke(), i.guiaArrastada && (t.beginPath(),
|
|
957
|
-
for (const s of i.pontosPrevia)
|
|
958
|
-
const o = i.edicao ?
|
|
959
|
-
for (const s of
|
|
960
|
-
const n =
|
|
961
|
-
!n || s === o || (t.beginPath(),
|
|
952
|
+
function ii(t, e) {
|
|
953
|
+
const { vista: a, cores: r, ui: i } = e;
|
|
954
|
+
t.save(), K(t, a.dpr), typeof t.clearRect == "function" && t.clearRect(0, 0, a.largura, a.altura), t.globalAlpha = 1, t.lineWidth = 1, t.setLineDash([]), t.beginPath();
|
|
955
|
+
for (const s of e.guias) $a(t, s, a);
|
|
956
|
+
t.strokeStyle = r.guia, t.stroke(), i.guiaArrastada && (t.beginPath(), $a(t, i.guiaArrastada.guia, a), t.setLineDash([4, 3]), t.stroke(), t.setLineDash([])), e.hover && !e.selecionados.includes(e.hover) && (t.beginPath(), Ga(t, e.hover, a), t.strokeStyle = r.selecao, t.stroke()), e.emGesto.length > 0 && ($(t, e.emGesto, { matriz: a.matrizDispositivo() }), K(t, a.dpr), t.globalAlpha = 1, t.lineWidth = 1, t.setLineDash([])), i.previa && ($(t, [i.previa], { matriz: a.matrizDispositivo() }), K(t, a.dpr), t.globalAlpha = 1, t.lineWidth = 1, t.setLineDash([]));
|
|
957
|
+
for (const s of i.pontosPrevia) va(t, a.paraTela(s), ja, r.alca, r.selecao);
|
|
958
|
+
const o = i.edicao ? e.selecionados.find((s) => s.id === i.edicao.id) ?? null : null;
|
|
959
|
+
for (const s of e.selecionados) {
|
|
960
|
+
const n = Ot(s);
|
|
961
|
+
!n || s === o || (t.beginPath(), z(t, Ha(n, a)), t.strokeStyle = r.selecao, t.stroke());
|
|
962
962
|
}
|
|
963
963
|
if (o && i.edicao) {
|
|
964
|
-
t.beginPath(),
|
|
965
|
-
const s =
|
|
964
|
+
t.beginPath(), Ga(t, o, a), t.strokeStyle = r.selecao, t.stroke();
|
|
965
|
+
const s = xa(o), n = me(o);
|
|
966
966
|
t.beginPath(), i.edicao.ancoras.forEach((l) => {
|
|
967
967
|
const c = s[l], d = n[l];
|
|
968
968
|
if (!(!c || !d))
|
|
969
|
-
for (const h of [d.entrada, d.saida]) h &&
|
|
969
|
+
for (const h of [d.entrada, d.saida]) h && z(t, [a.paraTela(c), a.paraTela(h)], !1);
|
|
970
970
|
}), t.stroke(), i.edicao.ancoras.forEach((l) => {
|
|
971
971
|
const c = n[l];
|
|
972
972
|
if (c)
|
|
973
973
|
for (const d of [c.entrada, c.saida])
|
|
974
|
-
d && (t.beginPath(),
|
|
975
|
-
}), s.forEach((l, c) =>
|
|
976
|
-
} else if (
|
|
977
|
-
const s =
|
|
974
|
+
d && (t.beginPath(), ta(t, a.paraTela(d), 3), t.fillStyle = r.selecao, t.fill());
|
|
975
|
+
}), s.forEach((l, c) => va(t, a.paraTela(l), ja, i.edicao.ancoras.includes(c) ? r.selecao : r.alca, r.selecao));
|
|
976
|
+
} else if (e.caixaTransformacao && e.selecionados.length > 0) {
|
|
977
|
+
const s = Ea(e.selecionados);
|
|
978
978
|
if (s) {
|
|
979
|
-
const n =
|
|
980
|
-
t.beginPath(),
|
|
981
|
-
for (const c of Object.values(n.alcas))
|
|
982
|
-
t.beginPath(),
|
|
983
|
-
for (const c of
|
|
984
|
-
t.beginPath(),
|
|
985
|
-
const l =
|
|
986
|
-
t.beginPath(),
|
|
979
|
+
const n = fe(s, Re / a.zoom);
|
|
980
|
+
t.beginPath(), z(t, Ha(s, a)), z(t, [a.paraTela(n.alcas.n), a.paraTela(n.rotacao)], !1), t.strokeStyle = r.selecao, t.stroke();
|
|
981
|
+
for (const c of Object.values(n.alcas)) va(t, a.paraTela(c), ai, r.alca, r.selecao);
|
|
982
|
+
t.beginPath(), ta(t, a.paraTela(n.rotacao), 4), t.fillStyle = r.alca, t.fill(), t.stroke();
|
|
983
|
+
for (const c of e.marcasCantos ?? [])
|
|
984
|
+
t.beginPath(), ta(t, a.paraTela(c), 3.5), t.fillStyle = r.alca, t.fill(), t.strokeStyle = r.selecao, t.stroke();
|
|
985
|
+
const l = a.paraTela(i.pivo ?? n.centro);
|
|
986
|
+
t.beginPath(), ta(t, l, 4), z(t, [[l[0] - 7, l[1]], [l[0] + 7, l[1]]], !1), z(t, [[l[0], l[1] - 7], [l[0], l[1] + 7]], !1), t.stroke();
|
|
987
987
|
}
|
|
988
988
|
}
|
|
989
989
|
if (i.linhasInteligentes.length > 0) {
|
|
990
990
|
t.beginPath();
|
|
991
991
|
for (const s of i.linhasInteligentes) {
|
|
992
|
-
const n =
|
|
993
|
-
|
|
992
|
+
const n = a.paraTela(s.orientacao === "vertical" ? [s.posicao, s.de] : [s.de, s.posicao]), l = a.paraTela(s.orientacao === "vertical" ? [s.posicao, s.ate] : [s.ate, s.posicao]);
|
|
993
|
+
z(t, [n, l], !1);
|
|
994
994
|
}
|
|
995
995
|
t.strokeStyle = r.guiaInteligente, t.stroke();
|
|
996
996
|
for (const s of i.linhasInteligentes) {
|
|
997
997
|
if (s.distancia === void 0) continue;
|
|
998
|
-
const n =
|
|
999
|
-
|
|
998
|
+
const n = a.paraTela(s.orientacao === "vertical" ? [s.posicao, (s.de + s.ate) / 2] : [(s.de + s.ate) / 2, s.posicao]);
|
|
999
|
+
ba(t, `${Math.round(s.distancia * 100) / 100} mm`, [n[0] + 4, n[1] - 4], r.guiaInteligente);
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
1002
|
if (i.caixaSelecao) {
|
|
1003
|
-
const s =
|
|
1004
|
-
t.beginPath(),
|
|
1003
|
+
const s = a.paraTela(i.caixaSelecao.de), n = a.paraTela(i.caixaSelecao.ate);
|
|
1004
|
+
t.beginPath(), z(t, [s, [n[0], s[1]], n, [s[0], n[1]]]), t.setLineDash(i.caixaSelecao.crossing ? [5, 3] : []), t.strokeStyle = r.selecao, t.stroke(), t.setLineDash([]);
|
|
1005
1005
|
}
|
|
1006
1006
|
if (i.snap) {
|
|
1007
|
-
const s =
|
|
1008
|
-
t.beginPath(),
|
|
1007
|
+
const s = a.paraTela(i.snap.coordenada);
|
|
1008
|
+
t.beginPath(), z(t, [[s[0] - 5, s[1] - 5], [s[0] + 5, s[1] - 5], [s[0] + 5, s[1] + 5], [s[0] - 5, s[1] + 5]]), t.strokeStyle = r.snap, t.stroke(), ba(t, i.snap.tipo, [s[0] + 8, s[1] - 8], r.snap);
|
|
1009
1009
|
}
|
|
1010
1010
|
if (i.rotulo) {
|
|
1011
|
-
const s =
|
|
1012
|
-
|
|
1011
|
+
const s = a.paraTela(i.rotulo.em);
|
|
1012
|
+
ba(t, i.rotulo.texto, [s[0] + 12, s[1] + 18], r.selecao);
|
|
1013
1013
|
}
|
|
1014
1014
|
t.restore();
|
|
1015
1015
|
}
|
|
1016
|
-
const
|
|
1017
|
-
function
|
|
1018
|
-
const
|
|
1019
|
-
return
|
|
1016
|
+
const oi = 14;
|
|
1017
|
+
function Le(t) {
|
|
1018
|
+
const e = t.doc.elementosSelecionados();
|
|
1019
|
+
return e.length !== 1 || t.ferramenta !== "selecao" || t.somenteLeitura ? null : Kt(t.ui.substitutos.get(e[0].id) ?? e[0], oi / t.vista.zoom);
|
|
1020
1020
|
}
|
|
1021
|
-
const
|
|
1022
|
-
function
|
|
1023
|
-
const r = t.doc.elementosSelecionados(), i = r.length > 0 ?
|
|
1021
|
+
const L = (t, e) => Math.hypot(t[0] - e[0], t[1] - e[1]);
|
|
1022
|
+
function Va(t, e, a) {
|
|
1023
|
+
const r = t.doc.elementosSelecionados(), i = r.length > 0 ? Ea(r) : null;
|
|
1024
1024
|
if (!i) return null;
|
|
1025
|
-
const o =
|
|
1025
|
+
const o = a ? 19 : 6, s = t.vista, n = fe(i, Re / s.zoom), l = Le(t);
|
|
1026
1026
|
if (l) {
|
|
1027
|
-
const c = l.findIndex((d) =>
|
|
1027
|
+
const c = l.findIndex((d) => L(s.paraTela(d), e) <= o);
|
|
1028
1028
|
if (c >= 0) return { tipo: "canto", canto: c };
|
|
1029
1029
|
}
|
|
1030
|
-
if (
|
|
1031
|
-
if (
|
|
1032
|
-
for (const c of
|
|
1030
|
+
if (L(s.paraTela(t.ui.pivo ?? n.centro), e) <= o) return { tipo: "pivo" };
|
|
1031
|
+
if (L(s.paraTela(n.rotacao), e) <= o) return { tipo: "rotacao" };
|
|
1032
|
+
for (const c of kt) if (L(s.paraTela(n.alcas[c]), e) <= o) return { tipo: "escala", alca: c };
|
|
1033
1033
|
return null;
|
|
1034
1034
|
}
|
|
1035
|
-
function
|
|
1036
|
-
const i = t.doc.elementosSelecionados().filter((n) => !n.bloqueado), o =
|
|
1035
|
+
function si(t, e, a, r) {
|
|
1036
|
+
const i = t.doc.elementosSelecionados().filter((n) => !n.bloqueado), o = Ea(i);
|
|
1037
1037
|
if (!o || i.length === 0) return null;
|
|
1038
|
-
if (
|
|
1039
|
-
if (
|
|
1040
|
-
const n = i[0], l =
|
|
1041
|
-
return i.length !== 1 || !l || c === null ? null : { tipo: "canto", original: n, indice:
|
|
1038
|
+
if (e.tipo === "pivo") return { tipo: "pivo" };
|
|
1039
|
+
if (e.tipo === "canto") {
|
|
1040
|
+
const n = i[0], l = pe(n), c = ge(n, e.canto ?? 0, a);
|
|
1041
|
+
return i.length !== 1 || !l || c === null ? null : { tipo: "canto", original: n, indice: e.canto ?? 0, raio0: l[e.canto ?? 0], profundidade0: c };
|
|
1042
1042
|
}
|
|
1043
|
-
if (
|
|
1044
|
-
const s =
|
|
1043
|
+
if (e.tipo === "rotacao") return { tipo: "rotacao", pivo: ma(t) ?? a, inicio: a, originais: i };
|
|
1044
|
+
const s = e.alca;
|
|
1045
1045
|
return r.ctrl && (s === "n" || s === "s" || s === "e" || s === "o") ? { tipo: "cisalhamento", caixa: o, alca: s, originais: i } : { tipo: "escala", caixa: o, alca: s, originais: i };
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1048
|
-
const r = 50 / t.vista.zoom, i = t.doc.indice.consultarCaixa(
|
|
1047
|
+
function ni(t, e, a) {
|
|
1048
|
+
const r = 50 / t.vista.zoom, i = t.doc.indice.consultarCaixa(e, r).filter((s) => !a.has(s.id) && !s.oculto), o = [{ x: 0, y: 0, largura: t.folha.largura, altura: t.folha.altura }];
|
|
1049
1049
|
for (const s of i.slice(0, 200)) {
|
|
1050
|
-
const n =
|
|
1050
|
+
const n = Y(s);
|
|
1051
1051
|
n && o.push(n);
|
|
1052
1052
|
}
|
|
1053
1053
|
return o;
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1056
|
-
let
|
|
1055
|
+
function li(t) {
|
|
1056
|
+
let e = 1 / 0, a = 1 / 0, r = -1 / 0, i = -1 / 0;
|
|
1057
1057
|
for (const o of t) {
|
|
1058
|
-
const s =
|
|
1059
|
-
s && (
|
|
1058
|
+
const s = Wt(o);
|
|
1059
|
+
s && (e = Math.min(e, s.x), a = Math.min(a, s.y), r = Math.max(r, s.x + s.largura), i = Math.max(i, s.y + s.altura));
|
|
1060
1060
|
}
|
|
1061
|
-
return
|
|
1061
|
+
return e <= r ? { x: e, y: a, largura: r - e, altura: i - a } : null;
|
|
1062
1062
|
}
|
|
1063
|
-
function
|
|
1063
|
+
function ci(t, e, a = !1, r = !1) {
|
|
1064
1064
|
const i = t.doc.elementosSelecionados().filter((n) => !n.bloqueado);
|
|
1065
1065
|
if (i.length === 0) return null;
|
|
1066
|
-
const o = i.length <= 200 ? i.length === 1 ?
|
|
1067
|
-
return { tipo: "mover", inicio: s ? s.coordenada :
|
|
1066
|
+
const o = i.length <= 200 ? i.length === 1 ? Y(i[0]) : li(i) : null, s = t.snapLigado && i.length <= 200 ? se(e, i, t.vista.zoom, { toleranciaPx: t.toleranciaPx(a), meio: !1, aresta: !1 }) : null;
|
|
1067
|
+
return { tipo: "mover", inicio: s ? s.coordenada : e, originais: i, caixa: o, duplicar: r };
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1069
|
+
function ui(t, e, a, r) {
|
|
1070
1070
|
var s, n, l;
|
|
1071
1071
|
const i = t.ui;
|
|
1072
1072
|
i.linhasInteligentes = [], i.snap = null;
|
|
1073
1073
|
let o = [];
|
|
1074
|
-
switch (
|
|
1074
|
+
switch (e.tipo) {
|
|
1075
1075
|
case "pivo":
|
|
1076
|
-
i.pivo = t.snapPonto(
|
|
1076
|
+
i.pivo = t.snapPonto(a, { toque: r.toque, desligado: r.alt }).ponto;
|
|
1077
1077
|
break;
|
|
1078
1078
|
case "mover": {
|
|
1079
|
-
let c =
|
|
1079
|
+
let c = a[0] - e.inicio[0], d = a[1] - e.inicio[1];
|
|
1080
1080
|
r.shift && (Math.abs(c) >= Math.abs(d) ? d = 0 : c = 0);
|
|
1081
|
-
const h = new Set(
|
|
1082
|
-
if ((!r.alt ||
|
|
1083
|
-
const f = t.snapPonto([
|
|
1081
|
+
const h = new Set(e.originais.map((f) => f.id));
|
|
1082
|
+
if ((!r.alt || e.duplicar) && t.snapLigado) {
|
|
1083
|
+
const f = t.snapPonto([e.inicio[0] + c, e.inicio[1] + d], { excluir: h, grade: !1, toque: r.toque });
|
|
1084
1084
|
if (f.resultado)
|
|
1085
|
-
c = f.ponto[0] -
|
|
1086
|
-
else if (
|
|
1087
|
-
const p = { ...
|
|
1085
|
+
c = f.ponto[0] - e.inicio[0], d = f.ponto[1] - e.inicio[1];
|
|
1086
|
+
else if (e.caixa && t.guiasInteligentes) {
|
|
1087
|
+
const p = { ...e.caixa, x: e.caixa.x + c, y: e.caixa.y + d }, v = Vt(p, ni(t, p, h), 6 / t.vista.zoom);
|
|
1088
1088
|
if (c += v.correcao[0], d += v.correcao[1], i.linhasInteligentes = v.linhas, v.linhas.length === 0) {
|
|
1089
|
-
const b = t.snapPonto([
|
|
1090
|
-
((s = b.resultado) == null ? void 0 : s.tipo) === "grade" && (c = b.ponto[0] -
|
|
1089
|
+
const b = t.snapPonto([e.inicio[0] + c, e.inicio[1] + d], { excluir: h, toque: r.toque });
|
|
1090
|
+
((s = b.resultado) == null ? void 0 : s.tipo) === "grade" && (c = b.ponto[0] - e.inicio[0], d = b.ponto[1] - e.inicio[1]);
|
|
1091
1091
|
}
|
|
1092
1092
|
}
|
|
1093
1093
|
}
|
|
1094
|
-
|
|
1094
|
+
e.matriz = k(c, d), o = I(e.originais, e.matriz), e.duplicar && (i.copiasEmGesto = o, o = []);
|
|
1095
1095
|
const u = (f) => Math.round(f * 100) / 100;
|
|
1096
|
-
i.rotulo = { texto: `Δ ${u(c)}, ${u(d)} mm`, em:
|
|
1096
|
+
i.rotulo = { texto: `Δ ${u(c)}, ${u(d)} mm`, em: a };
|
|
1097
1097
|
break;
|
|
1098
1098
|
}
|
|
1099
1099
|
case "escala": {
|
|
1100
|
-
const c = t.snapPonto(
|
|
1101
|
-
d && (
|
|
1100
|
+
const c = t.snapPonto(a, { excluir: e.originais.map((h) => h.id), toque: r.toque }).ponto, d = $t(e.caixa, e.alca, c, { proporcional: r.shift, doCentro: r.alt });
|
|
1101
|
+
d && (e.matriz = d, o = I(e.originais, d));
|
|
1102
1102
|
break;
|
|
1103
1103
|
}
|
|
1104
1104
|
case "cisalhamento": {
|
|
1105
|
-
const c =
|
|
1106
|
-
c && (
|
|
1105
|
+
const c = Ht(e.caixa, e.alca, a);
|
|
1106
|
+
c && (e.matriz = c, o = I(e.originais, c));
|
|
1107
1107
|
break;
|
|
1108
1108
|
}
|
|
1109
1109
|
case "rotacao": {
|
|
1110
|
-
const c =
|
|
1111
|
-
|
|
1110
|
+
const c = Gt(e.pivo, e.inicio, a, r.shift ? Math.PI / 4 : void 0);
|
|
1111
|
+
e.matriz = c.matriz, o = I(e.originais, c.matriz), i.rotulo = { texto: `${Math.round(c.angulo * 180 / Math.PI * 10) / 10}°`, em: a };
|
|
1112
1112
|
break;
|
|
1113
1113
|
}
|
|
1114
1114
|
case "ancora": {
|
|
1115
1115
|
const c = ((n = i.edicao) == null ? void 0 : n.ancoras) ?? [];
|
|
1116
|
-
if (c.length > 1 && c.includes(
|
|
1117
|
-
const d =
|
|
1116
|
+
if (c.length > 1 && c.includes(e.indice)) {
|
|
1117
|
+
const d = le(e.original, c, a[0] - e.inicio[0], a[1] - e.inicio[1]);
|
|
1118
1118
|
d && (o = [d]);
|
|
1119
1119
|
} else {
|
|
1120
|
-
const d = t.snapPonto(
|
|
1120
|
+
const d = t.snapPonto(a, { excluir: [e.original.id], toque: r.toque, desligado: r.alt }).ponto, h = jt(e.original, e.indice, d);
|
|
1121
1121
|
h && (o = [h]);
|
|
1122
1122
|
}
|
|
1123
1123
|
break;
|
|
1124
1124
|
}
|
|
1125
1125
|
case "alca-bezier": {
|
|
1126
|
-
const c =
|
|
1126
|
+
const c = Bt(e.original, e.indice, e.qual, a, !r.alt);
|
|
1127
1127
|
c && (o = [c]);
|
|
1128
1128
|
break;
|
|
1129
1129
|
}
|
|
1130
1130
|
case "canto": {
|
|
1131
|
-
const c =
|
|
1131
|
+
const c = ge(e.original, e.indice, a);
|
|
1132
1132
|
if (c === null) break;
|
|
1133
|
-
const d =
|
|
1133
|
+
const d = qt(e.original, r.alt ? e.indice : null, e.raio0 + c - e.profundidade0);
|
|
1134
1134
|
if (d) {
|
|
1135
1135
|
o = [d];
|
|
1136
|
-
const h = ((l =
|
|
1137
|
-
i.rotulo = { texto: `R ${Math.round(h * 100) / 100} mm`, em:
|
|
1136
|
+
const h = ((l = pe(d)) == null ? void 0 : l[e.indice]) ?? 0;
|
|
1137
|
+
i.rotulo = { texto: `R ${Math.round(h * 100) / 100} mm`, em: a };
|
|
1138
1138
|
}
|
|
1139
1139
|
break;
|
|
1140
1140
|
}
|
|
1141
1141
|
}
|
|
1142
1142
|
i.substitutos = new Map(o.map((c) => [c.id, c])), t.agendar();
|
|
1143
1143
|
}
|
|
1144
|
-
function
|
|
1145
|
-
const
|
|
1146
|
-
if (t.ui.substitutos = /* @__PURE__ */ new Map(), t.ui.copiasEmGesto = [], t.ui.linhasInteligentes = [], t.ui.snap = null, t.ui.rotulo = null,
|
|
1147
|
-
if (
|
|
1148
|
-
const i =
|
|
1149
|
-
|
|
1144
|
+
function di(t, e) {
|
|
1145
|
+
const a = [...t.ui.substitutos.values()];
|
|
1146
|
+
if (t.ui.substitutos = /* @__PURE__ */ new Map(), t.ui.copiasEmGesto = [], t.ui.linhasInteligentes = [], t.ui.snap = null, t.ui.rotulo = null, e.tipo === "mover" && e.duplicar) {
|
|
1147
|
+
if (e.matriz) {
|
|
1148
|
+
const i = I(he(e.originais, t.gerarId), e.matriz);
|
|
1149
|
+
F(t, i, "duplicar"), Ba(t, e.matriz, !0);
|
|
1150
1150
|
}
|
|
1151
1151
|
t.agendar();
|
|
1152
1152
|
return;
|
|
1153
1153
|
}
|
|
1154
|
-
if ((
|
|
1154
|
+
if ((e.tipo === "mover" || e.tipo === "escala" || e.tipo === "rotacao" || e.tipo === "cisalhamento") && e.matriz && a.length > 0 && Ba(t, e.matriz, !1), e.tipo === "pivo" || a.length === 0) {
|
|
1155
1155
|
t.agendar();
|
|
1156
1156
|
return;
|
|
1157
1157
|
}
|
|
1158
|
-
const r =
|
|
1159
|
-
(
|
|
1158
|
+
const r = e.tipo === "mover" ? "mover" : e.tipo === "ancora" || e.tipo === "alca-bezier" ? "editar-ancoras" : e.tipo === "canto" ? "cantos" : "transformar";
|
|
1159
|
+
(e.tipo === "rotacao" || e.tipo === "escala" || e.tipo === "cisalhamento") && t.ui.pivo && e.tipo !== "rotacao" && (t.ui.pivo = null), t.aplicarSubstituicoes(a, r);
|
|
1160
1160
|
}
|
|
1161
|
-
function
|
|
1161
|
+
function Ka(t, e, a) {
|
|
1162
1162
|
const r = t.ui.edicao, i = r ? t.doc.obter(r.id) : void 0;
|
|
1163
1163
|
if (!r || !i) return null;
|
|
1164
|
-
const o =
|
|
1164
|
+
const o = a ? 19 : 6, s = t.vista, n = me(i);
|
|
1165
1165
|
for (const d of r.ancoras) {
|
|
1166
1166
|
const h = n[d];
|
|
1167
|
-
if (h != null && h.saida &&
|
|
1168
|
-
if (h != null && h.entrada &&
|
|
1167
|
+
if (h != null && h.saida && L(s.paraTela(h.saida), e) <= o) return { tipo: "alca", indice: d, qual: "saida" };
|
|
1168
|
+
if (h != null && h.entrada && L(s.paraTela(h.entrada), e) <= o) return { tipo: "alca", indice: d, qual: "entrada" };
|
|
1169
1169
|
}
|
|
1170
|
-
const l =
|
|
1170
|
+
const l = xa(i);
|
|
1171
1171
|
let c = null;
|
|
1172
1172
|
return l.forEach((d, h) => {
|
|
1173
|
-
const u =
|
|
1173
|
+
const u = L(s.paraTela(d), e);
|
|
1174
1174
|
u <= o && (!c || u < c.d) && (c = { indice: h, d: u });
|
|
1175
1175
|
}), c ? { tipo: "ancora", indice: c.indice } : null;
|
|
1176
1176
|
}
|
|
1177
|
-
function
|
|
1177
|
+
function hi(t, e, a) {
|
|
1178
1178
|
const r = t.ui.edicao, i = r ? t.doc.obter(r.id) : void 0;
|
|
1179
1179
|
if (!i) return [];
|
|
1180
|
-
const o = Math.min(
|
|
1181
|
-
return
|
|
1180
|
+
const o = Math.min(e[0], a[0]), s = Math.max(e[0], a[0]), n = Math.min(e[1], a[1]), l = Math.max(e[1], a[1]);
|
|
1181
|
+
return xa(i).map((c, d) => c[0] >= o && c[0] <= s && c[1] >= n && c[1] <= l ? d : -1).filter((c) => c >= 0);
|
|
1182
1182
|
}
|
|
1183
|
-
const
|
|
1184
|
-
function
|
|
1185
|
-
const r =
|
|
1183
|
+
const mi = ["conta-gotas", "adicionar-ancora", "excluir-ancora", "converter-ancora"], fi = (t) => mi.includes(t), ke = (t, e) => (e ? 19 : 8) / t.vista.zoom;
|
|
1184
|
+
function pi(t, e, a) {
|
|
1185
|
+
const r = ke(t, a), i = t.doc.elementosSelecionados(), o = na(e, t.candidatosEm(e, r + 2), { tolerancia: r, camadas: t.camadas });
|
|
1186
1186
|
return o && !i.includes(o) ? [...i, o] : i;
|
|
1187
1187
|
}
|
|
1188
|
-
function
|
|
1189
|
-
const r = t.ferramenta, i =
|
|
1188
|
+
function gi(t, e, a) {
|
|
1189
|
+
const r = t.ferramenta, i = ke(t, a);
|
|
1190
1190
|
if (r === "conta-gotas") {
|
|
1191
|
-
const o =
|
|
1192
|
-
return o ?
|
|
1191
|
+
const o = na(e, t.candidatosEm(e, i + 2), { tolerancia: i, camadas: t.camadas, incluirBloqueados: !0 });
|
|
1192
|
+
return o ? Kr(t, o) : !1;
|
|
1193
1193
|
}
|
|
1194
1194
|
if (t.somenteLeitura)
|
|
1195
1195
|
return t.recusar("editar-ancoras", "somente-leitura"), !1;
|
|
1196
|
-
for (const o of
|
|
1196
|
+
for (const o of pi(t, e, a)) {
|
|
1197
1197
|
if (!t.podeSelecionar(o)) continue;
|
|
1198
1198
|
let s = null;
|
|
1199
1199
|
if (r === "adicionar-ancora") {
|
|
1200
|
-
const n =
|
|
1200
|
+
const n = Ut(o, e, i);
|
|
1201
1201
|
if (n === null) continue;
|
|
1202
|
-
s =
|
|
1202
|
+
s = Xt(o, n, e);
|
|
1203
1203
|
} else {
|
|
1204
|
-
const n =
|
|
1204
|
+
const n = Zt(o, e, i);
|
|
1205
1205
|
if (n === null) continue;
|
|
1206
|
-
if (s = r === "excluir-ancora" ?
|
|
1206
|
+
if (s = r === "excluir-ancora" ? ce(o, n) : Jt(o, n), !s)
|
|
1207
1207
|
return t.recusar(r, r === "excluir-ancora" ? "minimo-de-ancoras" : "tipo-nao-suportado", o.id), !1;
|
|
1208
1208
|
}
|
|
1209
1209
|
return s ? (t.aplicarSubstituicoes([s], "editar-ancoras"), t.doc.selecao.includes(s.id) || t.selecionar([s.id], "substituir", !1), !0) : (t.recusar(r, o.geometria.tipo === "texto" ? "texto-sem-ancoras" : "tipo-nao-suportado", o.id), !1);
|
|
1210
1210
|
}
|
|
1211
1211
|
return !1;
|
|
1212
1212
|
}
|
|
1213
|
-
const
|
|
1214
|
-
class
|
|
1215
|
-
constructor(
|
|
1213
|
+
const vi = 4, Wa = 3;
|
|
1214
|
+
class bi {
|
|
1215
|
+
constructor(e, a, r) {
|
|
1216
1216
|
m(this, "gesto", { tipo: "nenhum" });
|
|
1217
1217
|
/** Espaço segurado (pan temporário). */
|
|
1218
1218
|
m(this, "espaco", !1);
|
|
1219
1219
|
m(this, "ultimoClique", null);
|
|
1220
|
-
this.c =
|
|
1220
|
+
this.c = e, this.viewport = a, this.ferramentas = r;
|
|
1221
1221
|
}
|
|
1222
|
-
conectar(
|
|
1223
|
-
|
|
1222
|
+
conectar(e, a, r) {
|
|
1223
|
+
e.add(this.viewport, "pointerdown", (i) => this.pressionar(i)), e.add(this.viewport, "pointermove", (i) => this.mover(i)), e.add(this.viewport, "pointerup", (i) => this.soltar(i)), e.add(this.viewport, "pointercancel", () => this.cancelar()), e.add(this.viewport, "pointerleave", () => this.sair()), e.add(this.viewport, "wheel", (i) => this.roda(i), { passive: !1 }), e.add(this.viewport, "contextmenu", (i) => {
|
|
1224
1224
|
this.ferramentas.emAndamento && i.preventDefault();
|
|
1225
|
-
}),
|
|
1225
|
+
}), e.add(a, "pointerdown", (i) => this.puxarGuia(i, "horizontal")), e.add(r, "pointerdown", (i) => this.puxarGuia(i, "vertical"));
|
|
1226
1226
|
}
|
|
1227
1227
|
get ocupado() {
|
|
1228
1228
|
return this.gesto.tipo !== "nenhum" || this.ferramentas.emAndamento;
|
|
1229
1229
|
}
|
|
1230
|
-
local(
|
|
1230
|
+
local(e) {
|
|
1231
1231
|
var r, i;
|
|
1232
|
-
const
|
|
1233
|
-
return [
|
|
1232
|
+
const a = (i = (r = this.viewport).getBoundingClientRect) == null ? void 0 : i.call(r);
|
|
1233
|
+
return [e.clientX - ((a == null ? void 0 : a.left) ?? 0), e.clientY - ((a == null ? void 0 : a.top) ?? 0)];
|
|
1234
1234
|
}
|
|
1235
|
-
mod(
|
|
1236
|
-
return { shift:
|
|
1235
|
+
mod(e) {
|
|
1236
|
+
return { shift: e.shiftKey, alt: e.altKey, ctrl: e.ctrlKey || e.metaKey, toque: e.pointerType === "touch" };
|
|
1237
1237
|
}
|
|
1238
|
-
capturar(
|
|
1239
|
-
var
|
|
1238
|
+
capturar(e) {
|
|
1239
|
+
var a, r;
|
|
1240
1240
|
try {
|
|
1241
|
-
(r = (
|
|
1241
|
+
(r = (a = this.viewport).setPointerCapture) == null || r.call(a, e.pointerId);
|
|
1242
1242
|
} catch {
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
1245
|
-
cursor(
|
|
1246
|
-
this.viewport.dataset.cursor !==
|
|
1245
|
+
cursor(e) {
|
|
1246
|
+
this.viewport.dataset.cursor !== e && (this.viewport.dataset.cursor = e);
|
|
1247
1247
|
}
|
|
1248
|
-
guiaSob(
|
|
1249
|
-
const
|
|
1248
|
+
guiaSob(e) {
|
|
1249
|
+
const a = this.c.vista;
|
|
1250
1250
|
for (let r = this.c.guias.length - 1; r >= 0; r--) {
|
|
1251
1251
|
const i = this.c.guias[r];
|
|
1252
|
-
if ((i.orientacao === "horizontal" ? Math.abs(
|
|
1252
|
+
if ((i.orientacao === "horizontal" ? Math.abs(a.paraTela([0, i.posicao])[1] - e[1]) : Math.abs(a.paraTela([i.posicao, 0])[0] - e[0])) <= vi) return r;
|
|
1253
1253
|
}
|
|
1254
1254
|
return null;
|
|
1255
1255
|
}
|
|
1256
|
-
pressionar(
|
|
1257
|
-
if (
|
|
1256
|
+
pressionar(e) {
|
|
1257
|
+
if (e.button === 2) return;
|
|
1258
1258
|
try {
|
|
1259
1259
|
this.viewport.focus({ preventScroll: !0 });
|
|
1260
1260
|
} catch {
|
|
1261
1261
|
}
|
|
1262
|
-
const
|
|
1263
|
-
if (this.capturar(
|
|
1264
|
-
this.gesto = { tipo: "pan", inicioPx:
|
|
1262
|
+
const a = this.local(e), r = this.c.vista.paraFolha(a[0], a[1]), i = this.mod(e), o = this.c.ferramenta;
|
|
1263
|
+
if (this.capturar(e), e.button === 1 || this.espaco || o === "mao") {
|
|
1264
|
+
this.gesto = { tipo: "pan", inicioPx: a, panInicial: [...this.c.vista.pan] }, this.cursor("arrastando");
|
|
1265
1265
|
return;
|
|
1266
1266
|
}
|
|
1267
|
-
if (
|
|
1268
|
-
|
|
1267
|
+
if (fi(o)) {
|
|
1268
|
+
gi(this.c, r, i.toque);
|
|
1269
1269
|
return;
|
|
1270
1270
|
}
|
|
1271
|
-
if (
|
|
1271
|
+
if (ca(o)) {
|
|
1272
1272
|
if (this.c.somenteLeitura) {
|
|
1273
1273
|
this.c.recusar("desenhar", "somente-leitura");
|
|
1274
1274
|
return;
|
|
1275
1275
|
}
|
|
1276
|
-
this.gesto = { tipo: "desenho" }, this.ferramentas.pressionar(r,
|
|
1276
|
+
this.gesto = { tipo: "desenho" }, this.ferramentas.pressionar(r, a, i);
|
|
1277
1277
|
return;
|
|
1278
1278
|
}
|
|
1279
|
-
const s = Date.now(), n = !i.shift && !!this.ultimoClique && s - this.ultimoClique.t <= 400 && Math.hypot(
|
|
1280
|
-
if (this.ultimoClique = n ? null : { t: s, x:
|
|
1281
|
-
const u =
|
|
1279
|
+
const s = Date.now(), n = !i.shift && !!this.ultimoClique && s - this.ultimoClique.t <= 400 && Math.hypot(a[0] - this.ultimoClique.x, a[1] - this.ultimoClique.y) <= 4;
|
|
1280
|
+
if (this.ultimoClique = n ? null : { t: s, x: a[0], y: a[1] }, o === "selecao-direta" && this.c.ui.edicao) {
|
|
1281
|
+
const u = Ka(this.c, a, i.toque), f = this.c.doc.obter(this.c.ui.edicao.id);
|
|
1282
1282
|
if (u && f && !this.c.somenteLeitura) {
|
|
1283
1283
|
const p = this.c.ui.edicao;
|
|
1284
|
-
u.tipo === "alca" ? this.gesto = { tipo: "selecao", gesto: { tipo: "alca-bezier", original: f, indice: u.indice, qual: u.qual }, inicioPx:
|
|
1284
|
+
u.tipo === "alca" ? this.gesto = { tipo: "selecao", gesto: { tipo: "alca-bezier", original: f, indice: u.indice, qual: u.qual }, inicioPx: a, moveu: !1 } : (i.shift ? p.ancoras = p.ancoras.includes(u.indice) ? p.ancoras.filter((v) => v !== u.indice) : [...p.ancoras, u.indice] : p.ancoras.includes(u.indice) || (p.ancoras = [u.indice]), this.gesto = { tipo: "selecao", gesto: { tipo: "ancora", original: f, indice: u.indice, inicio: r }, inicioPx: a, moveu: !1 }), this.c.agendar();
|
|
1285
1285
|
return;
|
|
1286
1286
|
}
|
|
1287
1287
|
}
|
|
1288
1288
|
if (o === "selecao" && !this.c.somenteLeitura) {
|
|
1289
|
-
const u =
|
|
1289
|
+
const u = Va(this.c, a, i.toque);
|
|
1290
1290
|
if (u) {
|
|
1291
|
-
const f =
|
|
1291
|
+
const f = si(this.c, u, r, i);
|
|
1292
1292
|
if (f) {
|
|
1293
|
-
this.gesto = { tipo: "selecao", gesto: f, inicioPx:
|
|
1293
|
+
this.gesto = { tipo: "selecao", gesto: f, inicioPx: a, moveu: !1 };
|
|
1294
1294
|
return;
|
|
1295
1295
|
}
|
|
1296
1296
|
}
|
|
1297
1297
|
}
|
|
1298
|
-
const l = (i.toque ? 12 : 4) / this.c.vista.zoom, c = this.c.candidatosEm(r, l + 2).filter((u) => this.c.podeSelecionar(u)), d =
|
|
1298
|
+
const l = (i.toque ? 12 : 4) / this.c.vista.zoom, c = this.c.candidatosEm(r, l + 2).filter((u) => this.c.podeSelecionar(u)), d = na(r, c, { tolerancia: l, camadas: this.c.camadas });
|
|
1299
1299
|
if (d) {
|
|
1300
1300
|
if (n && o === "selecao") {
|
|
1301
1301
|
if (d.grupoId && this.c.isolado !== d.grupoId) {
|
|
@@ -1306,35 +1306,35 @@ class si {
|
|
|
1306
1306
|
return;
|
|
1307
1307
|
}
|
|
1308
1308
|
if (o === "selecao-direta" ? this.c.iniciarEdicao(d.id) : i.shift ? this.c.selecionar([d.id], "alternar") : this.c.doc.selecao.includes(d.id) || this.c.selecionar([d.id]), this.c.somenteLeitura || !this.c.doc.selecao.includes(d.id)) return;
|
|
1309
|
-
const u =
|
|
1310
|
-
u && (this.gesto = { tipo: "selecao", gesto: u, inicioPx:
|
|
1309
|
+
const u = ci(this.c, r, i.toque, i.alt && o === "selecao");
|
|
1310
|
+
u && (this.gesto = { tipo: "selecao", gesto: u, inicioPx: a, moveu: !1 });
|
|
1311
1311
|
return;
|
|
1312
1312
|
}
|
|
1313
1313
|
if (n && this.c.isolado) {
|
|
1314
1314
|
this.c.isolar(null);
|
|
1315
1315
|
return;
|
|
1316
1316
|
}
|
|
1317
|
-
const h = o === "selecao" && !this.c.somenteLeitura ? this.guiaSob(
|
|
1317
|
+
const h = o === "selecao" && !this.c.somenteLeitura ? this.guiaSob(a) : null;
|
|
1318
1318
|
if (h !== null) {
|
|
1319
1319
|
this.gesto = { tipo: "guia", indice: h }, this.c.ui.guiaArrastada = { guia: { ...this.c.guias[h] }, indice: h };
|
|
1320
1320
|
return;
|
|
1321
1321
|
}
|
|
1322
|
-
this.gesto = { tipo: "caixa", de: r, dePx:
|
|
1322
|
+
this.gesto = { tipo: "caixa", de: r, dePx: a, aditivo: i.shift, moveu: !1 };
|
|
1323
1323
|
}
|
|
1324
|
-
mover(
|
|
1325
|
-
const
|
|
1324
|
+
mover(e) {
|
|
1325
|
+
const a = this.local(e), r = this.c.vista.paraFolha(a[0], a[1]), i = this.mod(e);
|
|
1326
1326
|
this.c.ui.ponteiro = r, this.c.emitir("prancha-ponteiro", { coordenada: r });
|
|
1327
1327
|
const o = this.gesto;
|
|
1328
1328
|
switch (o.tipo) {
|
|
1329
1329
|
case "pan":
|
|
1330
|
-
this.c.vista.pan = [o.panInicial[0] +
|
|
1330
|
+
this.c.vista.pan = [o.panInicial[0] + a[0] - o.inicioPx[0], o.panInicial[1] + a[1] - o.inicioPx[1]], this.c.emitirVista();
|
|
1331
1331
|
return;
|
|
1332
1332
|
case "desenho":
|
|
1333
|
-
this.ferramentas.mover(r,
|
|
1333
|
+
this.ferramentas.mover(r, a, i);
|
|
1334
1334
|
return;
|
|
1335
1335
|
case "selecao":
|
|
1336
|
-
if (!o.moveu && Math.hypot(
|
|
1337
|
-
o.moveu = !0,
|
|
1336
|
+
if (!o.moveu && Math.hypot(a[0] - o.inicioPx[0], a[1] - o.inicioPx[1]) < Wa) return;
|
|
1337
|
+
o.moveu = !0, ui(this.c, o.gesto, r, i);
|
|
1338
1338
|
return;
|
|
1339
1339
|
case "guia": {
|
|
1340
1340
|
const s = this.c.ui.guiaArrastada;
|
|
@@ -1342,31 +1342,31 @@ class si {
|
|
|
1342
1342
|
return;
|
|
1343
1343
|
}
|
|
1344
1344
|
case "caixa":
|
|
1345
|
-
if (!o.moveu && Math.hypot(
|
|
1345
|
+
if (!o.moveu && Math.hypot(a[0] - o.dePx[0], a[1] - o.dePx[1]) < Wa) return;
|
|
1346
1346
|
o.moveu = !0, this.c.ui.caixaSelecao = { de: o.de, ate: r, crossing: r[0] < o.de[0] }, this.c.agendar();
|
|
1347
1347
|
return;
|
|
1348
1348
|
}
|
|
1349
|
-
if (
|
|
1350
|
-
this.ferramentas.mover(r,
|
|
1349
|
+
if (ca(this.c.ferramenta)) {
|
|
1350
|
+
this.ferramentas.mover(r, a, i), this.cursor("mira");
|
|
1351
1351
|
return;
|
|
1352
1352
|
}
|
|
1353
|
-
this.atualizarHover(r,
|
|
1353
|
+
this.atualizarHover(r, a, i.toque);
|
|
1354
1354
|
}
|
|
1355
|
-
atualizarHover(
|
|
1355
|
+
atualizarHover(e, a, r) {
|
|
1356
1356
|
const i = this.c.ferramenta;
|
|
1357
1357
|
if (i === "mao" || this.espaco) {
|
|
1358
1358
|
this.cursor("mao");
|
|
1359
1359
|
return;
|
|
1360
1360
|
}
|
|
1361
|
-
const o = i === "selecao" ?
|
|
1362
|
-
this.cursor(o ? o.tipo === "rotacao" ? "girar" : "mover" : i === "selecao-direta" &&
|
|
1361
|
+
const o = i === "selecao" ? Va(this.c, a, r) : null, s = 4 / this.c.vista.zoom, n = na(e, this.c.candidatosEm(e, s + 2).filter((c) => this.c.podeSelecionar(c)), { tolerancia: s, camadas: this.c.camadas }), l = (n == null ? void 0 : n.id) ?? null;
|
|
1362
|
+
this.cursor(o ? o.tipo === "rotacao" ? "girar" : "mover" : i === "selecao-direta" && Ka(this.c, a, r) ? "ancora" : n ? "mover" : "padrao"), l !== this.c.ui.hoverId ? (this.c.ui.hoverId = l, this.c.agendar()) : this.c.ui.ponteiro && this.c.agendar();
|
|
1363
1363
|
}
|
|
1364
|
-
soltar(
|
|
1364
|
+
soltar(e) {
|
|
1365
1365
|
var o, s;
|
|
1366
|
-
const
|
|
1366
|
+
const a = this.local(e), r = this.c.vista.paraFolha(a[0], a[1]), i = this.gesto;
|
|
1367
1367
|
this.gesto = { tipo: "nenhum" };
|
|
1368
1368
|
try {
|
|
1369
|
-
(s = (o = this.viewport).releasePointerCapture) == null || s.call(o,
|
|
1369
|
+
(s = (o = this.viewport).releasePointerCapture) == null || s.call(o, e.pointerId);
|
|
1370
1370
|
} catch {
|
|
1371
1371
|
}
|
|
1372
1372
|
switch (i.tipo) {
|
|
@@ -1374,13 +1374,13 @@ class si {
|
|
|
1374
1374
|
this.cursor(this.espaco || this.c.ferramenta === "mao" ? "mao" : "padrao");
|
|
1375
1375
|
return;
|
|
1376
1376
|
case "desenho":
|
|
1377
|
-
this.ferramentas.soltar(r,
|
|
1377
|
+
this.ferramentas.soltar(r, a, this.mod(e));
|
|
1378
1378
|
return;
|
|
1379
1379
|
case "selecao":
|
|
1380
|
-
i.moveu ?
|
|
1380
|
+
i.moveu ? di(this.c, i.gesto) : this.c.agendar();
|
|
1381
1381
|
return;
|
|
1382
1382
|
case "guia":
|
|
1383
|
-
this.soltarGuia(i.indice,
|
|
1383
|
+
this.soltarGuia(i.indice, a);
|
|
1384
1384
|
return;
|
|
1385
1385
|
case "caixa":
|
|
1386
1386
|
this.soltarCaixa(i, r);
|
|
@@ -1389,96 +1389,96 @@ class si {
|
|
|
1389
1389
|
return;
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
|
-
soltarCaixa(
|
|
1393
|
-
if (this.c.ui.caixaSelecao = null, !
|
|
1394
|
-
this.c.ui.edicao && this.c.ferramenta === "selecao-direta" && this.c.encerrarEdicao(),
|
|
1392
|
+
soltarCaixa(e, a) {
|
|
1393
|
+
if (this.c.ui.caixaSelecao = null, !e.moveu) {
|
|
1394
|
+
this.c.ui.edicao && this.c.ferramenta === "selecao-direta" && this.c.encerrarEdicao(), e.aditivo || this.c.selecionar([]), this.c.agendar();
|
|
1395
1395
|
return;
|
|
1396
1396
|
}
|
|
1397
1397
|
if (this.c.ferramenta === "selecao-direta" && this.c.ui.edicao) {
|
|
1398
|
-
this.c.ui.edicao.ancoras =
|
|
1398
|
+
this.c.ui.edicao.ancoras = hi(this.c, e.de, a), this.c.agendar();
|
|
1399
1399
|
return;
|
|
1400
1400
|
}
|
|
1401
|
-
const r = { x: Math.min(
|
|
1402
|
-
this.c.selecionar(s,
|
|
1401
|
+
const r = { x: Math.min(e.de[0], a[0]), y: Math.min(e.de[1], a[1]), largura: Math.abs(a[0] - e.de[0]), altura: Math.abs(a[1] - e.de[1]) }, i = a[0] < e.de[0] ? "crossing" : "window", o = this.c.doc.indice.consultarCaixa(r).filter((n) => this.c.podeSelecionar(n)), s = Qt(r, o, i, { camadas: this.c.camadas }).map((n) => n.id);
|
|
1402
|
+
this.c.selecionar(s, e.aditivo ? "adicionar" : "substituir") || this.c.agendar();
|
|
1403
1403
|
}
|
|
1404
|
-
puxarGuia(
|
|
1405
|
-
if (
|
|
1406
|
-
const r = this.local(
|
|
1407
|
-
this.capturar(
|
|
1404
|
+
puxarGuia(e, a) {
|
|
1405
|
+
if (e.button !== 0 || this.c.somenteLeitura) return;
|
|
1406
|
+
const r = this.local(e), i = this.c.vista.paraFolha(r[0], r[1]);
|
|
1407
|
+
this.capturar(e), this.gesto = { tipo: "guia", indice: null }, this.c.ui.guiaArrastada = { guia: { orientacao: a, posicao: a === "horizontal" ? i[1] : i[0] }, indice: null }, this.c.agendar();
|
|
1408
1408
|
}
|
|
1409
|
-
soltarGuia(
|
|
1409
|
+
soltarGuia(e, a) {
|
|
1410
1410
|
const r = this.c.ui.guiaArrastada;
|
|
1411
1411
|
if (this.c.ui.guiaArrastada = null, !r) return;
|
|
1412
|
-
const i = r.guia.orientacao === "horizontal" ?
|
|
1413
|
-
|
|
1412
|
+
const i = r.guia.orientacao === "horizontal" ? a[1] < 0 : a[0] < 0;
|
|
1413
|
+
e === null ? i || (this.c.guias = [...this.c.guias, r.guia]) : i ? this.c.guias = this.c.guias.filter((o, s) => s !== e) : this.c.guias = this.c.guias.map((o, s) => s === e ? r.guia : o), this.c.emitirGuias();
|
|
1414
1414
|
}
|
|
1415
|
-
roda(
|
|
1416
|
-
|
|
1417
|
-
const
|
|
1418
|
-
if (
|
|
1415
|
+
roda(e) {
|
|
1416
|
+
e.preventDefault();
|
|
1417
|
+
const a = this.local(e), r = e.deltaMode === 1 ? e.deltaY * 16 : e.deltaY;
|
|
1418
|
+
if (e.shiftKey && !e.ctrlKey) {
|
|
1419
1419
|
this.c.vista.deslocar(-r, 0), this.c.emitirVista();
|
|
1420
1420
|
return;
|
|
1421
1421
|
}
|
|
1422
|
-
this.c.vista.zoomRelativo(Math.exp(-r * 15e-4),
|
|
1422
|
+
this.c.vista.zoomRelativo(Math.exp(-r * 15e-4), a) && (this.c.emitirVista(), this.c.anunciar(la(this.c.vista.zoomPercentual)));
|
|
1423
1423
|
}
|
|
1424
1424
|
sair() {
|
|
1425
1425
|
this.gesto.tipo === "nenhum" && (this.c.ui.ponteiro = null, this.c.ui.hoverId = null, this.c.ui.snap = null, this.c.emitir("prancha-ponteiro", { coordenada: null }), this.c.agendar());
|
|
1426
1426
|
}
|
|
1427
1427
|
/** Cancela qualquer gesto (Esc, perda de ponteiro): nada muda no documento. */
|
|
1428
1428
|
cancelar() {
|
|
1429
|
-
this.gesto = { tipo: "nenhum" }, this.ferramentas.cancelar(),
|
|
1429
|
+
this.gesto = { tipo: "nenhum" }, this.ferramentas.cancelar(), V(this.c.ui), this.c.agendar();
|
|
1430
1430
|
}
|
|
1431
1431
|
}
|
|
1432
|
-
function
|
|
1432
|
+
function yi(t, e = 50) {
|
|
1433
1433
|
if (!(t > 0) || !Number.isFinite(t)) return 1;
|
|
1434
|
-
const
|
|
1435
|
-
for (const i of [1, 2, 5, 10]) if (i * r >=
|
|
1434
|
+
const a = e / t, r = 10 ** Math.floor(Math.log10(a));
|
|
1435
|
+
for (const i of [1, 2, 5, 10]) if (i * r >= a) return i * r;
|
|
1436
1436
|
return 10 * r;
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1439
|
-
const { vista:
|
|
1440
|
-
t.save(), t.setTransform(
|
|
1441
|
-
const n = 1 /
|
|
1438
|
+
function Ai(t, e) {
|
|
1439
|
+
const { vista: a, cores: r, comprimento: i, espessura: o } = e, s = e.orientacao === "horizontal";
|
|
1440
|
+
t.save(), t.setTransform(a.dpr, 0, 0, a.dpr, 0, 0), t.globalAlpha = 1, t.fillStyle = r.regua, t.fillRect(0, 0, s ? i : o, s ? o : i);
|
|
1441
|
+
const n = 1 / Yt(1, e.unidade), l = a.zoom * n, c = yi(l), d = c / (c * l >= 100 ? 10 : 5), h = (s ? a.pan[0] : a.pan[1]) + e.deslocamento, u = Math.floor(-h / l / d) * d, f = (i - h) / l;
|
|
1442
1442
|
t.beginPath();
|
|
1443
1443
|
const p = [];
|
|
1444
1444
|
for (let v = u, b = 0; v <= f && b < 5e3; v += d, b++) {
|
|
1445
|
-
const M = Math.round(h + v * l) + 0.5,
|
|
1446
|
-
s ? (t.moveTo(M, o), t.lineTo(M, o -
|
|
1445
|
+
const M = Math.round(h + v * l) + 0.5, C = Math.abs(v / c - Math.round(v / c)) < 1e-6, T = C ? o : o * 0.3;
|
|
1446
|
+
s ? (t.moveTo(M, o), t.lineTo(M, o - T)) : (t.moveTo(o, M), t.lineTo(o - T, M)), C && p.push([String(Math.round(v * 1e3) / 1e3), M]);
|
|
1447
1447
|
}
|
|
1448
1448
|
if (t.strokeStyle = r.textoRegua, t.lineWidth = 1, t.setLineDash([]), t.stroke(), typeof t.fillText == "function") {
|
|
1449
1449
|
t.font = "9px sans-serif", t.fillStyle = r.textoRegua;
|
|
1450
1450
|
for (const [v, b] of p)
|
|
1451
1451
|
s ? t.fillText(v, b + 2, 9) : t.fillText(v, 1, b + 10);
|
|
1452
1452
|
}
|
|
1453
|
-
if (
|
|
1454
|
-
const v =
|
|
1453
|
+
if (e.ponteiro) {
|
|
1454
|
+
const v = a.paraTela(e.ponteiro), b = Math.round((s ? v[0] : v[1]) + e.deslocamento) + 0.5;
|
|
1455
1455
|
t.beginPath(), s ? (t.moveTo(b, 0), t.lineTo(b, o)) : (t.moveTo(0, b), t.lineTo(o, b)), t.strokeStyle = r.selecao, t.stroke();
|
|
1456
1456
|
}
|
|
1457
1457
|
t.restore();
|
|
1458
1458
|
}
|
|
1459
|
-
const
|
|
1460
|
-
var
|
|
1459
|
+
const Ua = (t) => {
|
|
1460
|
+
var e;
|
|
1461
1461
|
try {
|
|
1462
|
-
return ((
|
|
1462
|
+
return ((e = t.getContext) == null ? void 0 : e.call(t, "2d")) ?? null;
|
|
1463
1463
|
} catch {
|
|
1464
1464
|
return null;
|
|
1465
1465
|
}
|
|
1466
1466
|
};
|
|
1467
|
-
class
|
|
1468
|
-
constructor(
|
|
1467
|
+
class Si {
|
|
1468
|
+
constructor(e, a, r) {
|
|
1469
1469
|
m(this, "pedido", null);
|
|
1470
1470
|
m(this, "contextos", /* @__PURE__ */ new Map());
|
|
1471
1471
|
m(this, "ultimaBase", { elementos: null, texto: "" });
|
|
1472
1472
|
m(this, "quadros", 0);
|
|
1473
1473
|
m(this, "pinturasBase", 0);
|
|
1474
|
-
this.c =
|
|
1474
|
+
this.c = e, this.cv = a, this.fabrica = r;
|
|
1475
1475
|
}
|
|
1476
1476
|
/** Esquece os contextos (a fábrica mudou) e força a próxima pintura da base. */
|
|
1477
1477
|
reiniciar() {
|
|
1478
1478
|
this.contextos.clear(), this.ultimaBase = { elementos: null, texto: "" };
|
|
1479
1479
|
}
|
|
1480
|
-
ctx(
|
|
1481
|
-
return this.contextos.has(
|
|
1480
|
+
ctx(e, a) {
|
|
1481
|
+
return this.contextos.has(e) || this.contextos.set(e, this.fabrica()(a, e)), this.contextos.get(e) ?? null;
|
|
1482
1482
|
}
|
|
1483
1483
|
agendar() {
|
|
1484
1484
|
this.pedido || (typeof requestAnimationFrame == "function" ? this.pedido = { tipo: "raf", id: requestAnimationFrame(() => {
|
|
@@ -1490,43 +1490,43 @@ class ci {
|
|
|
1490
1490
|
cancelar() {
|
|
1491
1491
|
this.pedido && (this.pedido.tipo === "raf" && typeof cancelAnimationFrame == "function" ? cancelAnimationFrame(this.pedido.id) : clearTimeout(this.pedido.id), this.pedido = null);
|
|
1492
1492
|
}
|
|
1493
|
-
ajustar(
|
|
1494
|
-
const o = Math.max(0, Math.round(
|
|
1495
|
-
return
|
|
1493
|
+
ajustar(e, a, r, i) {
|
|
1494
|
+
const o = Math.max(0, Math.round(a * i)), s = Math.max(0, Math.round(r * i));
|
|
1495
|
+
return e.width === o && e.height === s ? !1 : (e.width = o, e.height = s, !0);
|
|
1496
1496
|
}
|
|
1497
1497
|
/** Mede a área de desenho; devolve se o tamanho mudou. */
|
|
1498
1498
|
medir() {
|
|
1499
|
-
const
|
|
1500
|
-
|
|
1501
|
-
const i = r !== `${
|
|
1499
|
+
const e = this.c.vista, a = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, r = `${e.largura}x${e.altura}@${e.dpr}`;
|
|
1500
|
+
e.redimensionar(this.cv.viewport.clientWidth || 0, this.cv.viewport.clientHeight || 0, a);
|
|
1501
|
+
const i = r !== `${e.largura}x${e.altura}@${e.dpr}`;
|
|
1502
1502
|
return i && (this.ultimaBase = { elementos: null, texto: "" }), i;
|
|
1503
1503
|
}
|
|
1504
1504
|
/** Pinta agora (o que estiver agendado é descartado). */
|
|
1505
1505
|
pintar() {
|
|
1506
1506
|
this.cancelar(), this.quadros++;
|
|
1507
|
-
const
|
|
1508
|
-
if (
|
|
1509
|
-
const r = this.ajustar(this.cv.base,
|
|
1510
|
-
this.ajustar(this.cv.sobreposicao,
|
|
1511
|
-
const i =
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
Object.values(
|
|
1522
|
-
JSON.stringify(
|
|
1523
|
-
|
|
1524
|
-
JSON.stringify(
|
|
1507
|
+
const e = this.c, a = e.vista;
|
|
1508
|
+
if (a.largura <= 0 || a.altura <= 0) return;
|
|
1509
|
+
const r = this.ajustar(this.cv.base, a.largura, a.altura, a.dpr);
|
|
1510
|
+
this.ajustar(this.cv.sobreposicao, a.largura, a.altura, a.dpr);
|
|
1511
|
+
const i = e.elementosVisiveis(), o = [
|
|
1512
|
+
a.zoom,
|
|
1513
|
+
a.pan[0],
|
|
1514
|
+
a.pan[1],
|
|
1515
|
+
a.largura,
|
|
1516
|
+
a.altura,
|
|
1517
|
+
a.dpr,
|
|
1518
|
+
e.folha.largura,
|
|
1519
|
+
e.folha.altura,
|
|
1520
|
+
e.mostrarGrade ? e.grade : 0,
|
|
1521
|
+
Object.values(e.cores).join(),
|
|
1522
|
+
JSON.stringify(e.camadas),
|
|
1523
|
+
e.isolado ?? "",
|
|
1524
|
+
JSON.stringify(e.margens)
|
|
1525
1525
|
].join("|"), s = this.ctx("base", this.cv.base);
|
|
1526
1526
|
if (s && (r || i !== this.ultimaBase.elementos || o !== this.ultimaBase.texto)) {
|
|
1527
1527
|
try {
|
|
1528
|
-
const l =
|
|
1529
|
-
|
|
1528
|
+
const l = e.isolado ? i.filter((c) => c.grupoId === e.isolado) : null;
|
|
1529
|
+
ri(s, { vista: a, folha: e.folha, cores: e.cores, elementos: i, grade: e.mostrarGrade ? e.grade : null, camadas: e.camadas, isolados: l, margens: e.margens ? ve(e.folha.largura, e.folha.altura, e.margens) : null }), this.pinturasBase++;
|
|
1530
1530
|
} catch {
|
|
1531
1531
|
}
|
|
1532
1532
|
this.ultimaBase = { elementos: i, texto: o };
|
|
@@ -1534,33 +1534,33 @@ class ci {
|
|
|
1534
1534
|
const n = this.ctx("sobreposicao", this.cv.sobreposicao);
|
|
1535
1535
|
if (n)
|
|
1536
1536
|
try {
|
|
1537
|
-
const l =
|
|
1538
|
-
|
|
1537
|
+
const l = e.ui.hoverId ? e.doc.obter(e.ui.hoverId) ?? null : null, c = e.doc.elementosSelecionados().map((d) => e.ui.substitutos.get(d.id) ?? d);
|
|
1538
|
+
ii(n, { vista: a, cores: e.cores, ui: e.ui, selecionados: c, emGesto: e.elementosEmGesto(), hover: l, guias: e.guias, caixaTransformacao: e.ferramenta === "selecao", marcasCantos: Le(e) });
|
|
1539
1539
|
} catch {
|
|
1540
1540
|
}
|
|
1541
1541
|
this.pintarReguas();
|
|
1542
1542
|
}
|
|
1543
1543
|
pintarReguas() {
|
|
1544
|
-
const
|
|
1545
|
-
for (const [
|
|
1544
|
+
const e = this.c;
|
|
1545
|
+
for (const [a, r, i] of [["regua-horizontal", this.cv.reguaH, "horizontal"], ["regua-vertical", this.cv.reguaV, "vertical"]]) {
|
|
1546
1546
|
const o = i === "horizontal" ? r.clientWidth : r.clientHeight, s = i === "horizontal" ? r.clientHeight : r.clientWidth;
|
|
1547
1547
|
if (!(o > 0 && s > 0)) continue;
|
|
1548
|
-
this.ajustar(r, i === "horizontal" ? o : s, i === "horizontal" ? s : o,
|
|
1549
|
-
const n = this.ctx(
|
|
1548
|
+
this.ajustar(r, i === "horizontal" ? o : s, i === "horizontal" ? s : o, e.vista.dpr);
|
|
1549
|
+
const n = this.ctx(a, r);
|
|
1550
1550
|
if (n)
|
|
1551
1551
|
try {
|
|
1552
|
-
|
|
1552
|
+
Ai(n, { orientacao: i, vista: e.vista, unidade: e.unidade, comprimento: o, espessura: s, cores: e.cores, ponteiro: e.ui.ponteiro, deslocamento: 0 });
|
|
1553
1553
|
} catch {
|
|
1554
1554
|
}
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
1558
|
-
function
|
|
1559
|
-
if (
|
|
1558
|
+
function q(t, e) {
|
|
1559
|
+
if (!ar.includes(e))
|
|
1560
1560
|
return t.recusar("pathfinder", "comando-desconhecido"), !1;
|
|
1561
|
-
const
|
|
1562
|
-
if (!
|
|
1563
|
-
const r =
|
|
1561
|
+
const a = y(t, "pathfinder", 2);
|
|
1562
|
+
if (!a) return !1;
|
|
1563
|
+
const r = er(U(a, t.camadas), e);
|
|
1564
1564
|
if (!("ok" in r)) {
|
|
1565
1565
|
const n = r.motivo === "sem-intersecao" || r.motivo === "resultado-vazio";
|
|
1566
1566
|
return t.recusar("pathfinder", n ? "resultado-vazio" : "tipo-nao-suportado"), !1;
|
|
@@ -1568,26 +1568,54 @@ function L(t, a) {
|
|
|
1568
1568
|
const { resultado: i, usados: o } = r.ok, s = new Set(o.filter((n) => n !== i.id));
|
|
1569
1569
|
return t.aplicar(t.doc.elementos.filter((n) => !s.has(n.id)).map((n) => n.id === i.id ? i : n), "pathfinder"), t.selecionar([i.id]), !0;
|
|
1570
1570
|
}
|
|
1571
|
-
const
|
|
1572
|
-
function
|
|
1573
|
-
|
|
1571
|
+
const qe = /* @__PURE__ */ new WeakSet(), Xa = /* @__PURE__ */ new WeakSet(), bo = (t) => !!t && qe.has(t);
|
|
1572
|
+
function Pi(t) {
|
|
1573
|
+
qe.add(t);
|
|
1574
1574
|
}
|
|
1575
|
-
const
|
|
1576
|
-
function
|
|
1575
|
+
const j = (t) => t === "exclusivo" || t === "isolado" || t === "modal" ? t : "local";
|
|
1576
|
+
function Be(t) {
|
|
1577
1577
|
if (!t || typeof t != "object") return !1;
|
|
1578
|
-
const
|
|
1579
|
-
if (
|
|
1578
|
+
const e = typeof t.key == "string" ? t.key : "";
|
|
1579
|
+
if (e === "F5" || e === "F11" || e === "F12" || e === "Tab") return !0;
|
|
1580
1580
|
if (!(t.ctrlKey || t.metaKey) || t.altKey) return !1;
|
|
1581
|
-
const r =
|
|
1581
|
+
const r = e.length === 1 ? e.toLowerCase() : e;
|
|
1582
1582
|
return !!(t.shiftKey && (r === "i" || r === "j") || r === "r" || r === "l" || r === "w" || r === "t" || (r === "+" || r === "=" || r === "-" || r === "0") && !t.defaultPrevented);
|
|
1583
1583
|
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
});
|
|
1584
|
+
const je = ["keydown", "keyup", "keypress"];
|
|
1585
|
+
function Mi(t, e) {
|
|
1586
|
+
const a = typeof t.composedPath == "function" ? t.composedPath() : [];
|
|
1587
|
+
return a.includes(e) ? !0 : a.length === 0 && typeof Node < "u" && e instanceof Node && t.target instanceof Node && e.contains(t.target);
|
|
1589
1588
|
}
|
|
1590
|
-
|
|
1589
|
+
function zi(t, e) {
|
|
1590
|
+
if (typeof Node > "u" || !(t instanceof Node)) return !1;
|
|
1591
|
+
let a = e;
|
|
1592
|
+
for (; a; ) {
|
|
1593
|
+
if (a === t) return !0;
|
|
1594
|
+
a = a.parentNode ?? (typeof ShadowRoot < "u" && a instanceof ShadowRoot ? a.host : null);
|
|
1595
|
+
}
|
|
1596
|
+
return !1;
|
|
1597
|
+
}
|
|
1598
|
+
function xi(t, e) {
|
|
1599
|
+
if (be(t)) return !0;
|
|
1600
|
+
const a = br();
|
|
1601
|
+
return !!a && yr(a) && !zi(e, a);
|
|
1602
|
+
}
|
|
1603
|
+
function Ge(t, e, a) {
|
|
1604
|
+
if (!(!t || !e || typeof a != "function"))
|
|
1605
|
+
for (const r of je)
|
|
1606
|
+
t.add(e, r, (i) => {
|
|
1607
|
+
a() && !Be(i) && i.stopPropagation();
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
function He(t, e, a) {
|
|
1611
|
+
if (!(typeof window > "u" || !t || !e || typeof a != "function"))
|
|
1612
|
+
for (const r of je)
|
|
1613
|
+
t.add(window, r, (i) => {
|
|
1614
|
+
var o;
|
|
1615
|
+
!i || !a() || Mi(i, e) || Be(i) || xi(i, e) || (o = i.stopPropagation) == null || o.call(i);
|
|
1616
|
+
}, { capture: !0 });
|
|
1617
|
+
}
|
|
1618
|
+
const Za = { Digit1: "uniao", Digit2: "subtracao", Digit3: "intersecao", Digit4: "exclusao" }, Ja = {
|
|
1591
1619
|
v: "selecao",
|
|
1592
1620
|
a: "selecao-direta",
|
|
1593
1621
|
h: "mao",
|
|
@@ -1597,46 +1625,46 @@ const Ua = { Digit1: "uniao", Digit2: "subtracao", Digit3: "intersecao", Digit4:
|
|
|
1597
1625
|
"\\": "linha",
|
|
1598
1626
|
t: "texto"
|
|
1599
1627
|
};
|
|
1600
|
-
function
|
|
1601
|
-
if (r.defaultPrevented ||
|
|
1628
|
+
function Ei(t, e, a, r) {
|
|
1629
|
+
if (r.defaultPrevented || be(r)) return !1;
|
|
1602
1630
|
const i = r.key, o = r.ctrlKey || r.metaKey, s = i.length === 1 ? i.toLowerCase() : i;
|
|
1603
1631
|
if (i === " " && !o)
|
|
1604
|
-
return
|
|
1605
|
-
if (
|
|
1632
|
+
return Ra(r) ? !1 : (e.espaco || (e.espaco = !0, t.agendar()), !0);
|
|
1633
|
+
if (e.ferramentas.tecla(i)) return !0;
|
|
1606
1634
|
if (o) {
|
|
1607
1635
|
if (r.shiftKey && !r.altKey && (s === "i" || s === "j")) return !1;
|
|
1608
1636
|
const l = r.code ?? "";
|
|
1609
|
-
return r.altKey && r.shiftKey && l in
|
|
1637
|
+
return r.altKey && r.shiftKey && l in Za ? q(t, Za[l]) || !0 : l === "BracketRight" || i === "]" || i === "}" ? O(t, r.shiftKey ? "frente" : "avancar") || !0 : l === "BracketLeft" || i === "[" || i === "{" ? O(t, r.shiftKey ? "tras" : "recuar") || !0 : s === "g" ? (r.shiftKey ? we(t) : Te(t)) || !0 : l === "Digit2" || i === "2" ? (r.altKey ? da(t, "bloqueado") : ua(t, "bloqueado")) || !0 : l === "Digit3" || i === "3" ? (r.altKey ? da(t, "oculto") : ua(t, "oculto")) || !0 : l === "Digit7" || i === "7" ? (r.altKey ? Ne(t) : _e(t)) || !0 : s === "c" && !r.shiftKey ? Da(t) || !0 : s === "x" ? Ie(t) || !0 : s === "v" ? Fe(t, r.shiftKey) || !0 : s === "d" ? De(t) || !0 : s === "j" ? Oe(t) || !0 : s === "z" && !r.shiftKey ? (t.desfazer(), !0) : s === "z" && r.shiftKey || s === "y" ? (t.refazer(), !0) : s === "a" ? (xe(t), !0) : i === "0" ? (a.ajustarFolha(), !0) : i === "1" ? (a.definirZoomPercentual(100), !0) : i === "=" || i === "+" ? (t.vista.zoomRelativo(1.25), t.emitirVista(), t.anunciar(la(t.vista.zoomPercentual)), !0) : i === "-" ? (t.vista.zoomRelativo(0.8), t.emitirVista(), t.anunciar(la(t.vista.zoomPercentual)), !0) : !1;
|
|
1610
1638
|
}
|
|
1611
|
-
if (r.altKey && (i === "=" || i === "+")) return
|
|
1612
|
-
if (r.altKey && i === "-") return
|
|
1639
|
+
if (r.altKey && (i === "=" || i === "+")) return Pa(t, 1.1, 1.1, void 0, "teclado") || !0;
|
|
1640
|
+
if (r.altKey && i === "-") return Pa(t, 0.9, 0.9, void 0, "teclado") || !0;
|
|
1613
1641
|
if (i.startsWith("Arrow")) {
|
|
1614
|
-
if (
|
|
1642
|
+
if (e.ocupado) return !0;
|
|
1615
1643
|
const l = t.passoTeclado * (r.shiftKey ? 10 : 1), c = i === "ArrowLeft" ? -l : i === "ArrowRight" ? l : 0, d = i === "ArrowUp" ? -l : i === "ArrowDown" ? l : 0;
|
|
1616
|
-
if (t.ui.edicao && t.ui.edicao.ancoras.length > 0)
|
|
1617
|
-
else if (t.doc.selecao.length > 0)
|
|
1644
|
+
if (t.ui.edicao && t.ui.edicao.ancoras.length > 0) Nr(t, c, d, "teclado-ancoras");
|
|
1645
|
+
else if (t.doc.selecao.length > 0) Pe(t, c, d, "teclado", "teclado-mover");
|
|
1618
1646
|
else return !1;
|
|
1619
1647
|
return !0;
|
|
1620
1648
|
}
|
|
1621
1649
|
if (i === "Delete" || i === "Backspace") {
|
|
1622
|
-
if (t.ui.edicao && t.ui.edicao.ancoras.length > 0)
|
|
1623
|
-
else if (t.doc.selecao.length > 0)
|
|
1650
|
+
if (t.ui.edicao && t.ui.edicao.ancoras.length > 0) Or(t);
|
|
1651
|
+
else if (t.doc.selecao.length > 0) ze(t);
|
|
1624
1652
|
else return !1;
|
|
1625
1653
|
return !0;
|
|
1626
1654
|
}
|
|
1627
1655
|
if (i === "Escape")
|
|
1628
|
-
return
|
|
1656
|
+
return e.ocupado ? (e.cancelar(), !0) : t.ui.edicao ? (t.encerrarEdicao(), !0) : t.isolado ? (t.isolar(null), !0) : t.doc.selecao.length > 0 ? (t.selecionar([]), !0) : (Xa.has(r) || (Xa.add(r), t.emitir("prancha-esc-sem-efeito", {})), !1);
|
|
1629
1657
|
if (i === "Enter")
|
|
1630
|
-
return
|
|
1631
|
-
if (i === "PageDown" || i === "PageUp") return
|
|
1632
|
-
if (s === "r" && !r.altKey) return
|
|
1658
|
+
return Ra(r) ? !1 : ca(t.ferramenta) ? e.ferramentas.criarNoCentro() || !0 : t.doc.selecao.length === 1 && !t.ui.edicao ? (t.definirFerramenta("selecao-direta"), t.iniciarEdicao(t.doc.selecao[0]) || !0) : !1;
|
|
1659
|
+
if (i === "PageDown" || i === "PageUp") return _r(t, i === "PageDown" ? 1 : -1) || !0;
|
|
1660
|
+
if (s === "r" && !r.altKey) return Me(t, r.shiftKey ? -15 : 15, void 0, "teclado") || !0;
|
|
1633
1661
|
const n = r.altKey ? null : s === "i" && !r.shiftKey ? "conta-gotas" : i === "+" || i === "=" ? "adicionar-ancora" : i === "-" ? "excluir-ancora" : s === "c" && r.shiftKey ? "converter-ancora" : null;
|
|
1634
|
-
return n ? (
|
|
1662
|
+
return n ? (e.ocupado && e.cancelar(), t.definirFerramenta(n), !0) : !r.altKey && !r.shiftKey && Ja[s] ? (e.ocupado && e.cancelar(), t.definirFerramenta(Ja[s]), !0) : !1;
|
|
1635
1663
|
}
|
|
1636
|
-
function
|
|
1637
|
-
|
|
1664
|
+
function Ci(t, e, a) {
|
|
1665
|
+
a.key === " " && e.espaco && (e.espaco = !1, t.agendar());
|
|
1638
1666
|
}
|
|
1639
|
-
const
|
|
1667
|
+
const $e = [
|
|
1640
1668
|
"selecao",
|
|
1641
1669
|
"selecao-direta",
|
|
1642
1670
|
"mao",
|
|
@@ -1656,10 +1684,10 @@ const Re = [
|
|
|
1656
1684
|
"excluir-ancora",
|
|
1657
1685
|
"converter-ancora"
|
|
1658
1686
|
];
|
|
1659
|
-
function
|
|
1660
|
-
return typeof t == "string" &&
|
|
1687
|
+
function Ve(t) {
|
|
1688
|
+
return typeof t == "string" && $e.includes(t);
|
|
1661
1689
|
}
|
|
1662
|
-
const
|
|
1690
|
+
const Ti = "prancha:comando", wi = [
|
|
1663
1691
|
"definirFerramenta",
|
|
1664
1692
|
"selecionarElementos",
|
|
1665
1693
|
"alternarSelecaoElemento",
|
|
@@ -1730,15 +1758,15 @@ const fi = "prancha:comando", pi = [
|
|
|
1730
1758
|
"aplicarPropriedade",
|
|
1731
1759
|
"alterarElementos"
|
|
1732
1760
|
];
|
|
1733
|
-
function
|
|
1734
|
-
return typeof t == "string" &&
|
|
1761
|
+
function Di(t) {
|
|
1762
|
+
return typeof t == "string" && wi.includes(t);
|
|
1735
1763
|
}
|
|
1736
|
-
function
|
|
1737
|
-
return
|
|
1738
|
-
!
|
|
1764
|
+
function Ii(t, e) {
|
|
1765
|
+
return ye.on(Ti, (a) => {
|
|
1766
|
+
!a || typeof a != "object" || a.alvo !== void 0 && a.alvo !== t.id || e(a.comando, Array.isArray(a.args) ? a.args : []);
|
|
1739
1767
|
});
|
|
1740
1768
|
}
|
|
1741
|
-
const
|
|
1769
|
+
const Ke = [
|
|
1742
1770
|
"largura",
|
|
1743
1771
|
"altura",
|
|
1744
1772
|
"unidade",
|
|
@@ -1755,94 +1783,94 @@ const qe = [
|
|
|
1755
1783
|
"teclado",
|
|
1756
1784
|
"ajustar-ao-abrir"
|
|
1757
1785
|
];
|
|
1758
|
-
function
|
|
1786
|
+
function We(t) {
|
|
1759
1787
|
if (!t) return null;
|
|
1760
|
-
const
|
|
1761
|
-
return
|
|
1788
|
+
const e = t.trim().split(/[\s,;]+/).map((a) => parseFloat(a.replace(",", ".")));
|
|
1789
|
+
return e.length !== 1 && e.length !== 4 || !e.every((a) => Number.isFinite(a) && a >= 0 && a <= 1e5) ? null : e.length === 1 ? { esquerda: e[0], direita: e[0], superior: e[0], inferior: e[0] } : { esquerda: e[0], direita: e[1], superior: e[2], inferior: e[3] };
|
|
1762
1790
|
}
|
|
1763
|
-
const
|
|
1791
|
+
const Qa = (t) => t === "conteudo" || t === "nenhum" ? t : "folha", ra = (t, e, a, r) => {
|
|
1764
1792
|
const i = t === null ? NaN : parseFloat(t.replace(",", "."));
|
|
1765
|
-
return Number.isFinite(i) && i >=
|
|
1793
|
+
return Number.isFinite(i) && i >= a && i <= r ? i : e;
|
|
1766
1794
|
};
|
|
1767
|
-
function
|
|
1768
|
-
switch (
|
|
1795
|
+
function Fi(t, e, a) {
|
|
1796
|
+
switch (e) {
|
|
1769
1797
|
case "largura": {
|
|
1770
|
-
const r =
|
|
1798
|
+
const r = ra(a, 210, 1, 1e5), i = r !== t.folha.largura;
|
|
1771
1799
|
return t.folha = { ...t.folha, largura: r }, i;
|
|
1772
1800
|
}
|
|
1773
1801
|
case "altura": {
|
|
1774
|
-
const r =
|
|
1802
|
+
const r = ra(a, 297, 1, 1e5), i = r !== t.folha.altura;
|
|
1775
1803
|
return t.folha = { ...t.folha, altura: r }, i;
|
|
1776
1804
|
}
|
|
1777
1805
|
case "unidade":
|
|
1778
|
-
t.unidade =
|
|
1806
|
+
t.unidade = a && tr(a) ? a : "mm";
|
|
1779
1807
|
break;
|
|
1780
1808
|
case "grade":
|
|
1781
|
-
t.grade =
|
|
1809
|
+
t.grade = ra(a, 10, 0.1, 1e4);
|
|
1782
1810
|
break;
|
|
1783
1811
|
case "mostrar-grade":
|
|
1784
|
-
t.mostrarGrade =
|
|
1812
|
+
t.mostrarGrade = a !== null && a !== "false";
|
|
1785
1813
|
break;
|
|
1786
1814
|
case "sem-snap":
|
|
1787
|
-
t.snapLigado =
|
|
1815
|
+
t.snapLigado = a === null || a === "false";
|
|
1788
1816
|
break;
|
|
1789
1817
|
case "sem-guias-inteligentes":
|
|
1790
|
-
t.guiasInteligentes =
|
|
1818
|
+
t.guiasInteligentes = a === null || a === "false";
|
|
1791
1819
|
break;
|
|
1792
1820
|
case "ferramenta":
|
|
1793
|
-
t.definirFerramenta(
|
|
1821
|
+
t.definirFerramenta(a && Ve(a) ? a : "selecao");
|
|
1794
1822
|
break;
|
|
1795
1823
|
case "somente-leitura":
|
|
1796
|
-
t.somenteLeitura =
|
|
1824
|
+
t.somenteLeitura = a !== null && a !== "false";
|
|
1797
1825
|
break;
|
|
1798
1826
|
case "passo-teclado":
|
|
1799
|
-
t.passoTeclado =
|
|
1827
|
+
t.passoTeclado = ra(a, 1, 1e-3, 1e3);
|
|
1800
1828
|
break;
|
|
1801
1829
|
case "margens":
|
|
1802
|
-
t.margens =
|
|
1830
|
+
t.margens = We(a);
|
|
1803
1831
|
break;
|
|
1804
1832
|
}
|
|
1805
1833
|
return t.agendar(), !1;
|
|
1806
1834
|
}
|
|
1807
|
-
const
|
|
1808
|
-
function
|
|
1809
|
-
let
|
|
1810
|
-
const
|
|
1835
|
+
const Ya = 100, _i = 4e3;
|
|
1836
|
+
function Ni(t) {
|
|
1837
|
+
let e;
|
|
1838
|
+
const a = /* @__PURE__ */ new Map();
|
|
1811
1839
|
return (r, i, o) => {
|
|
1812
1840
|
var l;
|
|
1813
|
-
if (
|
|
1841
|
+
if (e === void 0)
|
|
1814
1842
|
try {
|
|
1815
1843
|
const c = (l = t()) == null ? void 0 : l.getContext("2d");
|
|
1816
|
-
|
|
1844
|
+
e = c && typeof c.measureText == "function" ? c : null;
|
|
1817
1845
|
} catch {
|
|
1818
|
-
|
|
1846
|
+
e = null;
|
|
1819
1847
|
}
|
|
1820
|
-
if (!
|
|
1848
|
+
if (!e) return null;
|
|
1821
1849
|
const s = `${i}\0${r}`;
|
|
1822
|
-
let n =
|
|
1850
|
+
let n = a.get(s);
|
|
1823
1851
|
if (n === void 0) {
|
|
1824
1852
|
try {
|
|
1825
|
-
|
|
1826
|
-
const c =
|
|
1827
|
-
n = Number.isFinite(c) && c >= 0 ? c /
|
|
1853
|
+
e.font = `${Ya}px ${i}`;
|
|
1854
|
+
const c = e.measureText(r).width;
|
|
1855
|
+
n = Number.isFinite(c) && c >= 0 ? c / Ya : null;
|
|
1828
1856
|
} catch {
|
|
1829
1857
|
n = null;
|
|
1830
1858
|
}
|
|
1831
|
-
|
|
1859
|
+
a.size >= _i && a.clear(), a.set(s, n);
|
|
1832
1860
|
}
|
|
1833
1861
|
return n === null ? null : n * o;
|
|
1834
1862
|
};
|
|
1835
1863
|
}
|
|
1836
|
-
function
|
|
1837
|
-
if (
|
|
1838
|
-
const t =
|
|
1839
|
-
return t("M", "sans-serif", 1) === null ? !1 : (
|
|
1864
|
+
function Oi() {
|
|
1865
|
+
if (rr() || typeof document > "u") return !1;
|
|
1866
|
+
const t = Ni(() => document.createElement("canvas"));
|
|
1867
|
+
return t("M", "sans-serif", 1) === null ? !1 : (ir(t), !0);
|
|
1840
1868
|
}
|
|
1841
|
-
class
|
|
1869
|
+
class Ri extends Ae {
|
|
1842
1870
|
constructor() {
|
|
1843
1871
|
super();
|
|
1844
1872
|
m(this, "shadow");
|
|
1845
|
-
m(this, "bag", new
|
|
1873
|
+
m(this, "bag", new Ta());
|
|
1846
1874
|
m(this, "c");
|
|
1847
1875
|
m(this, "interacao");
|
|
1848
1876
|
m(this, "render");
|
|
@@ -1853,7 +1881,7 @@ class Si extends pe {
|
|
|
1853
1881
|
m(this, "ponteiroSobre", !1);
|
|
1854
1882
|
m(this, "focoDentro", !1);
|
|
1855
1883
|
m(this, "enquadrou", !1);
|
|
1856
|
-
m(this, "_fabrica",
|
|
1884
|
+
m(this, "_fabrica", Ua);
|
|
1857
1885
|
m(this, "revisaoSalva", 0);
|
|
1858
1886
|
m(this, "_modificado", !1);
|
|
1859
1887
|
m(this, "conteudoEnquadrado", !1);
|
|
@@ -1861,9 +1889,9 @@ class Si extends pe {
|
|
|
1861
1889
|
m(this, "resolverPronto", null);
|
|
1862
1890
|
m(this, "fimPronto", 0);
|
|
1863
1891
|
m(this, "carregando", !1);
|
|
1864
|
-
this.shadow = this.attachShadow({ mode: "open" }), this.shadow.innerHTML =
|
|
1865
|
-
const
|
|
1866
|
-
this.viewport =
|
|
1892
|
+
this.shadow = this.attachShadow({ mode: "open" }), this.shadow.innerHTML = Pr();
|
|
1893
|
+
const a = (r) => this.shadow.getElementById(r);
|
|
1894
|
+
this.viewport = a("viewport"), this.status = a("status"), this.c = new Ir({
|
|
1867
1895
|
emitir: (r, i, o) => {
|
|
1868
1896
|
const s = new CustomEvent(r, { detail: i, bubbles: !0, composed: !0, cancelable: !!o });
|
|
1869
1897
|
return this.dispatchEvent(s), s.defaultPrevented;
|
|
@@ -1872,23 +1900,26 @@ class Si extends pe {
|
|
|
1872
1900
|
var r;
|
|
1873
1901
|
return (r = this.render) == null ? void 0 : r.agendar();
|
|
1874
1902
|
},
|
|
1875
|
-
anunciar: (r) =>
|
|
1903
|
+
anunciar: (r) => Dr(this.status, r)
|
|
1876
1904
|
}), this._pronto = new Promise((r) => {
|
|
1877
1905
|
this.resolverPronto = r;
|
|
1878
|
-
}), this.c.doc.ouvirMudancas(() => this.avaliarModificado()), this.interacao = new
|
|
1906
|
+
}), this.c.doc.ouvirMudancas(() => this.avaliarModificado()), this.interacao = new bi(this.c, this.viewport, new Gr(this.c)), this.render = new Si(this.c, {
|
|
1879
1907
|
viewport: this.viewport,
|
|
1880
|
-
base:
|
|
1881
|
-
sobreposicao:
|
|
1882
|
-
reguaH:
|
|
1883
|
-
reguaV:
|
|
1908
|
+
base: a("camada-base"),
|
|
1909
|
+
sobreposicao: a("camada-sobreposicao"),
|
|
1910
|
+
reguaH: a("regua-h"),
|
|
1911
|
+
reguaV: a("regua-v")
|
|
1884
1912
|
}, () => this._fabrica);
|
|
1885
1913
|
}
|
|
1886
1914
|
static get observedAttributes() {
|
|
1887
|
-
return
|
|
1915
|
+
return Ke;
|
|
1888
1916
|
}
|
|
1889
1917
|
connectedCallback() {
|
|
1890
|
-
var
|
|
1891
|
-
this.bag.cleanup(), this.interacao.conectar(this.bag, this.shadow.getElementById("regua-h"), this.shadow.getElementById("regua-v")),
|
|
1918
|
+
var a;
|
|
1919
|
+
this.bag.cleanup(), this.interacao.conectar(this.bag, this.shadow.getElementById("regua-h"), this.shadow.getElementById("regua-v")), Ge(this.bag, this, () => {
|
|
1920
|
+
const r = this.modoTeclado();
|
|
1921
|
+
return r === "isolado" || r === "modal";
|
|
1922
|
+
}), He(this.bag, this, () => this.modoTeclado() === "modal" && !this.hospedadaNoEditor()), this.bag.add(this, "pointerenter", () => {
|
|
1892
1923
|
this.ponteiroSobre = !0;
|
|
1893
1924
|
}), this.bag.add(this, "pointerleave", () => {
|
|
1894
1925
|
this.ponteiroSobre = !1;
|
|
@@ -1898,25 +1929,25 @@ class Si extends pe {
|
|
|
1898
1929
|
this.focoDentro = !1;
|
|
1899
1930
|
}), this.bag.add(this.viewport, "keydown", (r) => this.tecla(r, !0)), typeof window < "u" && (this.bag.add(window, "keydown", (r) => {
|
|
1900
1931
|
const i = this.modoTeclado();
|
|
1901
|
-
i === "exclusivo" ? this.tecla(r, !0, !0) : i === "isolado" && this.noEscopoDoTeclado(r) && this.tecla(r, !1, !0);
|
|
1902
|
-
}, { capture: !0 }), this.bag.add(window, "keydown", (r) => this.tecla(r)), this.bag.add(window, "keyup", (r) =>
|
|
1932
|
+
i === "exclusivo" ? this.tecla(r, !0, !0) : (i === "isolado" || i === "modal") && this.noEscopoDoTeclado(r) && this.tecla(r, !1, !0);
|
|
1933
|
+
}, { capture: !0 }), this.bag.add(window, "keydown", (r) => this.tecla(r)), this.bag.add(window, "keyup", (r) => Ci(this.c, this.interacao, r), { capture: !0 }), this.bag.add(window, "blur", () => {
|
|
1903
1934
|
this.interacao.espaco = !1;
|
|
1904
|
-
})), typeof ResizeObserver == "function" && ((
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
],
|
|
1935
|
+
})), typeof ResizeObserver == "function" && ((a = this.observador) == null || a.disconnect(), this.observador = new ResizeObserver(() => this.redimensionar()), this.observador.observe(this.viewport)), this.desligarBus.forEach((r) => r()), this.desligarBus = [
|
|
1936
|
+
Ii(this, (r, i) => this.executarComando(r, i)),
|
|
1937
|
+
ye.on("tema:alterado", () => this.atualizarCores())
|
|
1938
|
+
], Oi() && this.c.doc.indice.definir(this.c.doc.elementos), this.atualizarCores(), this.atualizarRotulo(), this.c.margens = We(this.getAttribute("margens")), this.redimensionar(), this.prepararPronto();
|
|
1908
1939
|
}
|
|
1909
1940
|
disconnectedCallback() {
|
|
1910
|
-
var
|
|
1911
|
-
this.fimPronto && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this.fimPronto), this.fimPronto = 0, this.bag.cleanup(), (
|
|
1941
|
+
var a;
|
|
1942
|
+
this.fimPronto && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this.fimPronto), this.fimPronto = 0, this.bag.cleanup(), (a = this.observador) == null || a.disconnect(), this.observador = null, this.desligarBus.forEach((r) => r()), this.desligarBus = [], this.interacao.cancelar(), this.render.cancelar();
|
|
1912
1943
|
}
|
|
1913
|
-
attributeChangedCallback(
|
|
1914
|
-
if (
|
|
1944
|
+
attributeChangedCallback(a, r, i) {
|
|
1945
|
+
if (a === "rotulo") {
|
|
1915
1946
|
this.atualizarRotulo();
|
|
1916
1947
|
return;
|
|
1917
1948
|
}
|
|
1918
|
-
if (
|
|
1919
|
-
|
|
1949
|
+
if (a === "teclado") return;
|
|
1950
|
+
Fi(this.c, a, i) && !this.enquadrou && this.ajustarFolha();
|
|
1920
1951
|
}
|
|
1921
1952
|
/** Resolve `pronto` quando a área de desenho foi medida; sem layout (teste, aba oculta), dois quadros depois. */
|
|
1922
1953
|
prepararPronto() {
|
|
@@ -1933,36 +1964,40 @@ class Si extends pe {
|
|
|
1933
1964
|
}
|
|
1934
1965
|
}
|
|
1935
1966
|
concluirPronto() {
|
|
1936
|
-
const
|
|
1937
|
-
|
|
1967
|
+
const a = this.resolverPronto;
|
|
1968
|
+
a && (this.resolverPronto = null, a(), this.dispatchEvent(new CustomEvent("prancha-pronta", { bubbles: !0, composed: !0, detail: {} })));
|
|
1938
1969
|
}
|
|
1939
1970
|
atualizarRotulo() {
|
|
1940
1971
|
this.viewport.setAttribute("aria-label", this.getAttribute("rotulo") || "Prancha");
|
|
1941
1972
|
}
|
|
1942
1973
|
atualizarCores() {
|
|
1943
|
-
this.c.cores =
|
|
1974
|
+
this.c.cores = Er(this), this.render.reiniciar(), this.c.agendar();
|
|
1944
1975
|
}
|
|
1945
1976
|
redimensionar() {
|
|
1946
1977
|
if (this.render.medir(), !this.enquadrou && this.c.vista.largura > 0) {
|
|
1947
|
-
const
|
|
1948
|
-
|
|
1978
|
+
const a = Qa(this.getAttribute("ajustar-ao-abrir"));
|
|
1979
|
+
a === "conteudo" && this.c.doc.elementos.length > 0 ? (this.ajustarElementos(), this.conteudoEnquadrado = !0) : a !== "nenhum" && this.c.vista.enquadrar({ x: 0, y: 0, largura: this.c.folha.largura, altura: this.c.folha.altura }), this.enquadrou = !0;
|
|
1949
1980
|
}
|
|
1950
1981
|
this.render.pintar(), this.prepararPronto();
|
|
1951
1982
|
}
|
|
1952
|
-
/** Modo do atributo `teclado`: `local` (padrão), `exclusivo` ou `
|
|
1983
|
+
/** Modo do atributo `teclado`: `local` (padrão), `exclusivo`, `isolado` ou `modal`. */
|
|
1953
1984
|
modoTeclado() {
|
|
1954
|
-
return
|
|
1985
|
+
return j(this.getAttribute("teclado"));
|
|
1986
|
+
}
|
|
1987
|
+
hospedadaNoEditor() {
|
|
1988
|
+
const a = this.getRootNode(), r = a == null ? void 0 : a.host;
|
|
1989
|
+
return !!r && r.localName === "ui-editor-prancha";
|
|
1955
1990
|
}
|
|
1956
1991
|
tecladoExclusivo() {
|
|
1957
1992
|
return this.modoTeclado() === "exclusivo";
|
|
1958
1993
|
}
|
|
1959
1994
|
/** O evento veio de dentro desta prancha ou do editor (outro componente) que a contém? */
|
|
1960
|
-
noEscopoDoTeclado(
|
|
1961
|
-
const r = this.getRootNode().host, i = typeof
|
|
1995
|
+
noEscopoDoTeclado(a) {
|
|
1996
|
+
const r = this.getRootNode().host, i = typeof a.composedPath == "function" ? a.composedPath() : [];
|
|
1962
1997
|
return i.includes(this) || !!r && i.includes(r);
|
|
1963
1998
|
}
|
|
1964
|
-
tecla(
|
|
1965
|
-
!r && !this.focoDentro && !this.ponteiroSobre || !i &&
|
|
1999
|
+
tecla(a, r = !1, i = !1) {
|
|
2000
|
+
!r && !this.focoDentro && !this.ponteiroSobre || !i && a.defaultPrevented && this.tecladoExclusivo() || Ei(this.c, this.interacao, { ajustarFolha: () => this.ajustarFolha(), definirZoomPercentual: (o) => this.definirZoom(o) }, a) && (a.preventDefault(), a.stopPropagation(), i && a.stopImmediatePropagation(), Pi(a));
|
|
1966
2001
|
}
|
|
1967
2002
|
// ---------- modificado, revisão e ciclo de vida ----------
|
|
1968
2003
|
/** O documento mudou desde a carga (`definirElementos`) ou desde `marcarComoSalvo()`. */
|
|
@@ -1979,8 +2014,8 @@ class Si extends pe {
|
|
|
1979
2014
|
}
|
|
1980
2015
|
avaliarModificado() {
|
|
1981
2016
|
if (this.carregando) return;
|
|
1982
|
-
const
|
|
1983
|
-
|
|
2017
|
+
const a = this.c.doc.revisao !== this.revisaoSalva;
|
|
2018
|
+
a !== this._modificado && (this._modificado = a, this.c.emitir("prancha-modificado", { modificado: a, revisao: this.c.doc.revisao }));
|
|
1984
2019
|
}
|
|
1985
2020
|
/**
|
|
1986
2021
|
* Resolve quando a área de desenho foi medida e a prancha consegue enquadrar (ou, sem layout, dois quadros depois da
|
|
@@ -1990,16 +2025,23 @@ class Si extends pe {
|
|
|
1990
2025
|
return this._pronto;
|
|
1991
2026
|
}
|
|
1992
2027
|
/** Dá o foco à área de desenho (o `focus()` do host entrega o foco ao viewport, onde o teclado da prancha escuta). */
|
|
1993
|
-
focus(
|
|
1994
|
-
this.viewport.focus(
|
|
2028
|
+
focus(a) {
|
|
2029
|
+
this.viewport.focus(a);
|
|
1995
2030
|
}
|
|
1996
2031
|
// ---------- propriedades ----------
|
|
2032
|
+
/** Modo do teclado: `local` (padrão), `exclusivo`, `isolado` ou `modal`. */
|
|
2033
|
+
get teclado() {
|
|
2034
|
+
return this.modoTeclado();
|
|
2035
|
+
}
|
|
2036
|
+
set teclado(a) {
|
|
2037
|
+
this.setAttribute("teclado", j(a));
|
|
2038
|
+
}
|
|
1997
2039
|
/** Ferramenta ativa. */
|
|
1998
2040
|
get ferramenta() {
|
|
1999
2041
|
return this.c.ferramenta;
|
|
2000
2042
|
}
|
|
2001
|
-
set ferramenta(
|
|
2002
|
-
this.definirFerramenta(
|
|
2043
|
+
set ferramenta(a) {
|
|
2044
|
+
this.definirFerramenta(a);
|
|
2003
2045
|
}
|
|
2004
2046
|
/** Elementos do documento (na ordem de empilhamento). */
|
|
2005
2047
|
get elementos() {
|
|
@@ -2019,84 +2061,84 @@ class Si extends pe {
|
|
|
2019
2061
|
get gerarId() {
|
|
2020
2062
|
return this.c.gerarId;
|
|
2021
2063
|
}
|
|
2022
|
-
set gerarId(
|
|
2023
|
-
typeof
|
|
2064
|
+
set gerarId(a) {
|
|
2065
|
+
typeof a == "function" && (this.c.gerarId = a);
|
|
2024
2066
|
}
|
|
2025
2067
|
/** Fábrica do contexto 2D de cada canvas (padrão `getContext('2d')`); serve para pintar com um contexto próprio ou de teste. */
|
|
2026
2068
|
get fabricaContexto() {
|
|
2027
2069
|
return this._fabrica;
|
|
2028
2070
|
}
|
|
2029
|
-
set fabricaContexto(
|
|
2030
|
-
this._fabrica = typeof
|
|
2071
|
+
set fabricaContexto(a) {
|
|
2072
|
+
this._fabrica = typeof a == "function" ? a : Ua, this.render.reiniciar(), this.c.agendar();
|
|
2031
2073
|
}
|
|
2032
2074
|
// ---------- dados (sincronização do app: não emite prancha-elemento-*) ----------
|
|
2033
2075
|
/** Carrega o documento (normaliza; recomeça o histórico e a seleção). Devolve os recusados. */
|
|
2034
|
-
definirElementos(
|
|
2076
|
+
definirElementos(a) {
|
|
2035
2077
|
this.carregando = !0;
|
|
2036
2078
|
const r = (() => {
|
|
2037
2079
|
try {
|
|
2038
|
-
return this.c.doc.definir(
|
|
2080
|
+
return this.c.doc.definir(a);
|
|
2039
2081
|
} finally {
|
|
2040
2082
|
this.carregando = !1;
|
|
2041
2083
|
}
|
|
2042
2084
|
})();
|
|
2043
|
-
return this.c.ui.edicao = null, this.c.emitirHistorico(), this.marcarComoSalvo(), !this.conteudoEnquadrado && this.enquadrou &&
|
|
2085
|
+
return this.c.ui.edicao = null, this.c.emitirHistorico(), this.marcarComoSalvo(), !this.conteudoEnquadrado && this.enquadrou && Qa(this.getAttribute("ajustar-ao-abrir")) === "conteudo" && r.elementos.length > 0 && (this.conteudoEnquadrado = !0, this.ajustarElementos()), this.c.agendar(), { aceitos: r.elementos.length, recusados: r.recusados };
|
|
2044
2086
|
}
|
|
2045
2087
|
/** Lote de mudanças do app (adicionar, atualizar, remover) de uma vez. */
|
|
2046
|
-
aplicarLote(
|
|
2047
|
-
const { resultado: i } = this.c.doc.aplicarLote(
|
|
2088
|
+
aplicarLote(a, r = {}) {
|
|
2089
|
+
const { resultado: i } = this.c.doc.aplicarLote(a, r.historico !== !1);
|
|
2048
2090
|
return this.c.emitirHistorico(), this.c.agendar(), i;
|
|
2049
2091
|
}
|
|
2050
|
-
adicionarElemento(
|
|
2051
|
-
return this.aplicarLote({ adicionar: [
|
|
2092
|
+
adicionarElemento(a, r) {
|
|
2093
|
+
return this.aplicarLote({ adicionar: [a] }, r).adicionados.length === 1;
|
|
2052
2094
|
}
|
|
2053
|
-
atualizarElemento(
|
|
2054
|
-
return this.aplicarLote({ atualizar: [
|
|
2095
|
+
atualizarElemento(a, r) {
|
|
2096
|
+
return this.aplicarLote({ atualizar: [a] }, r).atualizados.length === 1;
|
|
2055
2097
|
}
|
|
2056
|
-
removerElemento(
|
|
2057
|
-
return this.aplicarLote({ remover: [
|
|
2098
|
+
removerElemento(a, r) {
|
|
2099
|
+
return this.aplicarLote({ remover: [a] }, r).removidos.length === 1;
|
|
2058
2100
|
}
|
|
2059
2101
|
obterElementos() {
|
|
2060
2102
|
return this.elementos;
|
|
2061
2103
|
}
|
|
2062
|
-
obterElemento(
|
|
2063
|
-
return this.c.doc.obter(
|
|
2104
|
+
obterElemento(a) {
|
|
2105
|
+
return this.c.doc.obter(a) ?? null;
|
|
2064
2106
|
}
|
|
2065
2107
|
/** Troca o id provisório pelo definitivo em tudo (documento, seleção e histórico). */
|
|
2066
|
-
renomearElemento(
|
|
2108
|
+
renomearElemento(a, r) {
|
|
2067
2109
|
var o;
|
|
2068
|
-
const i = this.c.doc.renomear(
|
|
2069
|
-
return i && ((o = this.c.ui.edicao) == null ? void 0 : o.id) ===
|
|
2110
|
+
const i = this.c.doc.renomear(a, r);
|
|
2111
|
+
return i && ((o = this.c.ui.edicao) == null ? void 0 : o.id) === a && (this.c.ui.edicao.id = r), i;
|
|
2070
2112
|
}
|
|
2071
2113
|
// ---------- seleção e ferramentas ----------
|
|
2072
|
-
selecionarElementos(
|
|
2073
|
-
return this.c.selecionar(Array.isArray(
|
|
2114
|
+
selecionarElementos(a) {
|
|
2115
|
+
return this.c.selecionar(Array.isArray(a) ? a : []);
|
|
2074
2116
|
}
|
|
2075
|
-
alternarSelecaoElemento(
|
|
2076
|
-
return this.c.selecionar([
|
|
2117
|
+
alternarSelecaoElemento(a) {
|
|
2118
|
+
return this.c.selecionar([a], "alternar");
|
|
2077
2119
|
}
|
|
2078
2120
|
limparSelecao() {
|
|
2079
2121
|
return this.c.selecionar([]);
|
|
2080
2122
|
}
|
|
2081
2123
|
selecionarTudo() {
|
|
2082
|
-
return
|
|
2124
|
+
return xe(this.c);
|
|
2083
2125
|
}
|
|
2084
2126
|
obterSelecao() {
|
|
2085
2127
|
return this.c.doc.elementosSelecionados();
|
|
2086
2128
|
}
|
|
2087
|
-
definirFerramenta(
|
|
2088
|
-
this.interacao.cancelar(), this.c.definirFerramenta(
|
|
2129
|
+
definirFerramenta(a) {
|
|
2130
|
+
this.interacao.cancelar(), this.c.definirFerramenta(Ve(a) ? a : "selecao");
|
|
2089
2131
|
}
|
|
2090
|
-
definirOpcoesFerramentas(
|
|
2091
|
-
this.c.opcoesFerramentas =
|
|
2132
|
+
definirOpcoesFerramentas(a) {
|
|
2133
|
+
this.c.opcoesFerramentas = a && typeof a == "object" ? { ...a } : {};
|
|
2092
2134
|
}
|
|
2093
2135
|
obterOpcoesFerramentas() {
|
|
2094
2136
|
return { ...this.c.opcoesFerramentas };
|
|
2095
2137
|
}
|
|
2096
2138
|
/** Entra na seleção direta (âncoras) do elemento. */
|
|
2097
|
-
editarAncoras(
|
|
2098
|
-
const r = typeof
|
|
2099
|
-
return r ? r.bloqueado || r.geometria.tipo === "texto" ? this.c.iniciarEdicao(
|
|
2139
|
+
editarAncoras(a) {
|
|
2140
|
+
const r = typeof a == "string" ? this.c.doc.obter(a) : void 0;
|
|
2141
|
+
return r ? r.bloqueado || r.geometria.tipo === "texto" ? this.c.iniciarEdicao(a) : (this.c.definirFerramenta("selecao-direta"), this.c.iniciarEdicao(a)) : (this.c.recusar("editar-ancoras", "id-invalido", typeof a == "string" ? a : void 0), !1);
|
|
2100
2142
|
}
|
|
2101
2143
|
concluirEdicao() {
|
|
2102
2144
|
this.c.encerrarEdicao();
|
|
@@ -2108,48 +2150,48 @@ class Si extends pe {
|
|
|
2108
2150
|
refazer() {
|
|
2109
2151
|
return this.c.refazer();
|
|
2110
2152
|
}
|
|
2111
|
-
moverSelecao(
|
|
2112
|
-
return
|
|
2153
|
+
moverSelecao(a, r) {
|
|
2154
|
+
return Pe(this.c, a, r);
|
|
2113
2155
|
}
|
|
2114
|
-
girarSelecao(
|
|
2115
|
-
return
|
|
2156
|
+
girarSelecao(a, r) {
|
|
2157
|
+
return Me(this.c, a, r);
|
|
2116
2158
|
}
|
|
2117
|
-
escalarSelecao(
|
|
2118
|
-
return
|
|
2159
|
+
escalarSelecao(a, r, i) {
|
|
2160
|
+
return Pa(this.c, a, r ?? a, i);
|
|
2119
2161
|
}
|
|
2120
|
-
espelharSelecao(
|
|
2121
|
-
return
|
|
2162
|
+
espelharSelecao(a) {
|
|
2163
|
+
return Fr(this.c, a);
|
|
2122
2164
|
}
|
|
2123
|
-
transformarSelecao(
|
|
2124
|
-
return
|
|
2165
|
+
transformarSelecao(a) {
|
|
2166
|
+
return aa(this.c, or(a));
|
|
2125
2167
|
}
|
|
2126
2168
|
removerSelecao() {
|
|
2127
|
-
return
|
|
2169
|
+
return ze(this.c);
|
|
2128
2170
|
}
|
|
2129
2171
|
/** Raios dos cantos dos retângulos selecionados, em mm (número = os quatro; ou [sup. esq., sup. dir., inf. dir., inf. esq.]). */
|
|
2130
|
-
definirRaiosCantos(
|
|
2131
|
-
return
|
|
2172
|
+
definirRaiosCantos(a) {
|
|
2173
|
+
return Ee(this.c, a);
|
|
2132
2174
|
}
|
|
2133
2175
|
/**
|
|
2134
2176
|
* Insere uma pré-definição (moldura, seta...) e a deixa selecionada. Sem `caixa`: com `opcoes.quadro: 'margens'` (e o
|
|
2135
2177
|
* atributo `margens`), o quadro das margens; senão, uma caixa no CENTRO DA ÁREA VISÍVEL, de tamanho proporcional ao zoom
|
|
2136
2178
|
* (cerca de 35% da largura e 25% da altura visíveis, limitada à folha), para a forma nascer à vista.
|
|
2137
2179
|
*/
|
|
2138
|
-
inserirPredefinicao(
|
|
2139
|
-
if (!
|
|
2180
|
+
inserirPredefinicao(a, r, i = {}) {
|
|
2181
|
+
if (!sr(a))
|
|
2140
2182
|
return this.c.recusar("inserir-predefinicao", "geometria-invalida"), [];
|
|
2141
|
-
const { quadro: o, ...s } = i ?? {}, n = r ?? (o === "margens" && this.c.margens ?
|
|
2142
|
-
return
|
|
2183
|
+
const { quadro: o, ...s } = i ?? {}, n = r ?? (o === "margens" && this.c.margens ? ve(this.c.folha.largura, this.c.folha.altura, this.c.margens) : null) ?? this.caixaNaVista(), l = nr(a, n, { ...s, id: s.id ?? this.c.gerarId(a) });
|
|
2184
|
+
return F(this.c, l, "predefinicao");
|
|
2143
2185
|
}
|
|
2144
2186
|
/** Caixa (mm) no centro da área visível, proporcional ao zoom e dentro da folha; sem vista medida, 60 × 40 mm no centro da folha. */
|
|
2145
2187
|
caixaNaVista() {
|
|
2146
|
-
const
|
|
2147
|
-
let i = 0, o = 0, s =
|
|
2188
|
+
const a = this.c.folha, r = this.c.vista;
|
|
2189
|
+
let i = 0, o = 0, s = a.largura, n = a.altura;
|
|
2148
2190
|
if (r.largura > 0 && r.altura > 0) {
|
|
2149
|
-
const v = r.paraFolha(0, 0), b = r.paraFolha(r.largura, r.altura), M = Math.max(0, v[0]),
|
|
2150
|
-
|
|
2191
|
+
const v = r.paraFolha(0, 0), b = r.paraFolha(r.largura, r.altura), M = Math.max(0, v[0]), C = Math.max(0, v[1]), T = Math.min(a.largura, b[0]), P = Math.min(a.altura, b[1]);
|
|
2192
|
+
T > M && P > C && (i = M, o = C, s = T, n = P);
|
|
2151
2193
|
}
|
|
2152
|
-
const l = (s - i) * (r.largura > 0 ? 0.35 : 0.3), c = (n - o) * (r.largura > 0 ? 0.25 : 0.15), d = Math.max(1, Math.min(l,
|
|
2194
|
+
const l = (s - i) * (r.largura > 0 ? 0.35 : 0.3), c = (n - o) * (r.largura > 0 ? 0.25 : 0.15), d = Math.max(1, Math.min(l, a.largura)), h = Math.max(1, Math.min(c, a.altura)), u = r.largura > 0 && r.altura > 0 ? r.paraFolha(r.largura / 2, r.altura / 2) : [(i + s) / 2, (o + n) / 2], f = Math.min(a.largura, Math.max(0, u[0])), p = Math.min(a.altura, Math.max(0, u[1]));
|
|
2153
2195
|
return { x: f - d / 2, y: p - h / 2, largura: d, altura: h };
|
|
2154
2196
|
}
|
|
2155
2197
|
// ---------- vista ----------
|
|
@@ -2157,29 +2199,29 @@ class Si extends pe {
|
|
|
2157
2199
|
this.render.medir(), this.c.vista.enquadrar({ x: 0, y: 0, largura: this.c.folha.largura, altura: this.c.folha.altura }) && (this.enquadrou = !0), this.c.emitirVista();
|
|
2158
2200
|
}
|
|
2159
2201
|
ajustarSelecao() {
|
|
2160
|
-
const
|
|
2161
|
-
if (
|
|
2202
|
+
const a = this.c.doc.elementosSelecionados();
|
|
2203
|
+
if (a.length === 0) {
|
|
2162
2204
|
this.c.recusar("ajustar-selecao", "sem-selecao");
|
|
2163
2205
|
return;
|
|
2164
2206
|
}
|
|
2165
|
-
const r =
|
|
2207
|
+
const r = Na(a);
|
|
2166
2208
|
r && this.c.vista.enquadrar(r, 48) && this.c.emitirVista();
|
|
2167
2209
|
}
|
|
2168
2210
|
/**
|
|
2169
2211
|
* Enquadra os elementos (os `ids`, ou todos) SEM mexer na seleção, com teto de zoom (`zoomMaximo`, em %: um elemento
|
|
2170
2212
|
* pequeno não é ampliado absurdamente). Devolve se enquadrou.
|
|
2171
2213
|
*/
|
|
2172
|
-
ajustarElementos(
|
|
2173
|
-
const i = Array.isArray(
|
|
2214
|
+
ajustarElementos(a, r = {}) {
|
|
2215
|
+
const i = Array.isArray(a) ? a.map((c) => this.c.doc.obter(c)).filter((c) => !!c) : [...this.c.doc.elementos], o = Na(i);
|
|
2174
2216
|
if (!o) return !1;
|
|
2175
2217
|
const s = Number.isFinite(r == null ? void 0 : r.margem) && r.margem >= 0 ? r.margem : 48, n = Number.isFinite(r == null ? void 0 : r.zoomMaximo) && r.zoomMaximo > 0 ? r.zoomMaximo : 800;
|
|
2176
2218
|
if (!this.c.vista.enquadrar(o, s)) return !1;
|
|
2177
|
-
const l = n / 100 *
|
|
2219
|
+
const l = n / 100 * W;
|
|
2178
2220
|
return this.c.vista.zoom > l && this.c.vista.definirZoomCentrado(l, o), this.c.emitirVista(), !0;
|
|
2179
2221
|
}
|
|
2180
2222
|
/** Zoom em % (100% = tamanho real a 96 dpi), no centro da vista. */
|
|
2181
|
-
definirZoom(
|
|
2182
|
-
this.c.vista.definirZoom(
|
|
2223
|
+
definirZoom(a) {
|
|
2224
|
+
this.c.vista.definirZoom(a / 100 * W) && (this.c.emitirVista(), this.c.anunciar(la(this.c.vista.zoomPercentual)));
|
|
2183
2225
|
}
|
|
2184
2226
|
aproximar() {
|
|
2185
2227
|
this.definirZoom(this.c.vista.zoomPercentual * 1.25);
|
|
@@ -2187,136 +2229,136 @@ class Si extends pe {
|
|
|
2187
2229
|
afastar() {
|
|
2188
2230
|
this.definirZoom(this.c.vista.zoomPercentual * 0.8);
|
|
2189
2231
|
}
|
|
2190
|
-
deslocarVista(
|
|
2191
|
-
this.c.vista.deslocar(
|
|
2232
|
+
deslocarVista(a, r) {
|
|
2233
|
+
this.c.vista.deslocar(a, r) && this.c.emitirVista();
|
|
2192
2234
|
}
|
|
2193
2235
|
obterVista() {
|
|
2194
|
-
const
|
|
2195
|
-
return { zoom:
|
|
2236
|
+
const a = this.c.vista;
|
|
2237
|
+
return { zoom: a.zoom, zoomPercentual: a.zoomPercentual, pan: [a.pan[0], a.pan[1]] };
|
|
2196
2238
|
}
|
|
2197
2239
|
/** Ponto da área de desenho (px CSS) → folha (mm), e o inverso. */
|
|
2198
|
-
paraFolha(
|
|
2199
|
-
return this.c.vista.paraFolha(
|
|
2240
|
+
paraFolha(a, r) {
|
|
2241
|
+
return this.c.vista.paraFolha(a, r);
|
|
2200
2242
|
}
|
|
2201
|
-
paraTela(
|
|
2202
|
-
return this.c.vista.paraTela(
|
|
2243
|
+
paraTela(a) {
|
|
2244
|
+
return this.c.vista.paraTela(a);
|
|
2203
2245
|
}
|
|
2204
2246
|
// ---------- guias e snap ----------
|
|
2205
|
-
definirGuias(
|
|
2206
|
-
this.c.guias = (Array.isArray(
|
|
2247
|
+
definirGuias(a) {
|
|
2248
|
+
this.c.guias = (Array.isArray(a) ? a : []).filter((r) => r && (r.orientacao === "horizontal" || r.orientacao === "vertical") && Number.isFinite(r.posicao)).map((r) => ({ ...r })), this.c.emitirGuias();
|
|
2207
2249
|
}
|
|
2208
|
-
adicionarGuia(
|
|
2209
|
-
this.definirGuias([...this.c.guias,
|
|
2250
|
+
adicionarGuia(a) {
|
|
2251
|
+
this.definirGuias([...this.c.guias, a]);
|
|
2210
2252
|
}
|
|
2211
|
-
removerGuia(
|
|
2212
|
-
this.definirGuias(this.c.guias.filter((r, i) => i !==
|
|
2253
|
+
removerGuia(a) {
|
|
2254
|
+
this.definirGuias(this.c.guias.filter((r, i) => i !== a));
|
|
2213
2255
|
}
|
|
2214
2256
|
obterGuias() {
|
|
2215
|
-
return this.c.guias.map((
|
|
2257
|
+
return this.c.guias.map((a) => ({ ...a }));
|
|
2216
2258
|
}
|
|
2217
|
-
definirSnap(
|
|
2218
|
-
this.toggleAttribute("sem-snap", !
|
|
2259
|
+
definirSnap(a) {
|
|
2260
|
+
this.toggleAttribute("sem-snap", !a);
|
|
2219
2261
|
}
|
|
2220
2262
|
// ---------- exportação ----------
|
|
2221
2263
|
/** SVG da folha com os elementos (o mesmo plano de pintura da tela). */
|
|
2222
|
-
exportarSvg(
|
|
2223
|
-
return
|
|
2264
|
+
exportarSvg(a = {}) {
|
|
2265
|
+
return lr(this.c.doc.elementos, { largura: this.c.folha.largura, altura: this.c.folha.altura, fundo: "#ffffff", ...a });
|
|
2224
2266
|
}
|
|
2225
2267
|
/** Pinta os elementos num contexto próprio (ex.: o PDF vetorial do app) com o mesmo código da tela. */
|
|
2226
|
-
desenharEm(
|
|
2227
|
-
return
|
|
2268
|
+
desenharEm(a, r = {}) {
|
|
2269
|
+
return $(a, this.c.doc.elementos, r);
|
|
2228
2270
|
}
|
|
2229
2271
|
/** Mede e pinta agora (sem esperar o próximo quadro). */
|
|
2230
2272
|
renderizarAgora() {
|
|
2231
2273
|
this.render.medir(), this.render.pintar();
|
|
2232
2274
|
}
|
|
2233
2275
|
/** Executa um comando público pelo nome (o mesmo que o `ui-bus` usa). Comando desconhecido emite `prancha-recusa`. */
|
|
2234
|
-
executarComando(
|
|
2235
|
-
if (!
|
|
2276
|
+
executarComando(a, r = []) {
|
|
2277
|
+
if (!Di(a)) {
|
|
2236
2278
|
this.c.recusar("executar-comando", "comando-desconhecido");
|
|
2237
2279
|
return;
|
|
2238
2280
|
}
|
|
2239
|
-
const i = this[
|
|
2281
|
+
const i = this[a];
|
|
2240
2282
|
try {
|
|
2241
2283
|
return i.apply(this, Array.isArray(r) ? r : []);
|
|
2242
2284
|
} catch {
|
|
2243
|
-
this.c.recusar(
|
|
2285
|
+
this.c.recusar(a, "geometria-invalida");
|
|
2244
2286
|
return;
|
|
2245
2287
|
}
|
|
2246
2288
|
}
|
|
2247
2289
|
}
|
|
2248
|
-
const
|
|
2249
|
-
const
|
|
2250
|
-
return typeof
|
|
2290
|
+
const ae = (t) => {
|
|
2291
|
+
const e = typeof t == "string" && t.trim() !== "" ? Number(t.replace(",", ".")) : t;
|
|
2292
|
+
return typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
2251
2293
|
};
|
|
2252
|
-
function
|
|
2253
|
-
let
|
|
2294
|
+
function Li(t) {
|
|
2295
|
+
let e = 1 / 0, a = 1 / 0, r = -1 / 0, i = -1 / 0;
|
|
2254
2296
|
for (const o of t) {
|
|
2255
|
-
const s =
|
|
2256
|
-
s && (
|
|
2297
|
+
const s = Y(o);
|
|
2298
|
+
s && (e = Math.min(e, s.x), a = Math.min(a, s.y), r = Math.max(r, s.x + s.largura), i = Math.max(i, s.y + s.altura));
|
|
2257
2299
|
}
|
|
2258
|
-
return Number.isFinite(
|
|
2300
|
+
return Number.isFinite(e) ? { x: e, y: a, largura: r - e, altura: i - a } : null;
|
|
2259
2301
|
}
|
|
2260
|
-
function
|
|
2261
|
-
const r =
|
|
2302
|
+
function ki(t, e, a) {
|
|
2303
|
+
const r = Li(t);
|
|
2262
2304
|
if (!r) return null;
|
|
2263
2305
|
let i = null;
|
|
2264
|
-
if (
|
|
2265
|
-
else if (
|
|
2266
|
-
else if (
|
|
2267
|
-
else if (
|
|
2268
|
-
else if (
|
|
2306
|
+
if (e === "geometria.x") i = k(a - r.x, 0);
|
|
2307
|
+
else if (e === "geometria.y") i = k(0, a - r.y);
|
|
2308
|
+
else if (e === "geometria.largura" && a > 0 && r.largura > 0) i = H(a / r.largura, 1, [r.x, r.y]);
|
|
2309
|
+
else if (e === "geometria.altura" && a > 0 && r.altura > 0) i = H(1, a / r.altura, [r.x, r.y]);
|
|
2310
|
+
else if (e === "geometria.rotacao")
|
|
2269
2311
|
return t.map((o) => {
|
|
2270
|
-
const s =
|
|
2312
|
+
const s = Y(o);
|
|
2271
2313
|
if (!s) return o;
|
|
2272
|
-
const n = (
|
|
2273
|
-
return
|
|
2314
|
+
const n = (a - hr(o)) * Math.PI / 180;
|
|
2315
|
+
return ue(o, za(n, [s.x + s.largura / 2, s.y + s.altura / 2]));
|
|
2274
2316
|
});
|
|
2275
|
-
return i ?
|
|
2317
|
+
return i ? I(t, i) : null;
|
|
2276
2318
|
}
|
|
2277
|
-
function
|
|
2319
|
+
function qi(t, e, a) {
|
|
2278
2320
|
if (t.somenteLeitura)
|
|
2279
2321
|
return t.recusar("propriedade", "somente-leitura"), !1;
|
|
2280
|
-
if (!
|
|
2322
|
+
if (!cr(e))
|
|
2281
2323
|
return t.recusar("propriedade", "comando-desconhecido"), !1;
|
|
2282
2324
|
const r = t.doc.elementosSelecionados();
|
|
2283
2325
|
if (r.length === 0)
|
|
2284
2326
|
return t.recusar("propriedade", "sem-selecao"), !1;
|
|
2285
|
-
const i =
|
|
2327
|
+
const i = e === "elemento.bloqueado" || e === "elemento.oculto" ? r : r.filter((s) => !t.mapa().travado(s));
|
|
2286
2328
|
if (i.length === 0)
|
|
2287
2329
|
return t.recusar("propriedade", "bloqueado"), !1;
|
|
2288
|
-
if (
|
|
2289
|
-
const s =
|
|
2290
|
-
return s === null || s < 0 ? (t.recusar("propriedade", "geometria-invalida"), !1) :
|
|
2330
|
+
if (e === "geometria.raio") {
|
|
2331
|
+
const s = ae(a);
|
|
2332
|
+
return s === null || s < 0 ? (t.recusar("propriedade", "geometria-invalida"), !1) : Ee(t, s);
|
|
2291
2333
|
}
|
|
2292
2334
|
let o;
|
|
2293
|
-
if (
|
|
2294
|
-
const s =
|
|
2295
|
-
o = s === null ? null :
|
|
2335
|
+
if (ur(e)) {
|
|
2336
|
+
const s = ae(a);
|
|
2337
|
+
o = s === null ? null : ki(i, e, s);
|
|
2296
2338
|
} else {
|
|
2297
|
-
const s = i.map((n) =>
|
|
2339
|
+
const s = i.map((n) => dr(n, e, a));
|
|
2298
2340
|
o = s.every((n) => n !== null) ? s : null;
|
|
2299
2341
|
}
|
|
2300
|
-
return o ? (t.aplicarSubstituicoes(o, "propriedades", `propriedade:${
|
|
2342
|
+
return o ? (t.aplicarSubstituicoes(o, "propriedades", `propriedade:${e}`), !0) : (t.recusar("propriedade", "geometria-invalida"), !1);
|
|
2301
2343
|
}
|
|
2302
|
-
function
|
|
2344
|
+
function Bi(t, e, a) {
|
|
2303
2345
|
if (t.somenteLeitura)
|
|
2304
2346
|
return t.recusar("alterar", "somente-leitura"), !1;
|
|
2305
|
-
if (!
|
|
2347
|
+
if (!a || typeof a != "object" || !Array.isArray(e))
|
|
2306
2348
|
return t.recusar("alterar", "geometria-invalida"), !1;
|
|
2307
|
-
const r =
|
|
2308
|
-
if (r.length === 0 ||
|
|
2349
|
+
const r = e.map((o) => typeof o == "string" ? t.doc.obter(o) : void 0).filter((o) => !!o);
|
|
2350
|
+
if (r.length === 0 || a.camadaId !== void 0 && a.camadaId !== null && !t.camadas.some((o) => o.id === a.camadaId))
|
|
2309
2351
|
return t.recusar("alterar", "id-invalido"), !1;
|
|
2310
2352
|
const i = r.map((o) => {
|
|
2311
2353
|
const s = { ...o };
|
|
2312
|
-
|
|
2354
|
+
a.nome !== void 0 && (typeof a.nome == "string" && a.nome.trim() !== "" ? s.nome = a.nome : delete s.nome);
|
|
2313
2355
|
for (const n of ["oculto", "bloqueado"])
|
|
2314
|
-
typeof
|
|
2315
|
-
return
|
|
2356
|
+
typeof a[n] == "boolean" && (a[n] ? s[n] = !0 : delete s[n]);
|
|
2357
|
+
return a.camadaId !== void 0 && (a.camadaId ? s.camadaId = a.camadaId : delete s.camadaId), s;
|
|
2316
2358
|
});
|
|
2317
2359
|
return t.aplicarSubstituicoes(i, "propriedades"), !0;
|
|
2318
2360
|
}
|
|
2319
|
-
const
|
|
2361
|
+
const ji = {
|
|
2320
2362
|
retangulo: "Retângulo",
|
|
2321
2363
|
elipse: "Elipse",
|
|
2322
2364
|
"poligono-regular": "Polígono",
|
|
@@ -2324,10 +2366,10 @@ const Ci = {
|
|
|
2324
2366
|
linha: "Linha",
|
|
2325
2367
|
caminho: "Caminho",
|
|
2326
2368
|
texto: "Texto"
|
|
2327
|
-
},
|
|
2328
|
-
var
|
|
2329
|
-
return
|
|
2330
|
-
},
|
|
2369
|
+
}, Ue = (t) => {
|
|
2370
|
+
var e;
|
|
2371
|
+
return ji[(e = t == null ? void 0 : t.geometria) == null ? void 0 : e.tipo] ?? "Elemento";
|
|
2372
|
+
}, Gi = {
|
|
2331
2373
|
normal: "Normal",
|
|
2332
2374
|
multiplicar: "Multiplicar",
|
|
2333
2375
|
tela: "Tela",
|
|
@@ -2344,129 +2386,129 @@ const Ci = {
|
|
|
2344
2386
|
saturacao: "Saturação",
|
|
2345
2387
|
cor: "Cor",
|
|
2346
2388
|
luminosidade: "Luminosidade"
|
|
2347
|
-
},
|
|
2389
|
+
}, Hi = {
|
|
2348
2390
|
continua: "Contínua",
|
|
2349
2391
|
tracejada: "Tracejada",
|
|
2350
2392
|
"tracejada-curta": "Tracejada curta",
|
|
2351
2393
|
"tracejada-longa": "Tracejada longa",
|
|
2352
2394
|
pontilhada: "Pontilhada",
|
|
2353
2395
|
"traco-ponto": "Traço-ponto"
|
|
2354
|
-
},
|
|
2355
|
-
function g(t,
|
|
2356
|
-
const o = t.map((l) =>
|
|
2396
|
+
}, J = (t) => t.map(([e, a]) => ({ id: e, rotulo: a })), ee = J([["nenhuma", "Nenhuma"], ["triangulo", "Triângulo"], ["triangulo-aberto", "Triângulo vazado"], ["aberta", "Aberta"], ["circulo", "Círculo"], ["quadrado", "Quadrado"], ["losango", "Losango"], ["barra", "Barra"]]);
|
|
2397
|
+
function g(t, e, a, r, i = {}) {
|
|
2398
|
+
const o = t.map((l) => fr(l, e)).filter((l) => l !== void 0);
|
|
2357
2399
|
if (o.length === 0) return null;
|
|
2358
2400
|
const s = (l) => JSON.stringify(l);
|
|
2359
|
-
return o.every((l) => s(l) === s(o[0])) && o[0] !== null ? { id:
|
|
2401
|
+
return o.every((l) => s(l) === s(o[0])) && o[0] !== null ? { id: e, rotulo: a, tipo: r, valor: o[0], ...i } : { id: e, rotulo: a, tipo: r, valor: null, misto: !0, ...i };
|
|
2360
2402
|
}
|
|
2361
|
-
const
|
|
2362
|
-
function
|
|
2363
|
-
let
|
|
2403
|
+
const w = { unidade: "mm", casasDecimais: 2, passo: 0.5 }, ia = { unidade: "%", casasDecimais: 0, passo: 5, min: 0, max: 100 }, B = (t) => t.filter((e) => e !== null);
|
|
2404
|
+
function $i(t) {
|
|
2405
|
+
let e = 1 / 0, a = 1 / 0, r = -1 / 0, i = -1 / 0;
|
|
2364
2406
|
for (const n of t) {
|
|
2365
|
-
const l =
|
|
2366
|
-
l && (
|
|
2367
|
-
}
|
|
2368
|
-
const o = (n) => Math.round(n * 1e6) / 1e6, s = Number.isFinite(
|
|
2369
|
-
{ id: "geometria.x", rotulo: "X", tipo: "numero", valor: o(
|
|
2370
|
-
{ id: "geometria.y", rotulo: "Y", tipo: "numero", valor: o(
|
|
2371
|
-
{ id: "geometria.largura", rotulo: "Largura", tipo: "numero", valor: o(r -
|
|
2372
|
-
{ id: "geometria.altura", rotulo: "Altura", tipo: "numero", valor: o(i -
|
|
2407
|
+
const l = Y(n);
|
|
2408
|
+
l && (e = Math.min(e, l.x), a = Math.min(a, l.y), r = Math.max(r, l.x + l.largura), i = Math.max(i, l.y + l.altura));
|
|
2409
|
+
}
|
|
2410
|
+
const o = (n) => Math.round(n * 1e6) / 1e6, s = Number.isFinite(e) ? [
|
|
2411
|
+
{ id: "geometria.x", rotulo: "X", tipo: "numero", valor: o(e), ...w },
|
|
2412
|
+
{ id: "geometria.y", rotulo: "Y", tipo: "numero", valor: o(a), ...w },
|
|
2413
|
+
{ id: "geometria.largura", rotulo: "Largura", tipo: "numero", valor: o(r - e), ...w, min: 0 },
|
|
2414
|
+
{ id: "geometria.altura", rotulo: "Altura", tipo: "numero", valor: o(i - a), ...w, min: 0 }
|
|
2373
2415
|
] : [];
|
|
2374
|
-
return s.push(g(t, "geometria.rotacao", "Rotação", "numero", { unidade: "°", casasDecimais: 2, passo: 15 })), t.every((n) => n.geometria.tipo === "retangulo") && s.push(g(t, "geometria.raio", "Raio dos cantos", "numero", { ...
|
|
2416
|
+
return s.push(g(t, "geometria.rotacao", "Rotação", "numero", { unidade: "°", casasDecimais: 2, passo: 15 })), t.every((n) => n.geometria.tipo === "retangulo") && s.push(g(t, "geometria.raio", "Raio dos cantos", "numero", { ...w, min: 0 })), B(s);
|
|
2375
2417
|
}
|
|
2376
|
-
const
|
|
2377
|
-
function
|
|
2378
|
-
const
|
|
2379
|
-
if (
|
|
2380
|
-
|
|
2381
|
-
const r =
|
|
2382
|
-
r &&
|
|
2418
|
+
const N = (t) => String(Math.round(t * 100) / 100).replace(".", ",");
|
|
2419
|
+
function Vi(t) {
|
|
2420
|
+
const e = t && Number.isFinite(t.largura) && Number.isFinite(t.altura) ? t : null, a = [{ id: "dica", rotulo: "Seleção", tipo: "readonly", valor: "Nada selecionado", dica: "Selecione um elemento para editar: clique nele ou arraste um retângulo de seleção." }];
|
|
2421
|
+
if (e) {
|
|
2422
|
+
a.push({ id: "folha.tamanho", rotulo: "Folha", tipo: "readonly", valor: `${N(e.largura)} × ${N(e.altura)} mm` }), e.unidade && a.push({ id: "folha.unidade", rotulo: "Unidade", tipo: "readonly", valor: e.unidade }), Number.isFinite(e.grade) && a.push({ id: "folha.grade", rotulo: "Grade", tipo: "readonly", valor: `${N(e.grade)} mm` });
|
|
2423
|
+
const r = e.margens;
|
|
2424
|
+
r && a.push({ id: "folha.margens", rotulo: "Margens", tipo: "readonly", valor: `${N(r.esquerda)} / ${N(r.direita)} / ${N(r.superior)} / ${N(r.inferior)} mm`, dica: "esquerda / direita / superior / inferior" });
|
|
2383
2425
|
}
|
|
2384
|
-
return [{ id: "folha", titulo: "Folha", aberto: !0, propriedades:
|
|
2426
|
+
return [{ id: "folha", titulo: "Folha", aberto: !0, propriedades: a }];
|
|
2385
2427
|
}
|
|
2386
|
-
function
|
|
2387
|
-
const
|
|
2388
|
-
if (
|
|
2389
|
-
const
|
|
2428
|
+
function Ki(t) {
|
|
2429
|
+
const e = Array.isArray(t) ? t.filter((l) => l && typeof l == "object" && l.geometria) : [];
|
|
2430
|
+
if (e.length === 0) return [];
|
|
2431
|
+
const a = e.filter((l) => l.geometria.tipo === "texto"), r = e.filter((l) => {
|
|
2390
2432
|
var c;
|
|
2391
|
-
return l.geometria.tipo !== "texto" && ((c =
|
|
2392
|
-
}), i =
|
|
2433
|
+
return l.geometria.tipo !== "texto" && ((c = Ca(l)) == null ? void 0 : c.tipo) === "Polygon";
|
|
2434
|
+
}), i = e.length > a.length, o = e.length === 1 ? Ue(e[0]) : `${e.length} elementos`, s = [
|
|
2393
2435
|
{
|
|
2394
2436
|
id: "elemento",
|
|
2395
2437
|
titulo: "Elemento",
|
|
2396
2438
|
aberto: !0,
|
|
2397
|
-
propriedades:
|
|
2439
|
+
propriedades: B([
|
|
2398
2440
|
{ id: "elemento.tipo", rotulo: "Tipo", tipo: "readonly", valor: o },
|
|
2399
|
-
g(
|
|
2400
|
-
g(
|
|
2401
|
-
g(
|
|
2441
|
+
g(e, "elemento.nome", "Nome", "texto"),
|
|
2442
|
+
g(e, "elemento.bloqueado", "Bloqueado", "booleano"),
|
|
2443
|
+
g(e, "elemento.oculto", "Oculto", "booleano")
|
|
2402
2444
|
])
|
|
2403
2445
|
},
|
|
2404
|
-
{ id: "geometria", titulo: "Posição e tamanho", aberto: !0, propriedades:
|
|
2446
|
+
{ id: "geometria", titulo: "Posição e tamanho", aberto: !0, propriedades: $i(e) }
|
|
2405
2447
|
];
|
|
2406
2448
|
if (i) {
|
|
2407
|
-
const l =
|
|
2449
|
+
const l = e.filter((c) => c.geometria.tipo !== "texto");
|
|
2408
2450
|
s.push({
|
|
2409
2451
|
id: "traco",
|
|
2410
2452
|
titulo: "Traço",
|
|
2411
2453
|
aberto: !0,
|
|
2412
|
-
propriedades:
|
|
2454
|
+
propriedades: B([
|
|
2413
2455
|
g(l, "traco.ativo", "Com traço", "booleano"),
|
|
2414
2456
|
g(l, "traco.cor", "Cor", "cor"),
|
|
2415
|
-
g(l, "traco.espessura", "Espessura", "numero", { ...
|
|
2416
|
-
g(l, "traco.opacidade", "Opacidade", "numero",
|
|
2417
|
-
g(l, "traco.tipoLinha", "Tipo de linha", "linha", { opcoes:
|
|
2457
|
+
g(l, "traco.espessura", "Espessura", "numero", { ...w, passo: 0.05, min: 0 }),
|
|
2458
|
+
g(l, "traco.opacidade", "Opacidade", "numero", ia),
|
|
2459
|
+
g(l, "traco.tipoLinha", "Tipo de linha", "linha", { opcoes: vr.map((c) => ({ id: c, rotulo: Hi[c] ?? c })) }),
|
|
2418
2460
|
g(l, "traco.escalaTipoLinha", "Escala da linha", "numero", { casasDecimais: 2, passo: 0.1, min: 0 }),
|
|
2419
|
-
g(l, "traco.terminacao", "Terminação", "selecao", { opcoes:
|
|
2420
|
-
g(l, "traco.juncao", "Junção", "selecao", { opcoes:
|
|
2421
|
-
r.length === l.length ? g(l, "traco.alinhamento", "Alinhamento", "selecao", { opcoes:
|
|
2422
|
-
r.length === 0 ? g(l, "traco.pontaInicio", "Ponta inicial", "selecao", { opcoes:
|
|
2423
|
-
r.length === 0 ? g(l, "traco.pontaFim", "Ponta final", "selecao", { opcoes:
|
|
2461
|
+
g(l, "traco.terminacao", "Terminação", "selecao", { opcoes: J([["reta", "Reta"], ["arredondada", "Arredondada"], ["quadrada", "Quadrada"]]) }),
|
|
2462
|
+
g(l, "traco.juncao", "Junção", "selecao", { opcoes: J([["angular", "Angular"], ["arredondada", "Arredondada"], ["chanfrada", "Chanfrada"]]) }),
|
|
2463
|
+
r.length === l.length ? g(l, "traco.alinhamento", "Alinhamento", "selecao", { opcoes: J([["centro", "Centro"], ["dentro", "Dentro"], ["fora", "Fora"]]) }) : null,
|
|
2464
|
+
r.length === 0 ? g(l, "traco.pontaInicio", "Ponta inicial", "selecao", { opcoes: ee }) : null,
|
|
2465
|
+
r.length === 0 ? g(l, "traco.pontaFim", "Ponta final", "selecao", { opcoes: ee }) : null
|
|
2424
2466
|
])
|
|
2425
2467
|
});
|
|
2426
2468
|
}
|
|
2427
|
-
return [...r, ...
|
|
2469
|
+
return [...r, ...a].length === e.length && s.push({
|
|
2428
2470
|
id: "preenchimento",
|
|
2429
2471
|
titulo: "Preenchimento",
|
|
2430
2472
|
aberto: !0,
|
|
2431
|
-
propriedades:
|
|
2432
|
-
g(
|
|
2433
|
-
g(
|
|
2434
|
-
g(
|
|
2435
|
-
|
|
2473
|
+
propriedades: B([
|
|
2474
|
+
g(e, "preenchimento.ativo", "Com preenchimento", "booleano"),
|
|
2475
|
+
g(e, "preenchimento.cor", "Cor", "cor"),
|
|
2476
|
+
g(e, "preenchimento.opacidade", "Opacidade", "numero", ia),
|
|
2477
|
+
a.length === 0 ? g(e, "preenchimento.regra", "Regra", "selecao", { opcoes: J([["nonzero", "Diferente de zero"], ["evenodd", "Par-ímpar"]]) }) : null
|
|
2436
2478
|
])
|
|
2437
|
-
}), r.length ===
|
|
2479
|
+
}), r.length === e.length && s.push({
|
|
2438
2480
|
id: "hachura",
|
|
2439
2481
|
titulo: "Hachura",
|
|
2440
2482
|
aberto: !1,
|
|
2441
|
-
propriedades:
|
|
2442
|
-
g(
|
|
2443
|
-
g(
|
|
2444
|
-
g(
|
|
2445
|
-
g(
|
|
2446
|
-
g(
|
|
2483
|
+
propriedades: B([
|
|
2484
|
+
g(e, "hachura.ativa", "Com hachura", "booleano"),
|
|
2485
|
+
g(e, "hachura.angulo", "Ângulo", "numero", { unidade: "°", casasDecimais: 1, passo: 15 }),
|
|
2486
|
+
g(e, "hachura.espacamento", "Espaçamento", "numero", { ...w, min: 0.1 }),
|
|
2487
|
+
g(e, "hachura.cor", "Cor", "cor"),
|
|
2488
|
+
g(e, "hachura.cruzada", "Cruzada", "booleano")
|
|
2447
2489
|
])
|
|
2448
2490
|
}), s.push({
|
|
2449
2491
|
id: "efeitos",
|
|
2450
2492
|
titulo: "Efeitos",
|
|
2451
2493
|
aberto: !1,
|
|
2452
|
-
propriedades:
|
|
2453
|
-
g(
|
|
2454
|
-
g(
|
|
2455
|
-
g(
|
|
2456
|
-
g(
|
|
2457
|
-
g(
|
|
2458
|
-
g(
|
|
2459
|
-
g(
|
|
2460
|
-
g(
|
|
2494
|
+
propriedades: B([
|
|
2495
|
+
g(e, "efeitos.opacidade", "Opacidade", "numero", ia),
|
|
2496
|
+
g(e, "efeitos.mesclagem", "Mesclagem", "selecao", { opcoes: mr.map((l) => ({ id: l, rotulo: Gi[l] })) }),
|
|
2497
|
+
g(e, "sombra.ativa", "Sombra", "booleano"),
|
|
2498
|
+
g(e, "sombra.dx", "Sombra X", "numero", w),
|
|
2499
|
+
g(e, "sombra.dy", "Sombra Y", "numero", w),
|
|
2500
|
+
g(e, "sombra.desfoque", "Desfoque", "numero", { ...w, min: 0 }),
|
|
2501
|
+
g(e, "sombra.cor", "Cor da sombra", "cor"),
|
|
2502
|
+
g(e, "sombra.opacidade", "Opacidade da sombra", "numero", ia)
|
|
2461
2503
|
])
|
|
2462
2504
|
}), s.filter((l) => l.propriedades.length > 0);
|
|
2463
2505
|
}
|
|
2464
|
-
const
|
|
2465
|
-
function
|
|
2466
|
-
const r = Array.isArray(t) ? t.filter((u) => u && typeof u == "object" && u.geometria) : [], i = Array.isArray(
|
|
2506
|
+
const G = "prancha:sem-camada", te = (t) => typeof t == "string" && t !== G ? t : null;
|
|
2507
|
+
function Wi(t, e = [], a = {}) {
|
|
2508
|
+
const r = Array.isArray(t) ? t.filter((u) => u && typeof u == "object" && u.geometria) : [], i = Array.isArray(e) ? e.filter((u) => u && typeof u.id == "string") : [], o = new Set(i.map((u) => u.id)), s = i.length === 0 && ((a == null ? void 0 : a.ocultarSemCamada) === !0 || (a == null ? void 0 : a.modo) === "simples"), n = (u) => u.camadaId && o.has(u.camadaId) ? u.camadaId : s ? "" : G, l = /* @__PURE__ */ new Map();
|
|
2467
2509
|
for (const u of r) l.set(n(u), (l.get(n(u)) ?? 0) + 1);
|
|
2468
2510
|
const c = [];
|
|
2469
|
-
!s && (l.has(
|
|
2511
|
+
!s && (l.has(G) || i.length === 0) && c.push({ id: G, name: "Sem camada", visible: !0, locked: !1, opacity: 1, order: 0, count: l.get(G) ?? 0 });
|
|
2470
2512
|
for (const u of [...i].reverse())
|
|
2471
2513
|
c.push({
|
|
2472
2514
|
id: u.id,
|
|
@@ -2477,19 +2519,19 @@ function Fi(t, a = [], e = {}) {
|
|
|
2477
2519
|
order: c.length,
|
|
2478
2520
|
count: l.get(u.id) ?? 0
|
|
2479
2521
|
});
|
|
2480
|
-
const d = /* @__PURE__ */ new Map(), h = [
|
|
2481
|
-
var
|
|
2482
|
-
const f =
|
|
2522
|
+
const d = /* @__PURE__ */ new Map(), h = [...U(r, i)].reverse().map((u) => {
|
|
2523
|
+
var C, T, P;
|
|
2524
|
+
const f = Ue(u);
|
|
2483
2525
|
let p = u.nome;
|
|
2484
2526
|
if (!p) {
|
|
2485
|
-
const
|
|
2486
|
-
d.set(f,
|
|
2527
|
+
const _ = (d.get(f) ?? 0) + 1;
|
|
2528
|
+
d.set(f, _), p = `${f} ${_}`;
|
|
2487
2529
|
}
|
|
2488
|
-
const b = u.geometria.tipo === "texto" ? "Text" : ((
|
|
2530
|
+
const b = u.geometria.tipo === "texto" ? "Text" : ((C = Ca(u)) == null ? void 0 : C.tipo) === "Polygon" ? "Polygon" : "LineString";
|
|
2489
2531
|
let M;
|
|
2490
2532
|
try {
|
|
2491
|
-
const
|
|
2492
|
-
M = ((
|
|
2533
|
+
const _ = pr(u);
|
|
2534
|
+
M = ((T = _.preenchimento) == null ? void 0 : T.cor) ?? ((P = _.traco) == null ? void 0 : P.cor);
|
|
2493
2535
|
} catch {
|
|
2494
2536
|
M = void 0;
|
|
2495
2537
|
}
|
|
@@ -2497,158 +2539,158 @@ function Fi(t, a = [], e = {}) {
|
|
|
2497
2539
|
});
|
|
2498
2540
|
return { camadas: c, feicoes: h };
|
|
2499
2541
|
}
|
|
2500
|
-
function
|
|
2542
|
+
function Ui(t, e, a) {
|
|
2501
2543
|
const r = Array.isArray(t) ? t : [];
|
|
2502
|
-
return !
|
|
2503
|
-
if (i.id !==
|
|
2544
|
+
return !a || typeof a != "object" ? [...r] : r.map((i) => {
|
|
2545
|
+
if (i.id !== e) return i;
|
|
2504
2546
|
const o = { ...i };
|
|
2505
|
-
return typeof
|
|
2547
|
+
return typeof a.visivel == "boolean" && (o.visivel = a.visivel), typeof a.bloqueada == "boolean" && (o.bloqueada = a.bloqueada), typeof a.opacidade == "number" && Number.isFinite(a.opacidade) && (o.opacidade = Math.min(1, Math.max(0, a.opacidade))), typeof a.nome == "string" && a.nome.trim() !== "" && (o.nome = a.nome), o;
|
|
2506
2548
|
});
|
|
2507
2549
|
}
|
|
2508
|
-
function
|
|
2509
|
-
const
|
|
2510
|
-
for (const n of Array.isArray(
|
|
2550
|
+
function Xi(t, e) {
|
|
2551
|
+
const a = Array.isArray(t) ? t : [], r = new Map(a.map((n) => [n.id, n])), i = /* @__PURE__ */ new Set(), o = [];
|
|
2552
|
+
for (const n of Array.isArray(e) ? e : []) {
|
|
2511
2553
|
const l = typeof n == "string" ? r.get(n) : void 0;
|
|
2512
2554
|
l && !i.has(l.id) && (i.add(l.id), o.push(l));
|
|
2513
2555
|
}
|
|
2514
|
-
return [...
|
|
2556
|
+
return [...a.filter((n) => !i.has(n.id)), ...o.reverse()];
|
|
2515
2557
|
}
|
|
2516
|
-
class
|
|
2558
|
+
class Zi extends Ri {
|
|
2517
2559
|
static get observedAttributes() {
|
|
2518
|
-
return
|
|
2560
|
+
return Ke;
|
|
2519
2561
|
}
|
|
2520
2562
|
// ---------- camadas e isolamento ----------
|
|
2521
2563
|
/** Camadas da prancha (a primeira fica atrás). Elementos sem camada ficam por cima. */
|
|
2522
|
-
definirCamadas(
|
|
2523
|
-
this.c.definirCamadas(
|
|
2564
|
+
definirCamadas(e) {
|
|
2565
|
+
this.c.definirCamadas(e);
|
|
2524
2566
|
}
|
|
2525
2567
|
obterCamadas() {
|
|
2526
|
-
return this.c.camadas.map((
|
|
2568
|
+
return this.c.camadas.map((e) => ({ ...e }));
|
|
2527
2569
|
}
|
|
2528
2570
|
/** Camada que recebe os elementos novos (desenhados, colados, pré-definições); `null` = sem camada. */
|
|
2529
|
-
definirCamadaAtiva(
|
|
2530
|
-
this.c.camadaAtiva = typeof
|
|
2571
|
+
definirCamadaAtiva(e) {
|
|
2572
|
+
this.c.camadaAtiva = typeof e == "string" && this.c.camadas.some((a) => a.id === e) ? e : null;
|
|
2531
2573
|
}
|
|
2532
|
-
moverSelecaoParaCamada(
|
|
2533
|
-
return
|
|
2574
|
+
moverSelecaoParaCamada(e) {
|
|
2575
|
+
return Ur(this.c, e);
|
|
2534
2576
|
}
|
|
2535
2577
|
/** Isola um grupo (só os membros se selecionam) ou sai do isolamento com `null`. */
|
|
2536
|
-
isolarGrupo(
|
|
2537
|
-
this.c.isolar(
|
|
2578
|
+
isolarGrupo(e) {
|
|
2579
|
+
this.c.isolar(e);
|
|
2538
2580
|
}
|
|
2539
2581
|
// ---------- ordem, grupos, bloquear e ocultar ----------
|
|
2540
|
-
ordenarSelecao(
|
|
2541
|
-
return
|
|
2582
|
+
ordenarSelecao(e) {
|
|
2583
|
+
return O(this.c, e);
|
|
2542
2584
|
}
|
|
2543
2585
|
trazerParaFrente() {
|
|
2544
|
-
return
|
|
2586
|
+
return O(this.c, "frente");
|
|
2545
2587
|
}
|
|
2546
2588
|
enviarParaTras() {
|
|
2547
|
-
return
|
|
2589
|
+
return O(this.c, "tras");
|
|
2548
2590
|
}
|
|
2549
2591
|
avancar() {
|
|
2550
|
-
return
|
|
2592
|
+
return O(this.c, "avancar");
|
|
2551
2593
|
}
|
|
2552
2594
|
recuar() {
|
|
2553
|
-
return
|
|
2595
|
+
return O(this.c, "recuar");
|
|
2554
2596
|
}
|
|
2555
2597
|
agruparSelecao() {
|
|
2556
|
-
return
|
|
2598
|
+
return Te(this.c);
|
|
2557
2599
|
}
|
|
2558
2600
|
desagruparSelecao() {
|
|
2559
|
-
return
|
|
2601
|
+
return we(this.c);
|
|
2560
2602
|
}
|
|
2561
2603
|
bloquearSelecao() {
|
|
2562
|
-
return
|
|
2604
|
+
return ua(this.c, "bloqueado");
|
|
2563
2605
|
}
|
|
2564
2606
|
ocultarSelecao() {
|
|
2565
|
-
return
|
|
2607
|
+
return ua(this.c, "oculto");
|
|
2566
2608
|
}
|
|
2567
2609
|
desbloquearTudo() {
|
|
2568
|
-
return
|
|
2610
|
+
return da(this.c, "bloqueado");
|
|
2569
2611
|
}
|
|
2570
2612
|
mostrarTudo() {
|
|
2571
|
-
return
|
|
2613
|
+
return da(this.c, "oculto");
|
|
2572
2614
|
}
|
|
2573
2615
|
// ---------- alinhar, distribuir, duplicar ----------
|
|
2574
2616
|
/** Alinha à seleção, à folha, ao primeiro selecionado (`'chave'`) ou a uma caixa em mm (as margens, o quadro). */
|
|
2575
|
-
alinharSelecao(
|
|
2576
|
-
return
|
|
2617
|
+
alinharSelecao(e, a = "selecao") {
|
|
2618
|
+
return Hr(this.c, e, a);
|
|
2577
2619
|
}
|
|
2578
2620
|
/** Distribui centros ou espaços (iguais, ou `espacamento` fixo em mm). */
|
|
2579
|
-
distribuirSelecao(
|
|
2580
|
-
return
|
|
2621
|
+
distribuirSelecao(e, a = "espacos", r) {
|
|
2622
|
+
return $r(this.c, e, a, r);
|
|
2581
2623
|
}
|
|
2582
|
-
duplicarSelecao(
|
|
2583
|
-
return
|
|
2624
|
+
duplicarSelecao(e) {
|
|
2625
|
+
return Vr(this.c, e);
|
|
2584
2626
|
}
|
|
2585
2627
|
/** Ctrl+D: repete a última transformação (duplicando, se ela foi uma cópia). */
|
|
2586
2628
|
transformarDeNovo() {
|
|
2587
|
-
return
|
|
2629
|
+
return De(this.c);
|
|
2588
2630
|
}
|
|
2589
2631
|
// ---------- área de transferência e aparência ----------
|
|
2590
2632
|
copiar() {
|
|
2591
|
-
return
|
|
2633
|
+
return Da(this.c);
|
|
2592
2634
|
}
|
|
2593
2635
|
recortar() {
|
|
2594
|
-
return
|
|
2636
|
+
return Ie(this.c);
|
|
2595
2637
|
}
|
|
2596
2638
|
/** Cola deslocado a cada colagem, ou no mesmo lugar (`noLugar`). */
|
|
2597
|
-
colar(
|
|
2598
|
-
return
|
|
2639
|
+
colar(e = !1) {
|
|
2640
|
+
return Fe(this.c, e);
|
|
2599
2641
|
}
|
|
2600
|
-
aplicarAparencia(
|
|
2601
|
-
return
|
|
2642
|
+
aplicarAparencia(e) {
|
|
2643
|
+
return Wr(this.c, e);
|
|
2602
2644
|
}
|
|
2603
2645
|
// ---------- máscara e operações de caminho ----------
|
|
2604
2646
|
criarMascara() {
|
|
2605
|
-
return
|
|
2647
|
+
return _e(this.c);
|
|
2606
2648
|
}
|
|
2607
2649
|
liberarMascara() {
|
|
2608
|
-
return
|
|
2650
|
+
return Ne(this.c);
|
|
2609
2651
|
}
|
|
2610
|
-
unirSelecao(
|
|
2611
|
-
return
|
|
2652
|
+
unirSelecao(e) {
|
|
2653
|
+
return Oe(this.c, e);
|
|
2612
2654
|
}
|
|
2613
2655
|
dividirSelecao() {
|
|
2614
|
-
return
|
|
2656
|
+
return Xr(this.c);
|
|
2615
2657
|
}
|
|
2616
2658
|
/** Deslocar caminho (offset): cria um contorno novo a `distancia` mm (negativo = para dentro). */
|
|
2617
|
-
deslocarCaminho(
|
|
2618
|
-
return
|
|
2659
|
+
deslocarCaminho(e) {
|
|
2660
|
+
return Zr(this.c, e);
|
|
2619
2661
|
}
|
|
2620
|
-
simplificarSelecao(
|
|
2621
|
-
return
|
|
2662
|
+
simplificarSelecao(e) {
|
|
2663
|
+
return Jr(this.c, e);
|
|
2622
2664
|
}
|
|
2623
2665
|
contornarTraco() {
|
|
2624
|
-
return
|
|
2666
|
+
return Qr(this.c);
|
|
2625
2667
|
}
|
|
2626
2668
|
converterEmCaminho() {
|
|
2627
|
-
return
|
|
2669
|
+
return Yr(this.c);
|
|
2628
2670
|
}
|
|
2629
2671
|
// ---------- Pathfinder (Fase 5) ----------
|
|
2630
2672
|
/**
|
|
2631
2673
|
* Operação booleana sobre a seleção: `'uniao'`, `'subtracao'` (o mais atrás menos os outros), `'intersecao'` ou
|
|
2632
2674
|
* `'exclusao'`. O resultado é um caminho composto com o id e a aparência do mais à frente (na subtração, do mais atrás).
|
|
2633
2675
|
*/
|
|
2634
|
-
pathfinder(
|
|
2635
|
-
return
|
|
2676
|
+
pathfinder(e) {
|
|
2677
|
+
return q(this.c, e);
|
|
2636
2678
|
}
|
|
2637
2679
|
/** Ctrl+Alt+Shift+1. */
|
|
2638
2680
|
unirFormas() {
|
|
2639
|
-
return
|
|
2681
|
+
return q(this.c, "uniao");
|
|
2640
2682
|
}
|
|
2641
2683
|
/** Ctrl+Alt+Shift+2 ("menos frente"). */
|
|
2642
2684
|
subtrairFrente() {
|
|
2643
|
-
return
|
|
2685
|
+
return q(this.c, "subtracao");
|
|
2644
2686
|
}
|
|
2645
2687
|
/** Ctrl+Alt+Shift+3. */
|
|
2646
2688
|
intersectarFormas() {
|
|
2647
|
-
return
|
|
2689
|
+
return q(this.c, "intersecao");
|
|
2648
2690
|
}
|
|
2649
2691
|
/** Ctrl+Alt+Shift+4. */
|
|
2650
2692
|
excluirSobreposicao() {
|
|
2651
|
-
return
|
|
2693
|
+
return q(this.c, "exclusao");
|
|
2652
2694
|
}
|
|
2653
2695
|
// ---------- painéis (Fase 6) ----------
|
|
2654
2696
|
/**
|
|
@@ -2656,27 +2698,27 @@ class Ri extends Si {
|
|
|
2656
2698
|
* grade, margens, somente leitura) com a dica "Selecione um elemento para editar", em vez de um painel vazio.
|
|
2657
2699
|
*/
|
|
2658
2700
|
categoriasDePropriedades() {
|
|
2659
|
-
const
|
|
2660
|
-
return
|
|
2701
|
+
const e = this.c.doc.elementosSelecionados();
|
|
2702
|
+
return e.length > 0 ? Ki(e) : Vi({ largura: this.c.folha.largura, altura: this.c.folha.altura, unidade: this.c.unidade, grade: this.c.grade, margens: this.c.margens });
|
|
2661
2703
|
}
|
|
2662
2704
|
/**
|
|
2663
2705
|
* Aplica um campo do painel de propriedades à seleção (o `id` e o `valor` do `ui-propriedade-alterada`). Ação do usuário:
|
|
2664
2706
|
* histórico (rajada no mesmo campo = um passo) e `prancha-elemento-atualizado` com motivo `propriedades`.
|
|
2665
2707
|
*/
|
|
2666
|
-
aplicarPropriedade(
|
|
2667
|
-
return
|
|
2708
|
+
aplicarPropriedade(e, a) {
|
|
2709
|
+
return qi(this.c, e, a);
|
|
2668
2710
|
}
|
|
2669
2711
|
/** Dados para o `<ui-camadas>` (`painel.definirCamadas(d.camadas, d.feicoes)`), da frente para trás. */
|
|
2670
|
-
dadosParaPainelDeCamadas(
|
|
2671
|
-
return
|
|
2712
|
+
dadosParaPainelDeCamadas(e) {
|
|
2713
|
+
return Wi(this.c.doc.elementos, this.c.camadas, e);
|
|
2672
2714
|
}
|
|
2673
2715
|
/** Oculta, trava, renomeia ou muda de camada elementos pelo id (o painel de camadas), inclusive travados. */
|
|
2674
|
-
alterarElementos(
|
|
2675
|
-
return
|
|
2716
|
+
alterarElementos(e, a) {
|
|
2717
|
+
return Bi(this.c, e, a);
|
|
2676
2718
|
}
|
|
2677
2719
|
}
|
|
2678
|
-
|
|
2679
|
-
const A = (t) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${t}</svg>`,
|
|
2720
|
+
Se("ui-canvas-prancha", Zi);
|
|
2721
|
+
const A = (t) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${t}</svg>`, sa = {
|
|
2680
2722
|
selecao: A('<path d="M5 3l14 8-6 2-3 6z" fill="currentColor"/>'),
|
|
2681
2723
|
"selecao-direta": A('<path d="M5 3l14 8-6 2-3 6z"/>'),
|
|
2682
2724
|
mao: A('<path d="M18 11V6a2 2 0 0 0-4 0M14 10V4a2 2 0 0 0-4 0v2M10 10.5V6a2 2 0 0 0-4 0v8M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.9-5.9-2.4L3.4 16a2 2 0 0 1 3.2-2.4L8 15"/>'),
|
|
@@ -2694,109 +2736,223 @@ const A = (t) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" str
|
|
|
2694
2736
|
"adicionar-ancora": A('<path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5"/><path d="M4 20h6M7 17v6"/>'),
|
|
2695
2737
|
"excluir-ancora": A('<path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5"/><path d="M4 20h6"/>'),
|
|
2696
2738
|
"converter-ancora": A('<path d="M4 20L12 4l8 16"/><path d="M8 12h8"/>')
|
|
2697
|
-
},
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
{ id: "grupo-caneta", rotulo: "Caneta", icone:
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2739
|
+
}, S = (t, e, a) => ({ id: t, rotulo: e, icone: sa[t], tipo: "ferramenta", ...a ? { atalho: a } : {} }), Ji = Object.freeze([
|
|
2740
|
+
S("selecao", "Seleção", "V"),
|
|
2741
|
+
S("selecao-direta", "Seleção direta", "A"),
|
|
2742
|
+
{ id: "grupo-caneta", rotulo: "Caneta", icone: sa.caneta, tipo: "ferramenta", filhos: [
|
|
2743
|
+
S("caneta", "Caneta", "P"),
|
|
2744
|
+
S("adicionar-ancora", "Adicionar âncora", "+"),
|
|
2745
|
+
S("excluir-ancora", "Excluir âncora", "-"),
|
|
2746
|
+
S("converter-ancora", "Converter âncora", "Shift+C")
|
|
2705
2747
|
] },
|
|
2706
|
-
|
|
2707
|
-
{ id: "grupo-linhas", rotulo: "Linhas", icone:
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2748
|
+
S("texto", "Texto", "T"),
|
|
2749
|
+
{ id: "grupo-linhas", rotulo: "Linhas", icone: sa.linha, tipo: "ferramenta", filhos: [
|
|
2750
|
+
S("linha", "Linha", "\\"),
|
|
2751
|
+
S("seta", "Seta"),
|
|
2752
|
+
S("polilinha", "Polilinha"),
|
|
2753
|
+
S("poligono", "Polígono")
|
|
2712
2754
|
] },
|
|
2713
|
-
{ id: "grupo-formas", rotulo: "Formas", icone:
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2755
|
+
{ id: "grupo-formas", rotulo: "Formas", icone: sa.retangulo, tipo: "ferramenta", filhos: [
|
|
2756
|
+
S("retangulo", "Retângulo", "M"),
|
|
2757
|
+
S("elipse", "Elipse", "L"),
|
|
2758
|
+
S("poligono-regular", "Polígono regular"),
|
|
2759
|
+
S("estrela", "Estrela")
|
|
2718
2760
|
] },
|
|
2719
|
-
|
|
2720
|
-
|
|
2761
|
+
S("conta-gotas", "Conta-gotas", "I"),
|
|
2762
|
+
S("mao", "Mão", "H")
|
|
2721
2763
|
]);
|
|
2722
|
-
function
|
|
2723
|
-
return typeof t == "string" &&
|
|
2764
|
+
function Qi(t) {
|
|
2765
|
+
return typeof t == "string" && $e.includes(t) ? t : null;
|
|
2724
2766
|
}
|
|
2725
|
-
const
|
|
2726
|
-
function
|
|
2727
|
-
const { prancha:
|
|
2728
|
-
if (!
|
|
2767
|
+
const Yi = ["prancha-elemento-criado", "prancha-elemento-atualizado", "prancha-elemento-removido", "prancha-ordem", "prancha-camadas"], ao = (t) => t.detail ?? {};
|
|
2768
|
+
function eo(t) {
|
|
2769
|
+
const { prancha: e, paleta: a, camadas: r, propriedades: i } = t ?? {};
|
|
2770
|
+
if (!e) return () => {
|
|
2729
2771
|
};
|
|
2730
|
-
const o = new
|
|
2772
|
+
const o = new Ta(), s = (h, u, f) => o.add(h, u, (p) => {
|
|
2731
2773
|
try {
|
|
2732
|
-
f(
|
|
2774
|
+
f(ao(p));
|
|
2733
2775
|
} catch {
|
|
2734
2776
|
}
|
|
2735
2777
|
});
|
|
2736
|
-
|
|
2737
|
-
const u =
|
|
2738
|
-
u &&
|
|
2739
|
-
}), s(
|
|
2740
|
-
|
|
2778
|
+
a && (a.ferramentas = Ji, a.valor = e.ferramenta, s(a, "ui-change", (h) => {
|
|
2779
|
+
const u = Qi(h.valor);
|
|
2780
|
+
u && e.definirFerramenta(u);
|
|
2781
|
+
}), s(e, "prancha-ferramenta", (h) => {
|
|
2782
|
+
a.valor = h.ferramenta;
|
|
2741
2783
|
}));
|
|
2742
2784
|
const n = () => {
|
|
2743
|
-
i && (i.categorias =
|
|
2785
|
+
i && (i.categorias = e.categoriasDePropriedades());
|
|
2744
2786
|
};
|
|
2745
2787
|
i && s(i, "ui-propriedade-alterada", (h) => {
|
|
2746
|
-
|
|
2788
|
+
e.aplicarPropriedade(h.id, h.valor);
|
|
2747
2789
|
});
|
|
2748
2790
|
const l = () => {
|
|
2749
2791
|
var u;
|
|
2750
2792
|
if (!r) return;
|
|
2751
|
-
const h =
|
|
2752
|
-
r.definirCamadas(h.camadas, h.feicoes), (u = r.selecionarFeicoes) == null || u.call(r,
|
|
2793
|
+
const h = e.dadosParaPainelDeCamadas({ ocultarSemCamada: t.listaPlana !== !1 });
|
|
2794
|
+
r.definirCamadas(h.camadas, h.feicoes), (u = r.selecionarFeicoes) == null || u.call(r, e.selecao);
|
|
2753
2795
|
}, c = (h, u) => {
|
|
2754
|
-
h !==
|
|
2796
|
+
h !== G && e.definirCamadas(Ui(e.obterCamadas(), h, u));
|
|
2755
2797
|
};
|
|
2756
2798
|
if (r) {
|
|
2757
2799
|
const h = r;
|
|
2758
|
-
s(h, "ui-camada-visibilidade", (u) => c(u.camadaId, { visivel: u.visivel })), s(h, "ui-camada-bloqueio", (u) => c(u.camadaId, { bloqueada: u.bloqueado })), s(h, "ui-camada-opacidade", (u) => c(u.camadaId, { opacidade: u.opacidade })), s(h, "ui-camada-renomeada", (u) => c(u.camadaId, { nome: u.novoNome })), s(h, "ui-camada-selecionada", (u) =>
|
|
2759
|
-
|
|
2800
|
+
s(h, "ui-camada-visibilidade", (u) => c(u.camadaId, { visivel: u.visivel })), s(h, "ui-camada-bloqueio", (u) => c(u.camadaId, { bloqueada: u.bloqueado })), s(h, "ui-camada-opacidade", (u) => c(u.camadaId, { opacidade: u.opacidade })), s(h, "ui-camada-renomeada", (u) => c(u.camadaId, { nome: u.novoNome })), s(h, "ui-camada-selecionada", (u) => e.definirCamadaAtiva(te(u.camadaId))), s(h, "ui-camadas-reordenadas", (u) => {
|
|
2801
|
+
e.definirCamadas(Xi(e.obterCamadas(), (u.camadas ?? []).map((f) => f.id)));
|
|
2760
2802
|
}), s(h, "ui-camada-adicionar", () => {
|
|
2761
|
-
const u =
|
|
2803
|
+
const u = e.obterCamadas();
|
|
2762
2804
|
let f = u.length + 1;
|
|
2763
2805
|
for (; u.some((p) => p.id === `camada-${f}`); ) f++;
|
|
2764
|
-
|
|
2765
|
-
}), s(h, "ui-feicao-selecionada", (u) =>
|
|
2806
|
+
e.definirCamadas([...u, { id: `camada-${f}`, nome: `Camada ${f}` }]);
|
|
2807
|
+
}), s(h, "ui-feicao-selecionada", (u) => e.selecionarElementos([u.feicaoId])), s(h, "ui-feicoes-selecionadas", (u) => e.selecionarElementos(u.feicoesIds ?? [])), s(h, "ui-feicao-visibilidade", (u) => e.alterarElementos([u.feicaoId], { oculto: !u.visivel })), s(h, "ui-feicao-bloqueio", (u) => e.alterarElementos([u.feicaoId], { bloqueado: u.bloqueado })), s(h, "ui-feicao-renomeada", (u) => e.alterarElementos([u.feicaoId], { nome: u.novoNome })), s(h, "ui-feicao-movida", (u) => e.alterarElementos([u.feicaoId], { camadaId: te(u.camadaDestinoId) }));
|
|
2766
2808
|
}
|
|
2767
|
-
for (const h of
|
|
2809
|
+
for (const h of Yi) o.add(e, h, () => {
|
|
2768
2810
|
l(), n();
|
|
2769
2811
|
});
|
|
2770
|
-
o.add(
|
|
2812
|
+
o.add(e, "prancha-selecao", () => {
|
|
2771
2813
|
var h;
|
|
2772
|
-
(h = r == null ? void 0 : r.selecionarFeicoes) == null || h.call(r,
|
|
2814
|
+
(h = r == null ? void 0 : r.selecionarFeicoes) == null || h.call(r, e.selecao), n();
|
|
2773
2815
|
}), l(), n();
|
|
2774
2816
|
let d = !0;
|
|
2775
2817
|
return () => {
|
|
2776
2818
|
d && (d = !1, o.cleanup());
|
|
2777
2819
|
};
|
|
2778
2820
|
}
|
|
2779
|
-
const
|
|
2780
|
-
|
|
2821
|
+
const to = 720, ro = 24, io = 0.5, ya = (t) => t === "botoes" || t === "menu" ? t : "auto", X = (t) => t === "fixa" || t === "gaveta" ? t : "auto";
|
|
2822
|
+
function oo(t) {
|
|
2823
|
+
if (!t || typeof t != "object") return !1;
|
|
2824
|
+
const e = !!t.colapsadaAtual, a = t.transbordouNoDom === !0, r = t.larguraNecessaria, i = t.larguraDisponivel, o = typeof t.histerese == "number" && Number.isFinite(t.histerese) && t.histerese >= 0 ? t.histerese : ro, s = typeof i == "number" && Number.isFinite(i) && i > 0, n = typeof r == "number" && Number.isFinite(r) && r > 0;
|
|
2825
|
+
return !s || !n ? a ? !0 : e : e ? a ? !0 : i < r + o : a || r > i + io;
|
|
2826
|
+
}
|
|
2827
|
+
const so = "display:flex !important;flex-wrap:nowrap !important;width:max-content !important;max-width:none !important;position:absolute !important;visibility:hidden !important;pointer-events:none !important;left:0 !important;top:0 !important;", x = (t) => typeof t == "number" && Number.isFinite(t) && t > 0 ? t : 0, D = (t, e) => {
|
|
2828
|
+
if (typeof t != "string" || !t) return e;
|
|
2829
|
+
const a = parseFloat(t);
|
|
2830
|
+
return Number.isFinite(a) && a >= 0 ? a : e;
|
|
2831
|
+
}, Xe = (t) => {
|
|
2832
|
+
try {
|
|
2833
|
+
return typeof getComputedStyle == "function" ? getComputedStyle(t) : null;
|
|
2834
|
+
} catch {
|
|
2835
|
+
return null;
|
|
2836
|
+
}
|
|
2837
|
+
}, Ze = (t, e = !1) => {
|
|
2838
|
+
var o;
|
|
2839
|
+
let a = 0;
|
|
2840
|
+
try {
|
|
2841
|
+
a = ((o = t.getBoundingClientRect) == null ? void 0 : o.call(t).width) ?? 0;
|
|
2842
|
+
} catch {
|
|
2843
|
+
a = 0;
|
|
2844
|
+
}
|
|
2845
|
+
const r = x(t.offsetWidth), i = e ? x(t.scrollWidth) : 0;
|
|
2846
|
+
return Math.max(x(a), r, i, 0);
|
|
2847
|
+
};
|
|
2848
|
+
function re(t, e) {
|
|
2849
|
+
const a = Xe(t), r = D(a == null ? void 0 : a.columnGap, 4), i = D(a == null ? void 0 : a.paddingLeft, 0) + D(a == null ? void 0 : a.paddingRight, 0) + D(a == null ? void 0 : a.borderLeftWidth, 0) + D(a == null ? void 0 : a.borderRightWidth, 0);
|
|
2850
|
+
let o = 0, s = !1;
|
|
2851
|
+
for (const n of e) {
|
|
2852
|
+
const l = Ze(n, !0);
|
|
2853
|
+
l > 0 && (s = !0), o += l;
|
|
2854
|
+
}
|
|
2855
|
+
return {
|
|
2856
|
+
largura: s ? o + Math.max(0, e.length - 1) * r + i : 0,
|
|
2857
|
+
medido: s
|
|
2858
|
+
};
|
|
2859
|
+
}
|
|
2860
|
+
function no(t, e) {
|
|
2861
|
+
var o;
|
|
2862
|
+
const a = e[0];
|
|
2863
|
+
if (a) {
|
|
2864
|
+
const s = x(a.offsetHeight);
|
|
2865
|
+
if (s > 0) {
|
|
2866
|
+
const n = a.offsetTop, l = Math.max(4, s * 0.5);
|
|
2867
|
+
if (e.some((c) => c.offsetTop > n + l)) return !0;
|
|
2868
|
+
}
|
|
2869
|
+
try {
|
|
2870
|
+
const n = (o = a.getBoundingClientRect) == null ? void 0 : o.call(a);
|
|
2871
|
+
if (n && n.height > 0) {
|
|
2872
|
+
const l = Math.max(4, n.height * 0.5);
|
|
2873
|
+
if (e.some((c) => {
|
|
2874
|
+
var d, h;
|
|
2875
|
+
return (((h = (d = c.getBoundingClientRect) == null ? void 0 : d.call(c)) == null ? void 0 : h.top) ?? n.top) > n.top + l;
|
|
2876
|
+
})) return !0;
|
|
2877
|
+
}
|
|
2878
|
+
} catch {
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
const r = x(t.clientWidth), i = x(t.scrollWidth);
|
|
2882
|
+
return r > 0 && i > r + 1;
|
|
2883
|
+
}
|
|
2884
|
+
function lo(t) {
|
|
2885
|
+
var C, T;
|
|
2886
|
+
const { barra: e, botoesFormas: a, botaoLateral: r, lateralVisivel: i, colapsadaAtual: o, larguraObservada: s } = t, n = Xe(e), l = D(n == null ? void 0 : n.paddingLeft, 0) + D(n == null ? void 0 : n.paddingRight, 0), c = D(n == null ? void 0 : n.columnGap, 4);
|
|
2887
|
+
let d = x(e.clientWidth);
|
|
2888
|
+
if (!(d > 0)) {
|
|
2889
|
+
let P = 0;
|
|
2890
|
+
try {
|
|
2891
|
+
P = x((C = e.getBoundingClientRect) == null ? void 0 : C.call(e).width);
|
|
2892
|
+
} catch {
|
|
2893
|
+
P = 0;
|
|
2894
|
+
}
|
|
2895
|
+
d = P > 0 ? P : x(s);
|
|
2896
|
+
}
|
|
2897
|
+
let h = Math.max(0, d - l);
|
|
2898
|
+
if (h > 0 && i) {
|
|
2899
|
+
const P = Ze(r, !1);
|
|
2900
|
+
P > 0 && (h = Math.max(0, h - P - c));
|
|
2901
|
+
}
|
|
2902
|
+
!(h > 0) && !o && (h = x(a.clientWidth));
|
|
2903
|
+
const u = Array.from(a.querySelectorAll("button[data-predefinicao]"));
|
|
2904
|
+
if (u.length === 0)
|
|
2905
|
+
return { larguraDisponivel: h, larguraNecessaria: 0, transbordouNoDom: !1 };
|
|
2906
|
+
if (o) {
|
|
2907
|
+
const P = a.getAttribute("style");
|
|
2908
|
+
try {
|
|
2909
|
+
a.style.cssText = so;
|
|
2910
|
+
const _ = re(a, u);
|
|
2911
|
+
let fa = 0;
|
|
2912
|
+
try {
|
|
2913
|
+
fa = x((T = a.getBoundingClientRect) == null ? void 0 : T.call(a).width);
|
|
2914
|
+
} catch {
|
|
2915
|
+
fa = 0;
|
|
2916
|
+
}
|
|
2917
|
+
const Je = x(a.scrollWidth);
|
|
2918
|
+
return {
|
|
2919
|
+
larguraDisponivel: h,
|
|
2920
|
+
larguraNecessaria: Math.max(_.largura, fa, Je),
|
|
2921
|
+
transbordouNoDom: !1
|
|
2922
|
+
};
|
|
2923
|
+
} finally {
|
|
2924
|
+
P === null ? a.removeAttribute("style") : a.setAttribute("style", P);
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
const f = no(a, u), p = re(a, u), v = x(a.clientWidth), b = x(a.scrollWidth), M = p.medido ? v > 0 && b > v + 1 ? Math.max(p.largura, b) : p.largura : b;
|
|
2928
|
+
return { larguraDisponivel: h, larguraNecessaria: M, transbordouNoDom: f };
|
|
2929
|
+
}
|
|
2930
|
+
const co = ":host{--ui-editor-prancha-lateral: 300px;display:block;min-height:360px;min-width:240px;height:100%;color:var(--ui-cor-texto);font-family:var(--ui-fonte-base);box-sizing:border-box}:host([hidden]){display:none}.raiz{container-type:inline-size;container-name:editor;position:relative;display:grid;grid-template-rows:auto minmax(0,1fr) auto;height:100%;min-height:inherit;gap:var(--ui-espaco-sm);box-sizing:border-box}.barra{display:flex;flex-wrap:nowrap;gap:var(--ui-espaco-xs, 4px);align-items:center;min-width:0}.botoes-formas{display:flex;flex-wrap:wrap;gap:var(--ui-espaco-xs, 4px);min-width:0;flex:1 1 auto}.formas-menu{position:relative;display:none;flex:0 0 auto}.btn-lateral{display:none;margin-inline-start:auto;flex:0 0 auto}.acoes{display:flex;flex-wrap:nowrap;gap:var(--ui-espaco-xs);align-items:center;justify-content:flex-end;flex:0 0 auto}.area{position:relative;display:flex;gap:var(--ui-espaco-sm);align-items:stretch;min-height:0;min-width:0}.area>ui-paleta-ferramentas{flex:0 0 auto}.area>ui-canvas-prancha{flex:1 1 auto;min-width:0;height:auto}.lateral{flex:0 0 var(--ui-editor-prancha-lateral);display:flex;flex-direction:column;gap:var(--ui-espaco-sm);min-width:0}.lateral>ui-tabela-propriedades{flex:1 1 auto;min-height:200px}button{font:inherit;font-size:var(--ui-tamanho-corpo-sm);color:var(--ui-cor-texto);background:var(--ui-cor-superficie);border:1px solid var(--ui-cor-borda);border-radius:var(--ui-raio-sm);padding:var(--ui-espaco-xs) var(--ui-espaco-md);min-height:var(--ui-touch-target-min);cursor:pointer;white-space:nowrap}button:hover{border-color:var(--ui-cor-primaria)}button:focus-visible{outline:2px solid var(--ui-cor-primaria);outline-offset:2px}button.primario{background:var(--ui-cor-primaria);color:var(--ui-cor-texto-sobre-primaria, #000);border-color:var(--ui-cor-primaria)}.menu-formas{position:absolute;inset-block-start:100%;inset-inline-start:0;z-index:20;min-width:200px;max-height:70vh;overflow:auto;margin-block-start:var(--ui-espaco-xs);padding:var(--ui-espaco-xs);background:var(--ui-cor-superficie);border:1px solid var(--ui-cor-borda);border-radius:var(--ui-raio-sm);box-shadow:var(--ui-sombra-md, 0 8px 24px rgba(0, 0, 0, .35))}.menu-formas[hidden]{display:none}.menu-formas button{display:block;width:100%;text-align:start;border-color:transparent;background:transparent}.menu-formas button:hover,.menu-formas button:focus-visible{background:var(--ui-cor-fundo-elevado)}.menu-grupo{padding:var(--ui-espaco-xs) var(--ui-espaco-sm);font-size:var(--ui-tamanho-caption);color:var(--ui-cor-texto-secundario);text-transform:uppercase}.raiz[data-barra=menu] .botoes-formas,.raiz[data-barra=auto][data-barra-modo=menu] .botoes-formas{display:none}.raiz[data-barra=menu] .formas-menu,.raiz[data-barra=auto][data-barra-modo=menu] .formas-menu{display:block}.raiz[data-lateral=gaveta] .btn-lateral{display:inline-block}.raiz[data-lateral=gaveta] .lateral{position:absolute;inset-block:0;inset-inline-end:0;z-index:10;width:min(var(--ui-editor-prancha-lateral),92%);padding:var(--ui-espaco-sm);box-sizing:border-box;background:var(--ui-cor-fundo);border:1px solid var(--ui-cor-borda);box-shadow:var(--ui-sombra-md, 0 8px 24px rgba(0, 0, 0, .35))}.raiz[data-lateral=gaveta][data-lateral-aberta=false] .lateral{display:none}@container editor (max-width: 719.98px){.raiz[data-lateral=auto] .btn-lateral{display:inline-block}.raiz[data-lateral=auto] .lateral{position:absolute;inset-block:0;inset-inline-end:0;z-index:10;width:min(var(--ui-editor-prancha-lateral),92%);padding:var(--ui-espaco-sm);box-sizing:border-box;background:var(--ui-cor-fundo);border:1px solid var(--ui-cor-borda);box-shadow:var(--ui-sombra-md, 0 8px 24px rgba(0, 0, 0, .35))}.raiz[data-lateral=auto][data-lateral-aberta=false] .lateral{display:none}}@container editor (max-width: 420px){.area{flex-direction:column}.area>ui-paleta-ferramentas{align-self:flex-start}}", ie = ["largura", "altura", "unidade", "grade", "mostrar-grade", "margens", "ajustar-ao-abrir", "somente-leitura", "sem-snap", "sem-reguas", "rotulo"], oe = { molduras: "Molduras", formas: "Formas", linhas: "Linhas", setas: "Setas" };
|
|
2931
|
+
class uo extends Ae {
|
|
2781
2932
|
constructor() {
|
|
2782
2933
|
super();
|
|
2783
2934
|
m(this, "shadow");
|
|
2784
|
-
m(this, "bag", new
|
|
2935
|
+
m(this, "bag", new Ta());
|
|
2785
2936
|
m(this, "desligarPaineis", null);
|
|
2786
2937
|
m(this, "observador", null);
|
|
2938
|
+
m(this, "rafBarra", null);
|
|
2787
2939
|
m(this, "_prancha");
|
|
2788
2940
|
m(this, "paleta");
|
|
2789
2941
|
m(this, "painelCamadas");
|
|
2790
2942
|
m(this, "painelPropriedades");
|
|
2791
2943
|
m(this, "raiz");
|
|
2944
|
+
m(this, "barra");
|
|
2945
|
+
m(this, "botoesFormas");
|
|
2792
2946
|
m(this, "botaoLateral");
|
|
2793
2947
|
m(this, "botaoFormas");
|
|
2794
2948
|
m(this, "menuFormas");
|
|
2795
2949
|
m(this, "_lateralAberta", !1);
|
|
2796
2950
|
m(this, "estreito", !1);
|
|
2951
|
+
m(this, "barraColapsada", !1);
|
|
2952
|
+
m(this, "ultimaLarguraObservada", 0);
|
|
2797
2953
|
this.shadow = this.attachShadow({ mode: "open" }), this.shadow.innerHTML = `
|
|
2798
|
-
<style>${
|
|
2799
|
-
<div class="raiz" id="raiz" part="base" data-barra="auto" data-lateral="auto" data-lateral-aberta="false">
|
|
2954
|
+
<style>${co}</style>
|
|
2955
|
+
<div class="raiz" id="raiz" part="base" data-barra="auto" data-barra-modo="botoes" data-lateral="auto" data-lateral-aberta="false">
|
|
2800
2956
|
<div class="barra" part="barra" id="barra" role="toolbar" aria-label="Formas e painéis">
|
|
2801
2957
|
<div class="botoes-formas" id="botoes-formas" role="group" aria-label="Pré-definições"></div>
|
|
2802
2958
|
<div class="formas-menu">
|
|
@@ -2818,32 +2974,36 @@ class Bi extends pe {
|
|
|
2818
2974
|
<button type="button" id="concluir" class="primario">Concluir</button>
|
|
2819
2975
|
</div>
|
|
2820
2976
|
</div>`;
|
|
2821
|
-
const
|
|
2822
|
-
this._prancha =
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
c.className = "menu-grupo", c.setAttribute("aria-hidden", "true"), c.textContent = ee[s.grupo], o.appendChild(c), this.menuFormas.appendChild(o);
|
|
2977
|
+
const a = (o) => this.shadow.getElementById(o);
|
|
2978
|
+
this._prancha = a("prancha"), this.paleta = a("paleta"), this.painelCamadas = a("camadas"), this.painelPropriedades = a("propriedades"), this.raiz = a("raiz"), this.barra = a("barra"), this.botoesFormas = a("botoes-formas"), this.botaoLateral = a("btn-lateral"), this.botaoFormas = a("btn-formas"), this.menuFormas = a("menu-formas");
|
|
2979
|
+
let r = null, i = null;
|
|
2980
|
+
for (const o of Oa) {
|
|
2981
|
+
const s = document.createElement("button");
|
|
2982
|
+
if (s.type = "button", s.dataset.predefinicao = o.valor, s.textContent = o.rotulo, this.botoesFormas.appendChild(s), o.grupo !== r) {
|
|
2983
|
+
r = o.grupo, i = document.createElement("div"), i.setAttribute("role", "group"), i.setAttribute("aria-label", oe[o.grupo]);
|
|
2984
|
+
const l = document.createElement("div");
|
|
2985
|
+
l.className = "menu-grupo", l.setAttribute("aria-hidden", "true"), l.textContent = oe[o.grupo], i.appendChild(l), this.menuFormas.appendChild(i);
|
|
2831
2986
|
}
|
|
2832
|
-
const
|
|
2833
|
-
|
|
2987
|
+
const n = document.createElement("button");
|
|
2988
|
+
n.type = "button", n.setAttribute("role", "menuitem"), n.tabIndex = -1, n.dataset.predefinicao = o.valor, n.textContent = o.rotulo, i == null || i.appendChild(n);
|
|
2834
2989
|
}
|
|
2835
2990
|
}
|
|
2836
2991
|
static get observedAttributes() {
|
|
2837
|
-
return [...
|
|
2992
|
+
return [...ie, "teclado", "barra-formas", "lateral"];
|
|
2838
2993
|
}
|
|
2839
2994
|
connectedCallback() {
|
|
2840
|
-
var
|
|
2841
|
-
this.bag.cleanup(),
|
|
2995
|
+
var r;
|
|
2996
|
+
this.bag.cleanup(), this.pararObservador(), (r = this.desligarPaineis) == null || r.call(this), this.sincronizarAtributos(), this.desligarPaineis = eo({
|
|
2842
2997
|
prancha: this._prancha,
|
|
2843
2998
|
paleta: this.paleta,
|
|
2844
2999
|
camadas: this.painelCamadas,
|
|
2845
3000
|
propriedades: this.painelPropriedades
|
|
2846
|
-
})
|
|
3001
|
+
});
|
|
3002
|
+
const a = () => j(this.getAttribute("teclado") ?? "isolado");
|
|
3003
|
+
Ge(this.bag, this, () => {
|
|
3004
|
+
const i = a();
|
|
3005
|
+
return i === "isolado" || i === "modal";
|
|
3006
|
+
}), He(this.bag, this, () => a() === "modal"), this.bag.add(this.shadow.getElementById("concluir"), "click", () => this.concluir()), this.bag.add(this.shadow.getElementById("cancelar"), "click", () => this.cancelar()), this.bag.add(this.botoesFormas, "click", (i) => {
|
|
2847
3007
|
var s, n;
|
|
2848
3008
|
const o = (n = (s = i.target) == null ? void 0 : s.closest) == null ? void 0 : n.call(s, "button[data-predefinicao]");
|
|
2849
3009
|
o && this.inserir(o.dataset.predefinicao);
|
|
@@ -2863,41 +3023,38 @@ class Bi extends pe {
|
|
|
2863
3023
|
i.key === "Escape" && this.emGaveta() && this._lateralAberta && (i.preventDefault(), i.stopPropagation(), this.lateralAberta = !1, this.botaoLateral.focus());
|
|
2864
3024
|
}), this.bag.add(this, "keydown", (i) => {
|
|
2865
3025
|
i.altKey && !i.ctrlKey && !i.metaKey && typeof i.key == "string" && i.key.toLowerCase() === "p" && (i.preventDefault(), this.lateralAberta = !this.lateralAberta, this._lateralAberta && this.emGaveta() && this.painelPropriedades.focus());
|
|
2866
|
-
}, { capture: !0 }), this.bag.add(this._prancha, "prancha-esc-sem-efeito", () => this.cancelar()),
|
|
2867
|
-
var s, n;
|
|
2868
|
-
const o = ((n = (s = i[i.length - 1]) == null ? void 0 : s.contentRect) == null ? void 0 : n.width) ?? 0;
|
|
2869
|
-
o > 0 && this.definirLargura(o);
|
|
2870
|
-
}), this.observador.observe(this.raiz)), this.atualizarLateral();
|
|
3026
|
+
}, { capture: !0 }), this.bag.add(this._prancha, "prancha-esc-sem-efeito", () => this.cancelar()), this.iniciarObservador(), this.atualizarLateral();
|
|
2871
3027
|
}
|
|
2872
3028
|
disconnectedCallback() {
|
|
2873
|
-
var
|
|
2874
|
-
this.bag.cleanup(),
|
|
3029
|
+
var a;
|
|
3030
|
+
this.bag.cleanup(), this.pararObservador(), this.ultimaLarguraObservada = 0, (a = this.desligarPaineis) == null || a.call(this), this.desligarPaineis = null, this.fecharMenuFormas(!1);
|
|
2875
3031
|
}
|
|
2876
|
-
attributeChangedCallback(
|
|
2877
|
-
if (
|
|
2878
|
-
|
|
3032
|
+
attributeChangedCallback(a, r, i) {
|
|
3033
|
+
if (a === "barra-formas") {
|
|
3034
|
+
const o = ya(i);
|
|
3035
|
+
o !== "auto" && (this.barraColapsada = !1), this.sincronizarModoBarra(), o === "auto" && this.isConnected && this.reajustarBarra();
|
|
2879
3036
|
return;
|
|
2880
3037
|
}
|
|
2881
|
-
if (
|
|
2882
|
-
this.raiz.dataset.lateral =
|
|
3038
|
+
if (a === "lateral") {
|
|
3039
|
+
this.raiz.dataset.lateral = X(i), this.atualizarLateral();
|
|
2883
3040
|
return;
|
|
2884
3041
|
}
|
|
2885
|
-
this.repassar(
|
|
3042
|
+
this.repassar(a, i);
|
|
2886
3043
|
}
|
|
2887
|
-
repassar(
|
|
2888
|
-
if (
|
|
2889
|
-
const i =
|
|
3044
|
+
repassar(a, r) {
|
|
3045
|
+
if (a === "teclado") {
|
|
3046
|
+
const i = j(r ?? "isolado");
|
|
2890
3047
|
i === "local" ? this._prancha.removeAttribute("teclado") : this._prancha.setAttribute("teclado", i);
|
|
2891
3048
|
return;
|
|
2892
3049
|
}
|
|
2893
|
-
r === null ? this._prancha.removeAttribute(
|
|
3050
|
+
r === null ? this._prancha.removeAttribute(a) : this._prancha.setAttribute(a, r);
|
|
2894
3051
|
}
|
|
2895
3052
|
sincronizarAtributos() {
|
|
2896
|
-
for (const
|
|
2897
|
-
this.repassar("teclado", this.getAttribute("teclado")), this.
|
|
3053
|
+
for (const a of ie) this.repassar(a, this.getAttribute(a));
|
|
3054
|
+
this.repassar("teclado", this.getAttribute("teclado")), this.barraFormas !== "auto" && (this.barraColapsada = !1), this.sincronizarModoBarra(), this.raiz.dataset.lateral = X(this.getAttribute("lateral"));
|
|
2898
3055
|
}
|
|
2899
|
-
inserir(
|
|
2900
|
-
const r =
|
|
3056
|
+
inserir(a) {
|
|
3057
|
+
const r = Oa.find((i) => i.valor === a);
|
|
2901
3058
|
r && this._prancha.inserirPredefinicao(r.valor, void 0, r.usaQuadro ? { quadro: "margens" } : {});
|
|
2902
3059
|
}
|
|
2903
3060
|
// ---------- menu "Formas" ----------
|
|
@@ -2905,64 +3062,143 @@ class Bi extends pe {
|
|
|
2905
3062
|
return Array.from(this.menuFormas.querySelectorAll('button[role="menuitem"]'));
|
|
2906
3063
|
}
|
|
2907
3064
|
abrirMenuFormas() {
|
|
2908
|
-
var
|
|
2909
|
-
this.menuFormas.hidden = !1, this.botaoFormas.setAttribute("aria-expanded", "true"), (
|
|
3065
|
+
var a;
|
|
3066
|
+
this.menuFormas.hidden = !1, this.botaoFormas.setAttribute("aria-expanded", "true"), (a = this.itensDoMenu()[0]) == null || a.focus();
|
|
2910
3067
|
}
|
|
2911
|
-
fecharMenuFormas(
|
|
2912
|
-
this.menuFormas.hidden || (this.menuFormas.hidden = !0, this.botaoFormas.setAttribute("aria-expanded", "false"),
|
|
3068
|
+
fecharMenuFormas(a) {
|
|
3069
|
+
this.menuFormas.hidden || (this.menuFormas.hidden = !0, this.botaoFormas.setAttribute("aria-expanded", "false"), a && this.botaoFormas.focus());
|
|
2913
3070
|
}
|
|
2914
3071
|
alternarMenuFormas() {
|
|
2915
3072
|
this.menuFormas.hidden ? this.abrirMenuFormas() : this.fecharMenuFormas(!0);
|
|
2916
3073
|
}
|
|
2917
|
-
tecladoDoMenu(
|
|
3074
|
+
tecladoDoMenu(a) {
|
|
2918
3075
|
const r = this.itensDoMenu(), i = r.indexOf(this.shadow.activeElement);
|
|
2919
|
-
if (
|
|
2920
|
-
|
|
3076
|
+
if (a.key === "Escape") {
|
|
3077
|
+
a.preventDefault(), a.stopPropagation(), this.fecharMenuFormas(!0);
|
|
2921
3078
|
return;
|
|
2922
3079
|
}
|
|
2923
|
-
if (
|
|
3080
|
+
if (a.key === "Tab") {
|
|
2924
3081
|
this.fecharMenuFormas(!1);
|
|
2925
3082
|
return;
|
|
2926
3083
|
}
|
|
2927
3084
|
const o = (s) => {
|
|
2928
3085
|
var n;
|
|
2929
|
-
|
|
3086
|
+
a.preventDefault(), (n = r[(s + r.length) % r.length]) == null || n.focus();
|
|
2930
3087
|
};
|
|
2931
|
-
|
|
3088
|
+
a.key === "ArrowDown" ? o(i + 1) : a.key === "ArrowUp" ? o(i - 1) : a.key === "Home" ? o(0) : a.key === "End" && o(r.length - 1);
|
|
3089
|
+
}
|
|
3090
|
+
// ---------- barra de formas e observador ----------
|
|
3091
|
+
iniciarObservador() {
|
|
3092
|
+
this.pararObservador(), typeof ResizeObserver == "function" && (this.observador = new ResizeObserver((a) => this.aoRedimensionar(a)), this.observador.observe(this.raiz), this.observador.observe(this.barra));
|
|
3093
|
+
}
|
|
3094
|
+
pararObservador() {
|
|
3095
|
+
var a;
|
|
3096
|
+
(a = this.observador) == null || a.disconnect(), this.observador = null, this.rafBarra !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this.rafBarra), this.rafBarra = null;
|
|
3097
|
+
}
|
|
3098
|
+
aoRedimensionar(a) {
|
|
3099
|
+
var o;
|
|
3100
|
+
if (!Array.isArray(a)) return;
|
|
3101
|
+
let r = null, i = null;
|
|
3102
|
+
for (const s of a) {
|
|
3103
|
+
const n = (o = s == null ? void 0 : s.contentRect) == null ? void 0 : o.width;
|
|
3104
|
+
typeof n != "number" || !Number.isFinite(n) || n < 0 || (!s.target || s.target === this.raiz ? r = n : s.target === this.barra && (i = n));
|
|
3105
|
+
}
|
|
3106
|
+
r !== null ? (this.ultimaLarguraObservada = r, r > 0 && this.definirLargura(r)) : i !== null && (this.ultimaLarguraObservada = i), this.barraFormas === "auto" && this.agendarAjusteBarra();
|
|
3107
|
+
}
|
|
3108
|
+
/** Agrupa rajadas de redimensionamento em um único reajuste por quadro (evita loops de ResizeObserver e pisca-pisca). */
|
|
3109
|
+
agendarAjusteBarra() {
|
|
3110
|
+
if (!(!this.isConnected || this.barraFormas !== "auto")) {
|
|
3111
|
+
if (typeof requestAnimationFrame != "function") {
|
|
3112
|
+
this.reajustarBarra();
|
|
3113
|
+
return;
|
|
3114
|
+
}
|
|
3115
|
+
this.rafBarra === null && (this.rafBarra = requestAnimationFrame(() => {
|
|
3116
|
+
this.rafBarra = null, this.isConnected && this.reajustarBarra();
|
|
3117
|
+
}));
|
|
3118
|
+
}
|
|
3119
|
+
}
|
|
3120
|
+
/**
|
|
3121
|
+
* Reavalia se a barra de formas no modo `auto` cabe em uma linha ou deve colapsar para `"Formas ▾"`.
|
|
3122
|
+
* Executado no máximo uma vez por quadro via `ResizeObserver`; pode ser chamado após alterações manuais de rótulos/layout.
|
|
3123
|
+
*/
|
|
3124
|
+
reajustarBarra() {
|
|
3125
|
+
if (!this.isConnected) return;
|
|
3126
|
+
if (this.barraFormas !== "auto") {
|
|
3127
|
+
this.definirBarraColapsada(!1);
|
|
3128
|
+
return;
|
|
3129
|
+
}
|
|
3130
|
+
const a = lo({
|
|
3131
|
+
barra: this.barra,
|
|
3132
|
+
botoesFormas: this.botoesFormas,
|
|
3133
|
+
botaoLateral: this.botaoLateral,
|
|
3134
|
+
lateralVisivel: this.emGaveta(),
|
|
3135
|
+
colapsadaAtual: this.barraColapsada,
|
|
3136
|
+
larguraObservada: this.ultimaLarguraObservada
|
|
3137
|
+
}), r = oo({
|
|
3138
|
+
colapsadaAtual: this.barraColapsada,
|
|
3139
|
+
larguraNecessaria: a.larguraNecessaria,
|
|
3140
|
+
larguraDisponivel: a.larguraDisponivel,
|
|
3141
|
+
transbordouNoDom: a.transbordouNoDom
|
|
3142
|
+
});
|
|
3143
|
+
this.definirBarraColapsada(r);
|
|
3144
|
+
}
|
|
3145
|
+
definirBarraColapsada(a) {
|
|
3146
|
+
if (a === this.barraColapsada && this.raiz.dataset.barraModo) {
|
|
3147
|
+
this.sincronizarModoBarra();
|
|
3148
|
+
return;
|
|
3149
|
+
}
|
|
3150
|
+
this.barraColapsada = a, this.sincronizarModoBarra();
|
|
3151
|
+
}
|
|
3152
|
+
sincronizarModoBarra() {
|
|
3153
|
+
var o;
|
|
3154
|
+
const a = this.barraFormas;
|
|
3155
|
+
this.raiz.dataset.barra = a;
|
|
3156
|
+
const r = a === "menu" || a === "auto" && this.barraColapsada ? "menu" : "botoes", i = this.raiz.dataset.barraModo;
|
|
3157
|
+
if (this.raiz.dataset.barraModo = r, i === "menu" && r === "botoes") {
|
|
3158
|
+
const s = this.shadow.activeElement === this.botaoFormas || this.menuFormas.contains(this.shadow.activeElement);
|
|
3159
|
+
this.fecharMenuFormas(!1), s && ((o = this.botoesFormas.querySelector("button[data-predefinicao]")) == null || o.focus());
|
|
3160
|
+
}
|
|
2932
3161
|
}
|
|
2933
3162
|
// ---------- lateral ----------
|
|
2934
3163
|
emGaveta() {
|
|
2935
|
-
const
|
|
2936
|
-
return
|
|
3164
|
+
const a = X(this.getAttribute("lateral"));
|
|
3165
|
+
return a === "gaveta" || a === "auto" && this.estreito;
|
|
2937
3166
|
}
|
|
2938
|
-
definirLargura(
|
|
2939
|
-
const r =
|
|
3167
|
+
definirLargura(a) {
|
|
3168
|
+
const r = a < to;
|
|
2940
3169
|
r !== this.estreito && (this.estreito = r, this.atualizarLateral());
|
|
2941
3170
|
}
|
|
2942
3171
|
atualizarLateral() {
|
|
2943
|
-
const
|
|
2944
|
-
|
|
3172
|
+
const a = this.emGaveta();
|
|
3173
|
+
a || (this._lateralAberta = !1), this.raiz.dataset.lateralAberta = String(this._lateralAberta), this.botaoLateral.setAttribute("aria-expanded", String(!a || this._lateralAberta)), this.botaoLateral.toggleAttribute("data-gaveta", a), this.isConnected && this.barraFormas === "auto" && this.agendarAjusteBarra();
|
|
2945
3174
|
}
|
|
2946
3175
|
/** A lateral (camadas e propriedades) está visível? Em modo fixo é sempre `true`; em gaveta, é o estado aberto/fechado. */
|
|
2947
3176
|
get lateralAberta() {
|
|
2948
3177
|
return !this.emGaveta() || this._lateralAberta;
|
|
2949
3178
|
}
|
|
2950
|
-
set lateralAberta(
|
|
2951
|
-
this.emGaveta() && (this._lateralAberta = !!
|
|
3179
|
+
set lateralAberta(a) {
|
|
3180
|
+
this.emGaveta() && (this._lateralAberta = !!a, this.atualizarLateral(), this._lateralAberta && this.painelPropriedades.focus());
|
|
2952
3181
|
}
|
|
2953
3182
|
/** `auto`, `fixa` ou `gaveta`. */
|
|
2954
3183
|
get lateral() {
|
|
2955
|
-
return
|
|
3184
|
+
return X(this.getAttribute("lateral"));
|
|
2956
3185
|
}
|
|
2957
|
-
set lateral(
|
|
2958
|
-
this.setAttribute("lateral",
|
|
3186
|
+
set lateral(a) {
|
|
3187
|
+
this.setAttribute("lateral", X(a));
|
|
2959
3188
|
}
|
|
2960
3189
|
/** `auto`, `botoes` ou `menu`. */
|
|
2961
3190
|
get barraFormas() {
|
|
2962
|
-
return
|
|
3191
|
+
return ya(this.getAttribute("barra-formas"));
|
|
3192
|
+
}
|
|
3193
|
+
set barraFormas(a) {
|
|
3194
|
+
this.setAttribute("barra-formas", ya(a));
|
|
3195
|
+
}
|
|
3196
|
+
/** `isolado` (padrão), `exclusivo`, `local` ou `modal`. */
|
|
3197
|
+
get teclado() {
|
|
3198
|
+
return j(this.getAttribute("teclado") ?? "isolado");
|
|
2963
3199
|
}
|
|
2964
|
-
set
|
|
2965
|
-
this.setAttribute("
|
|
3200
|
+
set teclado(a) {
|
|
3201
|
+
this.setAttribute("teclado", j(a));
|
|
2966
3202
|
}
|
|
2967
3203
|
// ---------- API ----------
|
|
2968
3204
|
/** A prancha interna (para usar a API completa: ferramentas, vista, exportação). */
|
|
@@ -2973,14 +3209,14 @@ class Bi extends pe {
|
|
|
2973
3209
|
get elementos() {
|
|
2974
3210
|
return this._prancha.obterElementos();
|
|
2975
3211
|
}
|
|
2976
|
-
set elementos(
|
|
2977
|
-
this._prancha.definirElementos(Array.isArray(
|
|
3212
|
+
set elementos(a) {
|
|
3213
|
+
this._prancha.definirElementos(Array.isArray(a) ? a : []);
|
|
2978
3214
|
}
|
|
2979
3215
|
get camadas() {
|
|
2980
3216
|
return this._prancha.obterCamadas();
|
|
2981
3217
|
}
|
|
2982
|
-
set camadas(
|
|
2983
|
-
this._prancha.definirCamadas(Array.isArray(
|
|
3218
|
+
set camadas(a) {
|
|
3219
|
+
this._prancha.definirCamadas(Array.isArray(a) ? a : []);
|
|
2984
3220
|
}
|
|
2985
3221
|
get modificado() {
|
|
2986
3222
|
return this._prancha.modificado;
|
|
@@ -2994,243 +3230,244 @@ class Bi extends pe {
|
|
|
2994
3230
|
}
|
|
2995
3231
|
/** Confirma: emite `editor-concluir` com os dados atuais. */
|
|
2996
3232
|
concluir() {
|
|
2997
|
-
const
|
|
2998
|
-
this.dispatchEvent(new CustomEvent("editor-concluir", { detail:
|
|
3233
|
+
const a = { elementos: this._prancha.obterElementos(), camadas: this._prancha.obterCamadas(), modificado: this._prancha.modificado };
|
|
3234
|
+
this.dispatchEvent(new CustomEvent("editor-concluir", { detail: a, bubbles: !0, composed: !0 }));
|
|
2999
3235
|
}
|
|
3000
3236
|
/** Cancela: emite `editor-cancelar`. */
|
|
3001
3237
|
cancelar() {
|
|
3002
|
-
const
|
|
3003
|
-
this.dispatchEvent(new CustomEvent("editor-cancelar", { detail:
|
|
3238
|
+
const a = { modificado: this._prancha.modificado };
|
|
3239
|
+
this.dispatchEvent(new CustomEvent("editor-cancelar", { detail: a, bubbles: !0, composed: !0 }));
|
|
3004
3240
|
}
|
|
3005
|
-
focus(
|
|
3006
|
-
this._prancha.focus(
|
|
3241
|
+
focus(a) {
|
|
3242
|
+
this._prancha.focus(a);
|
|
3007
3243
|
}
|
|
3008
3244
|
}
|
|
3009
|
-
|
|
3245
|
+
Se("ui-editor-prancha", uo);
|
|
3010
3246
|
export {
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3247
|
+
kt as ALCAS_ESCALA,
|
|
3248
|
+
Ke as ATRIBUTOS_PRANCHA,
|
|
3249
|
+
G as CAMADA_SEM_CAMADA,
|
|
3250
|
+
Ti as CANAL_COMANDOS_PRANCHA,
|
|
3251
|
+
wi as COMANDOS_PRANCHA,
|
|
3252
|
+
lt as COR_PADRAO_PRANCHA,
|
|
3253
|
+
So as DIMENSOES_FOLHA,
|
|
3254
|
+
Po as EPSILON_DETERMINANTE,
|
|
3255
|
+
Mo as ESCALA_MINIMA,
|
|
3256
|
+
gn as ESPACO_GEOGRAFICO,
|
|
3257
|
+
bt as ESPACO_PLANO,
|
|
3258
|
+
zo as ESPESSURA_PADRAO_MM,
|
|
3259
|
+
nt as ESPESSURA_TRACO_PADRAO_MM,
|
|
3260
|
+
xo as ESTILOS_TRACO,
|
|
3261
|
+
Eo as ESTILO_DO_TIPO_LINHA,
|
|
3262
|
+
Co as FAIXAS_MAXIMO,
|
|
3263
|
+
To as FAIXAS_PADRAO,
|
|
3264
|
+
Ji as FERRAMENTAS_PALETA_PRANCHA,
|
|
3265
|
+
$e as FERRAMENTAS_PRANCHA,
|
|
3266
|
+
wo as FONTE_PADRAO,
|
|
3267
|
+
Do as FORMATOS_ABNT,
|
|
3268
|
+
et as Historico,
|
|
3269
|
+
Io as IDENTIDADE,
|
|
3270
|
+
Fo as IDS_PROPRIEDADES_PRANCHA,
|
|
3271
|
+
Oa as ITENS_PREDEFINICOES,
|
|
3272
|
+
at as IndicePrancha,
|
|
3273
|
+
_o as KAPPA,
|
|
3274
|
+
to as LARGURA_ESTREITA_PX,
|
|
3275
|
+
No as LIMITE_PONTA_PADRAO,
|
|
3276
|
+
Oo as MAX_LINHAS_HACHURA,
|
|
3277
|
+
Ro as MESCLAGEM_CSS,
|
|
3278
|
+
Lo as MM_POR_PX,
|
|
3279
|
+
ko as MM_POR_UNIDADE,
|
|
3280
|
+
mr as MODOS_MESCLAGEM,
|
|
3281
|
+
ar as OPERACOES_BOOLEANAS,
|
|
3282
|
+
qo as PREDEFINICOES,
|
|
3283
|
+
Bo as PRIORIDADE_SNAP_PRANCHA,
|
|
3284
|
+
W as PX_POR_MM_100,
|
|
3285
|
+
jo as ROTULOS_PREDEFINICOES,
|
|
3286
|
+
Go as SOMBRA_PADRAO,
|
|
3287
|
+
Ho as TIPO_LINHA_DO_ESTILO,
|
|
3288
|
+
Zi as UICanvasPrancha,
|
|
3289
|
+
Ri as UICanvasPranchaBase,
|
|
3290
|
+
uo as UIEditorPrancha,
|
|
3291
|
+
$o as adaptarContextoRelativo,
|
|
3292
|
+
Xt as adicionarAncora,
|
|
3293
|
+
Mt as agrupar,
|
|
3294
|
+
Vo as ajustarAparenciaEmLote,
|
|
3295
|
+
Ko as ajustarElementosACaixa,
|
|
3296
|
+
me as alcasDoElemento,
|
|
3297
|
+
xt as alinhar,
|
|
3298
|
+
rt as analisarElemento,
|
|
3299
|
+
Zt as ancoraMaisProxima,
|
|
3300
|
+
xa as ancorasDoElemento,
|
|
3301
|
+
Wo as aparenciaDe,
|
|
3302
|
+
Rt as aplicar,
|
|
3303
|
+
de as aplicarAparencia,
|
|
3304
|
+
er as aplicarPathfinder,
|
|
3305
|
+
Uo as aplicarTodos,
|
|
3306
|
+
Xo as aplicarVetor,
|
|
3307
|
+
Zo as areaComSinal,
|
|
3308
|
+
Jo as areaDosPoligonos,
|
|
3309
|
+
Qo as avisarUmaVez,
|
|
3310
|
+
se as buscarSnapPrancha,
|
|
3311
|
+
Ea as caixaDaSelecao,
|
|
3312
|
+
St as caixaDeCantos,
|
|
3313
|
+
ve as caixaDoQuadro,
|
|
3314
|
+
Yo as caixaDoQuadroAbnt,
|
|
3315
|
+
as as caixaDoTexto,
|
|
3316
|
+
es as caixaNormalizada,
|
|
3317
|
+
Ot as caixaOrientada,
|
|
3318
|
+
te as camadaDoPainel,
|
|
3319
|
+
Ui as camadasComMudanca,
|
|
3320
|
+
Xi as camadasNaOrdemDoPainel,
|
|
3321
|
+
ts as caminhoDoContorno,
|
|
3322
|
+
rs as caminhoFinito,
|
|
3323
|
+
is as caminhoParaSvg,
|
|
3324
|
+
Ki as categoriasDePropriedades,
|
|
3325
|
+
Vi as categoriasSemSelecao,
|
|
3326
|
+
ht as centroDaSelecao,
|
|
3327
|
+
os as cisalhamento,
|
|
3328
|
+
dr as comPropriedade,
|
|
3329
|
+
qt as comRaioDeCanto,
|
|
3330
|
+
ss as comoCaminhoNaFolha,
|
|
3331
|
+
Fa as compor,
|
|
3332
|
+
ns as comprimentoDaPonta,
|
|
3333
|
+
_t as contornoDoTraco,
|
|
3334
|
+
ls as contornoElipse,
|
|
3335
|
+
cs as contornoEstrela,
|
|
3336
|
+
us as contornoLocal,
|
|
3337
|
+
ds as contornoLocalEmCache,
|
|
3338
|
+
Ca as contornoNaFolha,
|
|
3339
|
+
hs as contornoPoligonoRegular,
|
|
3340
|
+
ms as contornoRetangulo,
|
|
3341
|
+
Jt as converterAncora,
|
|
3342
|
+
Nt as converterEmCaminho,
|
|
3343
|
+
fs as corComOpacidade,
|
|
3344
|
+
ps as corNaPosicao,
|
|
3345
|
+
_a as criarCaminho,
|
|
3346
|
+
ft as criarElipse,
|
|
3347
|
+
gt as criarEstrela,
|
|
3348
|
+
vt as criarLinha,
|
|
3349
|
+
Ct as criarMascara,
|
|
3350
|
+
pt as criarPoligonoRegular,
|
|
3351
|
+
mt as criarRetangulo,
|
|
3352
|
+
At as criarTexto,
|
|
3353
|
+
Wi as dadosParaPainelDeCamadas,
|
|
3354
|
+
Yt as deMm,
|
|
3355
|
+
gs as decompor,
|
|
3356
|
+
ir as definirMedidorTexto,
|
|
3357
|
+
ut as definirRaiosDoRetangulo,
|
|
3358
|
+
zt as desagrupar,
|
|
3359
|
+
$ as desenharElementos,
|
|
3360
|
+
vs as desenharPlano,
|
|
3361
|
+
It as deslocarCaminho,
|
|
3362
|
+
bs as determinante,
|
|
3363
|
+
ys as diagnosticarContexto,
|
|
3364
|
+
As as direcaoNaPonta,
|
|
3365
|
+
Et as distribuir,
|
|
3366
|
+
Dt as dividirComLinha,
|
|
3367
|
+
he as duplicarElementos,
|
|
3368
|
+
Ss as ehFechado,
|
|
3369
|
+
Ve as ehFerramentaPrancha,
|
|
3370
|
+
Ps as ehIdentidade,
|
|
3371
|
+
ne as ehMatrizFinita,
|
|
3372
|
+
sr as ehPredefinicao,
|
|
3373
|
+
ur as ehPropriedadeDeGeometria,
|
|
3374
|
+
cr as ehPropriedadePrancha,
|
|
3375
|
+
Ms as ehSingular,
|
|
3376
|
+
tr as ehUnidadePrancha,
|
|
3377
|
+
na as elementoNoTopo,
|
|
3378
|
+
Qt as elementosNaCaixa,
|
|
3379
|
+
zs as elementosNoLaco,
|
|
3380
|
+
xs as elementosNoPonto,
|
|
3381
|
+
Es as emTornoDe,
|
|
3382
|
+
Wt as envelopeNaFolha,
|
|
3383
|
+
Na as envelopeVisual,
|
|
3384
|
+
H as escala,
|
|
3385
|
+
Cs as espelhamento,
|
|
3386
|
+
ct as espelharElementos,
|
|
3387
|
+
bo as eventoTratadoPelaPrancha,
|
|
3388
|
+
ce as excluirAncora,
|
|
3389
|
+
st as expandirGrupos,
|
|
3390
|
+
lr as exportarSvg,
|
|
3391
|
+
Ts as faixasDoGradienteLinear,
|
|
3392
|
+
ws as feicaoDoElemento,
|
|
3393
|
+
Qi as ferramentaDaPaleta,
|
|
3394
|
+
Ds as fonteSegura,
|
|
3395
|
+
Is as geometriaDaPonta,
|
|
3396
|
+
nr as gerarPredefinicao,
|
|
3397
|
+
Fs as girarElementos,
|
|
3398
|
+
Vt as guiasInteligentes,
|
|
3399
|
+
_s as iguais,
|
|
3400
|
+
Ge as instalarIsolamentoDeTeclas,
|
|
3401
|
+
He as instalarTecladoModal,
|
|
3402
|
+
Ns as inverter,
|
|
3403
|
+
We as lerMargens,
|
|
3404
|
+
j as lerModoTeclado,
|
|
3405
|
+
Tt as liberarMascara,
|
|
3406
|
+
eo as ligarPaineisPrancha,
|
|
3407
|
+
Os as limitesLocais,
|
|
3408
|
+
Y as limitesNaFolha,
|
|
3409
|
+
Rs as linhasDeHachura,
|
|
3410
|
+
it as mapaDeCamadas,
|
|
3411
|
+
Ls as mapearPontoNaCaixa,
|
|
3412
|
+
Kt as marcasDosCantos,
|
|
3413
|
+
ks as margensAbnt,
|
|
3414
|
+
qs as matriz,
|
|
3415
|
+
Ht as matrizDeCisalhamentoPorAlca,
|
|
3416
|
+
$t as matrizDeEscalaPorAlca,
|
|
3417
|
+
Bs as matrizDoElemento,
|
|
3418
|
+
js as meiaEspessura,
|
|
3419
|
+
Gs as modoDeTransformacao,
|
|
3420
|
+
Bt as moverAlcaDaAncora,
|
|
3421
|
+
jt as moverAncora,
|
|
3422
|
+
le as moverAncoras,
|
|
3423
|
+
Hs as moverElemento,
|
|
3424
|
+
$s as multiplicar,
|
|
3425
|
+
Vs as normalizarAparencia,
|
|
3426
|
+
ot as normalizarCamadas,
|
|
3427
|
+
dt as normalizarElemento,
|
|
3428
|
+
tt as normalizarElementos,
|
|
3429
|
+
Ks as normalizarGeometriaElemento,
|
|
3430
|
+
Ws as normalizarGradiente,
|
|
3431
|
+
Us as normalizarHachura,
|
|
3432
|
+
Xs as normalizarParaOrigem,
|
|
3433
|
+
Zs as operacaoBooleana,
|
|
3434
|
+
U as ordenarPorEmpilhamento,
|
|
3435
|
+
Js as padraoTipoLinhaMm,
|
|
3436
|
+
yt as paraMm,
|
|
3437
|
+
Qs as pivoNaFolha,
|
|
3438
|
+
Ys as planejar,
|
|
3439
|
+
an as planejarElemento,
|
|
3440
|
+
en as planejarElementos,
|
|
3441
|
+
tn as planoDe,
|
|
3442
|
+
rn as pontoNoAnel,
|
|
3443
|
+
Lt as posicaoLocalDaAlca,
|
|
3444
|
+
fe as posicoesDasAlcas,
|
|
3445
|
+
ge as profundidadeNoCanto,
|
|
3446
|
+
on as raiosCabiveis,
|
|
3447
|
+
pe as raiosEfetivos,
|
|
3448
|
+
sn as recompor,
|
|
3449
|
+
nn as redefinirAvisoContexto,
|
|
3450
|
+
ln as regiaoDoElemento,
|
|
3451
|
+
Pt as reordenar,
|
|
3452
|
+
pr as resolverAparencia,
|
|
3453
|
+
cn as resolverSombra,
|
|
3454
|
+
un as resumirAparencia,
|
|
3455
|
+
za as rotacao,
|
|
3456
|
+
hr as rotacaoEmGraus,
|
|
3457
|
+
Gt as rotacaoPorArrasto,
|
|
3458
|
+
Ue as rotuloDoTipo,
|
|
3459
|
+
or as saneada,
|
|
3460
|
+
Ft as simplificarCaminho,
|
|
3461
|
+
Be as teclaReservadaDoNavegador,
|
|
3462
|
+
rr as temMedidorTexto,
|
|
3463
|
+
dn as temPreenchimento,
|
|
3464
|
+
hn as testarElemento,
|
|
3465
|
+
mn as transformarContorno,
|
|
3466
|
+
ue as transformarElemento,
|
|
3467
|
+
I as transformarElementos,
|
|
3231
3468
|
k as translacao,
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3469
|
+
Ut as trechoMaisProximo,
|
|
3470
|
+
wt as unirCaminhos,
|
|
3471
|
+
fr as valorDaPropriedade,
|
|
3472
|
+
fn as varreduraDoArco
|
|
3236
3473
|
};
|