Compare commits

...

2 Commits

Author SHA1 Message Date
  Tissevert 995c298143 Implement block order rendering 8 months ago
  Tissevert c542457008 Add a new mode value 8 months ago
6 changed files with 58 additions and 15 deletions
Split View
  1. +0
    -13
      css/page.css
  2. +30
    -0
      css/page/mode/blockOrder.css
  3. +12
    -0
      css/page/mode/edit.css
  4. +1
    -0
      index.html
  5. +5
    -1
      js/Toolbar/EditMode.js
  6. +10
    -1
      js/XML/ALTO.js

+ 0
- 13
css/page.css View File

@ -23,19 +23,6 @@
position: absolute;
}
#page.editMode .String {
cursor: crosshair;
}
#page.editMode .String:hover {
border: 1px dashed red;
margin: -1px 0 0 -1px;
}
#page.editMode .String.deleted {
cursor: not-allowed;
}
#page p {
margin: 0;
white-space: nowrap;


+ 30
- 0
css/page/mode/blockOrder.css View File

@ -0,0 +1,30 @@
.BlockPosition {
display: none;
width: 100%;
height: 100%;
border: 2px solid #54e654;
color: #54e654;
/*font-weight: bold;*/
z-index: 2;
user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
}
.BlockPosition > div {
width: 100%;
font-size: 10em;
top: 50%;
margin-top: -0.5em;
text-align: center;
}
#page.blockOrderMode .BlockPosition {
display: block;
}
#page.blockOrderMode .TextLine {
opacity: 0.5;
}

+ 12
- 0
css/page/mode/edit.css View File

@ -0,0 +1,12 @@
#page.editMode .String {
cursor: crosshair;
}
#page.editMode .String:hover {
border: 1px dashed red;
margin: -1px 0 0 -1px;
}
#page.editMode .String.deleted {
cursor: not-allowed;
}

+ 1
- 0
index.html View File

@ -40,6 +40,7 @@
<select id="mode">
<option value="display" selected>Affichage seulement</option>
<option value="edit">Édition des scories</option>
<option value="blockOrder">Ordre des blocs</option>
</select>
</span>
<span id="zoom">


+ 5
- 1
js/Toolbar/EditMode.js View File

@ -2,6 +2,8 @@ import {mode, page, selector, workzone} from GUI;
import * as Rectangle from Geometry.Rectangle;
import toggleWord from Scoria;
var currentMode = null;
var selection = {
words: {},
x: {from: null, to: null},
@ -18,7 +20,9 @@ return {
};
function sync() {
page.classList[mode.value == 'edit' ? "add" : "remove"]("editMode");
page.classList.remove(currentMode);
currentMode = mode.value + 'Mode';
page.classList.add(currentMode);
}
function startRectangle(e) {


+ 10
- 1
js/XML/ALTO.js View File

@ -5,6 +5,8 @@ import GUI;
import * as Dom from UnitJS.Dom;
import * as Zoom from Toolbar.Zoom;
var blockPosition;
return {
edit: edit,
display: display
@ -12,6 +14,7 @@ return {
function display(ALTODoc) {
var page = ALTODoc.querySelector('Page');
blockPosition = 0;
Zoom.scaleTo(Element.make(page).geometry);
Dom.clear(GUI.page);
GUI.page.appendChild(makeDomNode(page.querySelector('PrintSpace')));
@ -31,7 +34,7 @@ function makeDomNode(xmlElement, parentElement) {
}
function makeChildren(xmlElement, element) {
var children = [];
var children = element.tag == 'TextBlock' ? [blockPositionElem()] : [];
xmlElement.querySelectorAll(element.childTag).forEach(function(child) {
children.push(makeDomNode(child, element));
});
@ -46,6 +49,12 @@ function setAttributes(element, attributes) {
attributes.onClick = function(e) {toggleWord(e.target)};
}
function blockPositionElem() {
return Dom.make('div', {class: 'BlockPosition'}, [
Dom.make('div', {textContent: blockPosition++})
]);
}
function edit(ALTODoc) {
var printSpace = ALTODoc.querySelector('Page PrintSpace');
editElement(printSpace);


Loading…
Cancel
Save