devexpress-richedit 25.1.1-alpha → 25.1.2-beta
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/bin/gulpfile.js +1 -1
- package/bin/index-custom.js +1 -1
- package/bin/localization-builder.js +1 -1
- package/bin/nspell-index.js +1 -1
- package/bin/nspell.webpack.config.js +1 -1
- package/bin/webpack-externals.js +1 -1
- package/bin/webpack.config.js +1 -1
- package/dist/dx.richedit.d.ts +1 -1
- package/dist/dx.richedit.js +714 -379
- package/dist/dx.richedit.min.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/client/client-rich-edit.js +1 -1
- package/lib/client/commands/mail-merge-command.js +2 -1
- package/lib/client/formats/docx/export/data.d.ts +5 -1
- package/lib/client/formats/docx/export/data.js +3 -2
- package/lib/client/formats/docx/export/exporter.d.ts +2 -3
- package/lib/client/formats/docx/export/exporter.js +3 -3
- package/lib/client/formats/docx/export/exporters/base/sections.d.ts +0 -1
- package/lib/client/formats/docx/export/exporters/base/sections.js +2 -10
- package/lib/client/formats/docx/export/exporters/base/table/table.d.ts +1 -1
- package/lib/client/formats/docx/export/exporters/base/table/table.js +4 -4
- package/lib/client/formats/docx/import/destination/paragraph-properties/properties/paragraph-spacing-destination.js +6 -4
- package/lib/client/model-api/formats/exporter.js +2 -2
- package/lib/client/model-api/sub-document.js +1 -1
- package/lib/client/public/rich-edit.js +2 -2
- package/lib/common/canvas/canvas-manager.js +38 -24
- package/lib/common/canvas/canvas-scroll-info.d.ts +6 -3
- package/lib/common/canvas/canvas-scroll-info.js +9 -4
- package/lib/common/canvas/canvas-scroll-manager.d.ts +4 -1
- package/lib/common/canvas/canvas-scroll-manager.js +28 -20
- package/lib/common/canvas/canvas-size-info.d.ts +3 -2
- package/lib/common/canvas/canvas-size-info.js +4 -6
- package/lib/common/canvas/renderes/canvas-listener/print-layout-view-canvas-listener.js +2 -2
- package/lib/common/canvas/renderes/common/document-renderer.d.ts +4 -1
- package/lib/common/canvas/renderes/common/document-renderer.js +15 -12
- package/lib/common/canvas/renderes/view-manager.d.ts +5 -1
- package/lib/common/canvas/renderes/view-manager.js +15 -7
- package/lib/common/formats/i-document-exporter.d.ts +3 -0
- package/lib/common/formats/rtf/export/exporter.d.ts +2 -3
- package/lib/common/formats/rtf/export/exporter.js +3 -3
- package/lib/common/formats/rtf/export/exporters/rtf-content-exporter.d.ts +4 -2
- package/lib/common/formats/rtf/export/exporters/rtf-content-exporter.js +13 -9
- package/lib/common/formats/rtf/export/exporters/table/rtf-table-exporter.d.ts +3 -2
- package/lib/common/formats/rtf/export/exporters/table/rtf-table-exporter.js +4 -4
- package/lib/common/formats/rtf/export/exporters/table/states/rtf-nested-table-exporter-state.d.ts +2 -1
- package/lib/common/formats/rtf/export/exporters/table/states/rtf-nested-table-exporter-state.js +2 -2
- package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state-base.d.ts +4 -2
- package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state-base.js +16 -9
- package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state.d.ts +2 -1
- package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state.js +2 -2
- package/lib/common/formats/rtf/import/table/normalization/apply-use-values.d.ts +6 -0
- package/lib/common/formats/rtf/import/table/normalization/apply-use-values.js +90 -0
- package/lib/common/formats/rtf/import/table/table-converter.js +7 -2
- package/lib/common/formats/rtf/importer-in-subdocument.d.ts +1 -2
- package/lib/common/formats/rtf/importer-in-subdocument.js +4 -3
- package/lib/common/input-controller.d.ts +5 -5
- package/lib/common/input-controller.js +16 -12
- package/lib/common/layout/document-layout.d.ts +5 -0
- package/lib/common/layout/document-layout.js +10 -0
- package/lib/common/layout/main-structures/layout-page-area.d.ts +3 -0
- package/lib/common/layout/main-structures/layout-page-area.js +6 -0
- package/lib/common/layout/main-structures/layout-page.d.ts +3 -0
- package/lib/common/layout/main-structures/layout-page.js +8 -0
- package/lib/common/layout/main-structures/layout-row.js +1 -2
- package/lib/common/layout-formatter/floating/position-calculators/horizontal.d.ts +1 -0
- package/lib/common/layout-formatter/floating/position-calculators/horizontal.js +16 -12
- package/lib/common/layout-formatter/row/size-engine/row-formatting-info.d.ts +4 -1
- package/lib/common/layout-formatter/row/size-engine/row-formatting-info.js +36 -2
- package/lib/common/layout-formatter/row/states.js +0 -2
- package/lib/common/layout-formatter/row/tab-info.js +5 -4
- package/lib/common/layout-formatter/table/info/table-info.d.ts +0 -1
- package/lib/common/layout-formatter/table/info/table-info.js +2 -18
- package/lib/common/layout-formatter/table/size-compressor.js +9 -2
- package/lib/common/layout-formatter/table/table-alignment-applier.js +0 -2
- package/lib/common/model/changes/change.d.ts +2 -1
- package/lib/common/model/changes/enums.d.ts +2 -1
- package/lib/common/model/changes/enums.js +1 -0
- package/lib/common/model/changes/model/zoom-level.d.ts +8 -0
- package/lib/common/model/changes/model/zoom-level.js +8 -0
- package/lib/common/model/creator/creator.js +6 -0
- package/lib/common/model/manipulators/model-manipulator.d.ts +2 -1
- package/lib/common/model/manipulators/model-manipulator.js +4 -0
- package/lib/common/model/paragraph/paragraph-style.d.ts +2 -1
- package/lib/common/model/paragraph/paragraph-style.js +2 -1
- package/lib/common/model/tables/secondary-structures/table-base-structures.d.ts +2 -1
- package/lib/common/model/tables/secondary-structures/table-base-structures.js +1 -0
- package/lib/common/mouse-handler/mouse-handler/mouse-handler-default-state.d.ts +1 -1
- package/lib/common/mouse-handler/mouse-handler/mouse-handler-default-state.js +22 -25
- package/lib/common/rich-edit-core.js +18 -18
- package/lib/common/ui/ruler/ruler.js +2 -0
- package/lib/common/utils/mixed-size.d.ts +27 -0
- package/lib/common/utils/mixed-size.js +91 -0
- package/lib/common/utils/size-utils.d.ts +14 -7
- package/lib/common/utils/size-utils.js +43 -18
- package/package.json +3 -3
package/index.d.ts
CHANGED
package/index.js
CHANGED
@@ -247,7 +247,7 @@ export class ClientRichEdit {
|
|
247
247
|
const ribbonBar = new ClientRibbonBar(this, this.element, ribbon, fonts);
|
248
248
|
this.barHolder.ribbon = ribbonBar;
|
249
249
|
if (this.core) {
|
250
|
-
this.core.modelManager.modelManipulator.
|
250
|
+
this.core.modelManager.modelManipulator.addModelListener(this.barHolder.ribbon);
|
251
251
|
this.core.selection.onChanged.add(this.barHolder.ribbon);
|
252
252
|
ribbonBar.initialize(this.core);
|
253
253
|
}
|
@@ -44,7 +44,8 @@ export class MailMergeCommand extends CommandBase {
|
|
44
44
|
return true;
|
45
45
|
}
|
46
46
|
executeCore(_state, options) {
|
47
|
-
const
|
47
|
+
const exportModelOptions = this.control.getExportModelOptions();
|
48
|
+
const docxExporter = new DocxExporter(exportModelOptions, new DocxExportOptions());
|
48
49
|
docxExporter.exportToBlob((blob) => {
|
49
50
|
const docxImporter = new Importer(new ImporterOptions());
|
50
51
|
docxImporter.importFromFile(blob, this.control.modelManager.richOptions, (documentModel, formatImagesImporter) => {
|
@@ -23,6 +23,9 @@ import { BaseSubDocumentExporter } from './exporters/sub-document/base-sub-docum
|
|
23
23
|
import { TextBoxSubDocumentExporter } from './exporters/sub-document/text-box-content-exporter';
|
24
24
|
import { IdGenerator } from './utils/id-generator';
|
25
25
|
import { WriterHelper } from './utils/writer-helper';
|
26
|
+
import { Grid } from '../../../../common/layout-formatter/table/grid-engine/grid';
|
27
|
+
import { IExportModelOptions } from '../../../../common/formats/i-document-exporter';
|
28
|
+
import { Table } from '../../../../common/model/tables/main-structures/table';
|
26
29
|
export declare class Data {
|
27
30
|
get writer(): XmlWriter;
|
28
31
|
set writer(val: XmlWriter);
|
@@ -30,6 +33,7 @@ export declare class Data {
|
|
30
33
|
get relationExporter(): RelationCollectionExporter;
|
31
34
|
get mainSubDocumentRelations(): DocumentRelationsExporter;
|
32
35
|
model: DocumentModel;
|
36
|
+
grids: Map<Table, Grid>;
|
33
37
|
options: DocxExportOptions;
|
34
38
|
headerCounter: number;
|
35
39
|
footerCounter: number;
|
@@ -58,7 +62,7 @@ export declare class Data {
|
|
58
62
|
endNotes: Map<SubDocument, number>;
|
59
63
|
private writerStack;
|
60
64
|
private relationExporters;
|
61
|
-
constructor(
|
65
|
+
constructor(exportModelOptions: IExportModelOptions, options: DocxExportOptions);
|
62
66
|
popWriter(): void;
|
63
67
|
pushRelationExporter(exporter: RelationCollectionExporter): void;
|
64
68
|
popRelationExporter(): void;
|
@@ -23,11 +23,12 @@ export class Data {
|
|
23
23
|
get subDocumentExporter() { return this.subDocumentExporterStack.last; }
|
24
24
|
get relationExporter() { return ListUtils.last(this.relationExporters); }
|
25
25
|
get mainSubDocumentRelations() { return this.relationExporters[0]; }
|
26
|
-
constructor(
|
26
|
+
constructor(exportModelOptions, options) {
|
27
27
|
this.drawingElementId = 1;
|
28
28
|
this.exportSubDocumentsList = [];
|
29
29
|
this.relationExporters = [];
|
30
|
-
this.model = model;
|
30
|
+
this.model = exportModelOptions.modelManager.model;
|
31
|
+
this.grids = exportModelOptions.grids;
|
31
32
|
this.options = options;
|
32
33
|
this.constants = new DocxConstants();
|
33
34
|
this.writerStack = new Stack();
|
@@ -1,11 +1,10 @@
|
|
1
|
-
import { IDocumentExporter } from '../../../../common/formats/i-document-exporter';
|
2
|
-
import { ModelManipulator } from '../../../../common/model/manipulators/model-manipulator';
|
1
|
+
import { IDocumentExporter, IExportModelOptions } from '../../../../common/formats/i-document-exporter';
|
3
2
|
import { DocxExportOptions } from './docx-export-options';
|
4
3
|
export declare class DocxExporter implements IDocumentExporter {
|
5
4
|
private data;
|
6
5
|
private modelManipulator;
|
7
6
|
private options;
|
8
|
-
constructor(
|
7
|
+
constructor(exportModelOptions: IExportModelOptions, options: DocxExportOptions);
|
9
8
|
exportToBlob(callback: (blob: Blob) => void): void;
|
10
9
|
exportToBase64(callback: (base64: string) => void): void;
|
11
10
|
private exportInner;
|
@@ -9,10 +9,10 @@ import { MainSubDocumentExporter } from './exporters/sub-document/main-sub-docum
|
|
9
9
|
import { ThemeExporter } from './exporters/theme';
|
10
10
|
import { EndNoteExporter, FootNoteExporter } from './exporters/sub-document/note-sub-document-exporter';
|
11
11
|
export class DocxExporter {
|
12
|
-
constructor(
|
13
|
-
this.modelManipulator = modelManipulator;
|
12
|
+
constructor(exportModelOptions, options) {
|
13
|
+
this.modelManipulator = exportModelOptions.modelManager.modelManipulator;
|
14
14
|
this.options = options;
|
15
|
-
this.data = new Data(
|
15
|
+
this.data = new Data(exportModelOptions, options);
|
16
16
|
}
|
17
17
|
exportToBlob(callback) {
|
18
18
|
this.modelManipulator.picture.loader.ensureAllPicturesLoaded(this.options.ensurePictureLoadedTimeout, (_loaded) => {
|
@@ -11,7 +11,6 @@ export declare class SectionExporter extends BaseExporter {
|
|
11
11
|
private exportSectionHeadersFootersCore;
|
12
12
|
private exportSectionPropertiesCore;
|
13
13
|
private exportSectionPage;
|
14
|
-
private shouldExportSectionPage;
|
15
14
|
private exportSectionMargins;
|
16
15
|
private exportSectionLineNumbering;
|
17
16
|
private exportSectionPageNumbering;
|
@@ -75,21 +75,13 @@ export class SectionExporter extends BaseExporter {
|
|
75
75
|
this.exportSectionGeneralSettings(props);
|
76
76
|
}
|
77
77
|
exportSectionPage(props) {
|
78
|
-
if (!this.shouldExportSectionPage(props))
|
79
|
-
return;
|
80
78
|
this.writer.writeWpStartElement('pgSz');
|
81
|
-
|
82
|
-
|
83
|
-
if (props.pageSize.height != SectionExporter.defaultProps.pageSize.height)
|
84
|
-
this.writer.writeWpIntAttr('h', props.pageSize.height);
|
79
|
+
this.writer.writeWpIntAttr('w', props.pageSize.width);
|
80
|
+
this.writer.writeWpIntAttr('h', props.pageSize.height);
|
85
81
|
if (props.landscape)
|
86
82
|
this.writer.writeWpStringAttr('orient', props.landscape ? 'landscape' : 'portrait');
|
87
83
|
this.writer.endElement();
|
88
84
|
}
|
89
|
-
shouldExportSectionPage(props) {
|
90
|
-
return !props.pageSize.equals(SectionExporter.defaultProps.pageSize) ||
|
91
|
-
props.landscape != SectionExporter.defaultProps.landscape;
|
92
|
-
}
|
93
85
|
exportSectionMargins(props) {
|
94
86
|
this.writer.writeWpStartElement('pgMar');
|
95
87
|
this.writer.writeWpIntAttr('left', props.marginLeft);
|
@@ -8,7 +8,7 @@ export declare class TableExporter extends BaseExporter {
|
|
8
8
|
private initTableDeferred;
|
9
9
|
init(): void;
|
10
10
|
checkTable(pos: number, allowInitNextTable: boolean): void;
|
11
|
-
getTableGrid
|
11
|
+
private getTableGrid;
|
12
12
|
private initNewTables;
|
13
13
|
private closeTables;
|
14
14
|
private handleNextCell;
|
@@ -6,6 +6,7 @@ import { ListUtils } from '@devexpress/utils/lib/utils/list';
|
|
6
6
|
import { BaseExporter } from '../../base';
|
7
7
|
import { TableCellPropertiesExporter } from './table-cell-properties';
|
8
8
|
import { TableRowPropertiesExporter } from './table-row-properties';
|
9
|
+
import { UnitConverter } from '@devexpress/utils/lib/class/unit-converter';
|
9
10
|
export class TableExporter extends BaseExporter {
|
10
11
|
constructor() {
|
11
12
|
super(...arguments);
|
@@ -35,10 +36,9 @@ export class TableExporter extends BaseExporter {
|
|
35
36
|
}
|
36
37
|
}
|
37
38
|
getTableGrid(table) {
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
return colGrid;
|
39
|
+
var _a, _b;
|
40
|
+
const grid = this.data.grids.get(table);
|
41
|
+
return ((_b = (_a = grid === null || grid === void 0 ? void 0 : grid.columns) === null || _a === void 0 ? void 0 : _a.width) === null || _b === void 0 ? void 0 : _b.map(UnitConverter.pixelsToTwips)) || [];
|
42
42
|
}
|
43
43
|
initNewTables(newIndexes, allowInitNextTable) {
|
44
44
|
for (let levelIndex = this.tableIndexes.length; levelIndex < newIndexes.length; levelIndex++) {
|
@@ -12,10 +12,12 @@ export class ParagraphSpacingDestination extends ParagraphFormattingLeafElementD
|
|
12
12
|
const spacingBefore = this.data.readerHelper.getWpSTIntegerValue(reader, 'before', Constants.MIN_SAFE_INTEGER);
|
13
13
|
if (spacingBefore >= 0)
|
14
14
|
this.paragraphProperties.setValue(ParagraphPropertyDescriptor.spacingBefore, spacingBefore);
|
15
|
-
this.
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
const beforeAutoSpacing = this.data.readerHelper.getWpSTOnOffValue(reader, 'beforeAutospacing', null);
|
16
|
+
if (spacingBefore == -1 || beforeAutoSpacing != null)
|
17
|
+
this.paragraphProperties.setValue(ParagraphPropertyDescriptor.beforeAutoSpacing, spacingBefore == -1 || beforeAutoSpacing);
|
18
|
+
const afterAutoSpacing = this.data.readerHelper.getWpSTOnOffValue(reader, 'afterAutospacing', null);
|
19
|
+
if (spacingAfter == -1 || afterAutoSpacing != null)
|
20
|
+
this.paragraphProperties.setValue(ParagraphPropertyDescriptor.afterAutoSpacing, spacingAfter == -1 || afterAutoSpacing);
|
19
21
|
const lineSpacing = this.data.readerHelper.getWpSTIntegerValue(reader, 'line', Constants.MIN_SAFE_INTEGER);
|
20
22
|
if (lineSpacing != Constants.MIN_SAFE_INTEGER && lineSpacing > 0) {
|
21
23
|
const attribute = new WordProcessingMLValue('lineRule', 'line-rule');
|
@@ -15,8 +15,8 @@ export function exportModelToBlob(exportModelOptions, callback) {
|
|
15
15
|
function getExporter(exportModelOptions) {
|
16
16
|
const { modelManipulator } = exportModelOptions.modelManager;
|
17
17
|
switch (exportModelOptions.documentFormat) {
|
18
|
-
case DocumentFormat.OpenXml: return new DocxExporter(
|
19
|
-
case DocumentFormat.Rtf: return new RtfExporter(
|
18
|
+
case DocumentFormat.OpenXml: return new DocxExporter(exportModelOptions, new DocxExportOptions());
|
19
|
+
case DocumentFormat.Rtf: return new RtfExporter(exportModelOptions, new RtfDocumentExporterOptions());
|
20
20
|
case DocumentFormat.PlainText: return new TxtExporter(modelManipulator, new DocumentExporterOptions());
|
21
21
|
case DocumentFormat.Html: return new HtmlDocumentExporter(exportModelOptions, new DocumentExporterOptions());
|
22
22
|
default:
|
@@ -211,7 +211,7 @@ export class SubDocumentApi {
|
|
211
211
|
}
|
212
212
|
getRtf(interval) {
|
213
213
|
const coreInterval = this._checkInterval(interval);
|
214
|
-
return getRtfFromSubDocumentPublic(this._processor
|
214
|
+
return getRtfFromSubDocumentPublic(this._processor, this._subDocument, coreInterval);
|
215
215
|
}
|
216
216
|
insertContent(position, content, documentFormat, callback) {
|
217
217
|
position = ApiParametersChecker.check(position, 1, false, [
|
@@ -160,11 +160,11 @@ class RichEditPublic {
|
|
160
160
|
command.execute(true, type);
|
161
161
|
}
|
162
162
|
get readOnly() {
|
163
|
-
return this._native.core.readOnly
|
163
|
+
return this._native.core.readOnly === ReadOnlyMode.Persistent;
|
164
164
|
}
|
165
165
|
set readOnly(value) {
|
166
166
|
if (this.readOnly != value) {
|
167
|
-
this._native.core.
|
167
|
+
this._native.core.setPersistentReadOnly(value);
|
168
168
|
this._native.core.barHolder.updateItemsState();
|
169
169
|
this._native.core.horizontalRulerControl.update();
|
170
170
|
this._native.core.beginUpdate();
|
@@ -13,6 +13,7 @@ import { CursorPointer } from '../mouse-handler/mouse-handler/mouse-handler';
|
|
13
13
|
import { ResizeBoxListener } from './listeners/resize-box-listener';
|
14
14
|
import { SimpleViewCanvasSizeManager } from './renderes/common/document-renderer';
|
15
15
|
import { SizeUtils } from '../utils/size-utils';
|
16
|
+
import { MixedSize } from '../utils/mixed-size';
|
16
17
|
const SCROLL_INTERVAL_MS = 50;
|
17
18
|
const CSSCLASS_FOCUSED = "dxreInFocus";
|
18
19
|
const AUTOSCROLL_AREA_SIZE = 10;
|
@@ -248,35 +249,40 @@ export class CanvasManager extends BatchUpdatableObject {
|
|
248
249
|
const clientRect = canvas.getBoundingClientRect();
|
249
250
|
const scaleX = this.getScale(clientRect.width, canvas.offsetWidth);
|
250
251
|
const scaleY = this.getScale(clientRect.height, canvas.offsetHeight);
|
251
|
-
const clientX = EvtUtils.getEventX(evt)
|
252
|
-
const clientY = EvtUtils.getEventY(evt)
|
253
|
-
const canvasX = DomUtils.getAbsolutePositionX(canvas)
|
254
|
-
const canvasY = DomUtils.getAbsolutePositionY(canvas)
|
255
|
-
const offsetY = canvas.scrollTop
|
256
|
-
const pageIndex = this.
|
257
|
-
const visibleAreaWidth = this.sizes.getVisibleAreaWidth(false)
|
258
|
-
const visibleAreaHeight = this.sizes.getVisibleAreaHeight(false)
|
252
|
+
const clientX = MixedSize.fromUI(EvtUtils.getEventX(evt));
|
253
|
+
const clientY = MixedSize.fromUI(EvtUtils.getEventY(evt));
|
254
|
+
const canvasX = MixedSize.fromUI(DomUtils.getAbsolutePositionX(canvas));
|
255
|
+
const canvasY = MixedSize.fromUI(DomUtils.getAbsolutePositionY(canvas));
|
256
|
+
const offsetY = MixedSize.fromUI(canvas.scrollTop).addSize(clientY).subtractSize(canvasY).useScale(scaleY);
|
257
|
+
const pageIndex = this.viewManager.layout.findPageIndexByOffsetY(offsetY.LayoutSize, this.sizes);
|
258
|
+
const visibleAreaWidth = MixedSize.fromUI(this.sizes.getVisibleAreaWidth(false));
|
259
|
+
const visibleAreaHeight = MixedSize.fromUI(this.sizes.getVisibleAreaHeight(false));
|
259
260
|
if (checkScroll) {
|
260
|
-
|
261
|
+
const relativeX = new MixedSize().useScale(scaleX).addSize(canvasX).addSize(visibleAreaWidth).subtractSize(clientX);
|
262
|
+
if (this.sizes.scrollYVisible && relativeX.LayoutSize < 0)
|
261
263
|
return LayoutPoint.Empty();
|
262
|
-
|
264
|
+
const relativeY = new MixedSize().useScale(scaleY).addSize(canvasY).addSize(visibleAreaHeight).subtractSize(clientY);
|
265
|
+
if (this.sizes.scrollXVisible && relativeY.LayoutSize < 0)
|
263
266
|
return LayoutPoint.Empty();
|
264
267
|
}
|
265
268
|
const layoutPage = this.viewManager.layout.pages[pageIndex];
|
266
269
|
const renderPageCacheElem = this.viewManager.cache[pageIndex];
|
267
270
|
if (!layoutPage || !renderPageCacheElem)
|
268
271
|
return LayoutPoint.Empty();
|
269
|
-
|
272
|
+
const pageX = new MixedSize().useScale(scaleX).addUISize(canvas.scrollLeft).addSize(clientX).subtractSize(canvasX).subtractLayoutSize(renderPageCacheElem.page.offsetLeft).LayoutSize;
|
273
|
+
const pageY = new MixedSize().useScale(scaleY).addSize(offsetY).subtractLayoutSize(this.sizes.getPageOffsetY(layoutPage)).LayoutSize;
|
274
|
+
return new LayoutPoint(pageIndex, pageX, pageY);
|
270
275
|
}
|
271
276
|
isVisiblePosition(layoutPoint) {
|
272
|
-
const
|
273
|
-
this.
|
277
|
+
const layout = this.viewManager.layout;
|
278
|
+
const zoomLevel = this.viewManager.zoomLevel;
|
279
|
+
this.scroll.updatePageIndexesInfo(layout);
|
274
280
|
if (layoutPoint.pageIndex < this.scroll.startVisiblePageIndex || layoutPoint.pageIndex > this.scroll.endVisiblePageIndex)
|
275
281
|
return false;
|
276
|
-
const pageY = this.sizes.getPageOffsetY(pages[layoutPoint.pageIndex]);
|
277
|
-
const pageX = this.viewManager.cache[layoutPoint.pageIndex].page.offsetLeft;
|
278
|
-
const x = pageX
|
279
|
-
const y = pageY
|
282
|
+
const pageY = MixedSize.fromLayout(this.sizes.getPageOffsetY(layout.pages[layoutPoint.pageIndex])).useScale(zoomLevel);
|
283
|
+
const pageX = MixedSize.fromLayout(this.viewManager.cache[layoutPoint.pageIndex].page.offsetLeft).useScale(zoomLevel);
|
284
|
+
const x = pageX.addLayoutSize(layoutPoint.x).UISize;
|
285
|
+
const y = pageY.addLayoutSize(layoutPoint.y).UISize;
|
280
286
|
return x >= this.scroll.lastScrollLeft && x <= this.sizes.getVisibleAreaWidth(false) + this.scroll.lastScrollLeft &&
|
281
287
|
y >= this.scroll.lastScrollTop && y <= this.sizes.getVisibleAreaHeight(false) + this.scroll.lastScrollTop;
|
282
288
|
}
|
@@ -324,17 +330,23 @@ export class CanvasManager extends BatchUpdatableObject {
|
|
324
330
|
onScrollIntervalTick() {
|
325
331
|
const evtX = this.lastMousePosition.x;
|
326
332
|
const evtY = this.lastMousePosition.y;
|
327
|
-
const inHorizontalArea = evtX >= this.canvasPosition.x && evtX <= this.canvasPosition.x + this.sizes.getVisibleAreaWidth(
|
328
|
-
const inVerticalArea = evtY >= this.canvasPosition.y && evtY <= this.canvasPosition.y + this.sizes.getVisibleAreaHeight(
|
333
|
+
const inHorizontalArea = evtX >= this.canvasPosition.x && evtX <= this.canvasPosition.x + this.sizes.getVisibleAreaWidth(false);
|
334
|
+
const inVerticalArea = evtY >= this.canvasPosition.y && evtY <= this.canvasPosition.y + this.sizes.getVisibleAreaHeight(false);
|
329
335
|
if (!inHorizontalArea && !inVerticalArea)
|
330
336
|
return;
|
337
|
+
const yOffsetWithoutScrollbar = this.canvasPosition.y + this.sizes.getVisibleAreaHeight(false) - evtY;
|
338
|
+
const yOffsetWithScrollbar = this.canvasPosition.y + this.sizes.getVisibleAreaHeight(true) - evtY;
|
339
|
+
const outsideHorizontalScrollbar = yOffsetWithoutScrollbar > 0 || yOffsetWithScrollbar < 0;
|
331
340
|
if (inHorizontalArea && evtY - this.canvasPosition.y <= AUTOSCROLL_AREA_SIZE)
|
332
341
|
this.viewManager.canvas.scrollTop -= AUTOSCROLL_STEP;
|
333
|
-
else if (inHorizontalArea &&
|
342
|
+
else if (inHorizontalArea && yOffsetWithoutScrollbar <= AUTOSCROLL_AREA_SIZE && outsideHorizontalScrollbar)
|
334
343
|
this.viewManager.canvas.scrollTop += AUTOSCROLL_STEP;
|
344
|
+
const xOffsetWithoutScrollbar = this.canvasPosition.x + this.sizes.getVisibleAreaWidth(false) - evtX;
|
345
|
+
const xOffsetWithScrollbar = this.canvasPosition.x + this.sizes.getVisibleAreaWidth(true) - evtX;
|
346
|
+
const outsideVerticalScrollbar = xOffsetWithoutScrollbar > 0 || xOffsetWithScrollbar < 0;
|
335
347
|
if (inVerticalArea && evtX - this.canvasPosition.x <= AUTOSCROLL_AREA_SIZE)
|
336
348
|
this.viewManager.canvas.scrollLeft -= AUTOSCROLL_STEP;
|
337
|
-
else if (inVerticalArea &&
|
349
|
+
else if (inVerticalArea && xOffsetWithoutScrollbar <= AUTOSCROLL_AREA_SIZE && outsideVerticalScrollbar)
|
338
350
|
this.viewManager.canvas.scrollLeft += AUTOSCROLL_STEP;
|
339
351
|
}
|
340
352
|
static getCursorClassName(pointer) {
|
@@ -378,10 +390,12 @@ export class CanvasManager extends BatchUpdatableObject {
|
|
378
390
|
return ResizeBoxListener.directionToSource[className.substr(ind + cornerPrefix.length, 2).trim()];
|
379
391
|
}
|
380
392
|
getScrollTopInfo() {
|
381
|
-
const pages = this.viewManager.layout.pages;
|
382
393
|
const scrollTop = this.viewManager.canvas.scrollTop;
|
383
|
-
const pageIndex = this.
|
384
|
-
|
394
|
+
const pageIndex = this.viewManager.layout.findPageIndexByOffsetY(scrollTop, this.sizes);
|
395
|
+
const pages = this.viewManager.layout.pages;
|
396
|
+
const zoomLevel = this.viewManager.zoomLevel;
|
397
|
+
const pageOffsetY = this.sizes.getPageOffsetY(pages[pageIndex]);
|
398
|
+
return new ScrollTopInfo(pageIndex, new MixedSize().useScale(zoomLevel).addUISize(scrollTop).subtractLayoutSize(pageOffsetY).LayoutSize);
|
385
399
|
}
|
386
400
|
}
|
387
401
|
export class ScrollTopInfo {
|
@@ -1,9 +1,11 @@
|
|
1
|
-
import { LayoutPage } from '../layout/main-structures/layout-page';
|
2
1
|
import { BoundaryInterval } from '@devexpress/utils/lib/intervals/boundary';
|
3
2
|
import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
|
4
3
|
import { IInternalApi } from '../internal-api';
|
5
4
|
import { CanvasSizeInfo } from './canvas-size-info';
|
6
|
-
|
5
|
+
import { DocumentLayout } from '../layout/document-layout';
|
6
|
+
import { IModelChangesListener } from '../interfaces/model-changes-listener';
|
7
|
+
import { ModelChange } from '../model/changes/change';
|
8
|
+
export declare class CanvasScrollInfo implements IModelChangesListener {
|
7
9
|
protected static VISIBLE_PAGES_RANGE: number;
|
8
10
|
protected static VISIBLE_PAGES_RANGE_TOUCH: number;
|
9
11
|
protected static VISIBLE_AREA_HEIGHT_MULTIPLIER: number;
|
@@ -17,11 +19,12 @@ export declare class CanvasScrollInfo {
|
|
17
19
|
readonly internalApi: IInternalApi;
|
18
20
|
private _needUpdatePageIndexes;
|
19
21
|
constructor(canvas: HTMLDivElement, sizes: CanvasSizeInfo, internalApi: IInternalApi);
|
22
|
+
modelChanged(change: ModelChange): void;
|
20
23
|
init(canvas: HTMLDivElement, sizes: CanvasSizeInfo): void;
|
21
24
|
getStartRenderPageIndex(): number;
|
22
25
|
getEndRenderPageIndex(): number;
|
23
26
|
renderPageIndexInterval(): FixedInterval;
|
24
|
-
updatePageIndexesInfo(
|
27
|
+
updatePageIndexesInfo(layout: DocumentLayout): void;
|
25
28
|
getVisibleInterval(): BoundaryInterval;
|
26
29
|
private getScrollTop;
|
27
30
|
private getVisibleHeight;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Browser } from '@devexpress/utils/lib/browser';
|
2
2
|
import { BoundaryInterval } from '@devexpress/utils/lib/intervals/boundary';
|
3
3
|
import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
|
4
|
+
import { ModelChangeType } from '../model/changes/enums';
|
4
5
|
export class CanvasScrollInfo {
|
5
6
|
constructor(canvas, sizes, internalApi) {
|
6
7
|
this.lastScrollTop = -1;
|
@@ -11,6 +12,10 @@ export class CanvasScrollInfo {
|
|
11
12
|
this.internalApi = internalApi;
|
12
13
|
this.init(canvas, sizes);
|
13
14
|
}
|
15
|
+
modelChanged(change) {
|
16
|
+
if (change.type == ModelChangeType.ZoomLevelChanged)
|
17
|
+
this.onCanvasSizeChanged();
|
18
|
+
}
|
14
19
|
init(canvas, sizes) {
|
15
20
|
this.canvas = canvas;
|
16
21
|
this.sizes = sizes;
|
@@ -25,16 +30,16 @@ export class CanvasScrollInfo {
|
|
25
30
|
renderPageIndexInterval() {
|
26
31
|
return FixedInterval.fromPositions(this.getStartRenderPageIndex(), this.getEndRenderPageIndex() + 1);
|
27
32
|
}
|
28
|
-
updatePageIndexesInfo(
|
29
|
-
if (!pages.length)
|
33
|
+
updatePageIndexesInfo(layout) {
|
34
|
+
if (!layout.pages.length)
|
30
35
|
return;
|
31
36
|
const scrollTop = this.getScrollTop();
|
32
37
|
this.lastScrollLeft = this.canvas.scrollLeft;
|
33
38
|
if (this.startVisiblePageIndex >= 0 && scrollTop == this.lastScrollTop && !this._needUpdatePageIndexes)
|
34
39
|
return;
|
35
40
|
this._needUpdatePageIndexes = false;
|
36
|
-
this.startVisiblePageIndex =
|
37
|
-
this.endVisiblePageIndex =
|
41
|
+
this.startVisiblePageIndex = layout.findPageIndexByOffsetY(scrollTop, this.sizes);
|
42
|
+
this.endVisiblePageIndex = layout.findPageIndexByOffsetY(scrollTop + this.getVisibleHeight(), this.sizes);
|
38
43
|
this.lastScrollTop = scrollTop;
|
39
44
|
}
|
40
45
|
getVisibleInterval() {
|
@@ -2,7 +2,9 @@ import { IScrollLayoutChangesListener } from '../interfaces/i-selection-layout-c
|
|
2
2
|
import { ICanvasState } from '../scroll/canvas-states';
|
3
3
|
import { IRulerControl } from '../ui/ruler/ruler';
|
4
4
|
import { ViewManager } from './renderes/view-manager';
|
5
|
-
|
5
|
+
import { IModelChangesListener } from '../interfaces/model-changes-listener';
|
6
|
+
import { ModelChange } from '../model/changes/change';
|
7
|
+
export declare class CanvasScrollManager implements IScrollLayoutChangesListener, IModelChangesListener {
|
6
8
|
private updateScrollTimeoutId;
|
7
9
|
private waitForDblClickTimeoutId;
|
8
10
|
private horizontalRuler;
|
@@ -11,6 +13,7 @@ export declare class CanvasScrollManager implements IScrollLayoutChangesListener
|
|
11
13
|
private get sizes();
|
12
14
|
constructor(viewManager: ViewManager, horizontalRuler: IRulerControl);
|
13
15
|
dispose(): void;
|
16
|
+
modelChanged(change: ModelChange): void;
|
14
17
|
get scrollTop(): number;
|
15
18
|
set scrollTop(val: number);
|
16
19
|
setScrollEnabled(enabled: boolean): void;
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { DocumentLayoutDetailsLevel } from '../layout/document-layout-details-level';
|
2
2
|
import { MouseHandler } from '../mouse-handler/mouse-handler/mouse-handler';
|
3
3
|
import { RelativePosition } from '../scroll/model-states';
|
4
|
+
import { MixedSize } from '../utils/mixed-size';
|
5
|
+
import { ModelChangeType } from '../model/changes/enums';
|
4
6
|
export class CanvasScrollManager {
|
5
7
|
get canvas() { return this.viewManager.canvas; }
|
6
8
|
get sizes() { return this.viewManager.sizes; }
|
@@ -14,6 +16,10 @@ export class CanvasScrollManager {
|
|
14
16
|
clearTimeout(this.updateScrollTimeoutId);
|
15
17
|
clearTimeout(this.waitForDblClickTimeoutId);
|
16
18
|
}
|
19
|
+
modelChanged(change) {
|
20
|
+
if (change.type == ModelChangeType.ZoomLevelChanged)
|
21
|
+
this.updateScrollVisibility();
|
22
|
+
}
|
17
23
|
get scrollTop() { return this.canvas.scrollTop; }
|
18
24
|
set scrollTop(val) { this.canvas.scrollTop = val; }
|
19
25
|
setScrollEnabled(enabled) {
|
@@ -32,46 +38,48 @@ export class CanvasScrollManager {
|
|
32
38
|
scrollToX(canvasState) {
|
33
39
|
const position = canvasState.lp;
|
34
40
|
const relativePosition = canvasState.relativePosition;
|
35
|
-
|
36
|
-
|
41
|
+
const zoomLevel = this.viewManager.zoomLevel;
|
42
|
+
const page = this.viewManager.layout.pages[position.pageIndex];
|
43
|
+
let y = MixedSize.fromLayout(this.sizes.getPageOffsetY(page)).useScale(zoomLevel);
|
44
|
+
let height = new MixedSize().useScale(zoomLevel);
|
37
45
|
if (position.detailsLevel >= DocumentLayoutDetailsLevel.PageArea) {
|
38
|
-
y
|
46
|
+
y.addLayoutSize(position.pageArea.y);
|
39
47
|
if (position.detailsLevel >= DocumentLayoutDetailsLevel.Column) {
|
40
|
-
y
|
48
|
+
y.addLayoutSize(position.column.y);
|
41
49
|
if (position.detailsLevel >= DocumentLayoutDetailsLevel.Row) {
|
42
|
-
y
|
50
|
+
y.addLayoutSize(position.row.y);
|
43
51
|
if (relativePosition === RelativePosition.Bottom)
|
44
|
-
y
|
52
|
+
y.addLayoutSize(position.row.height);
|
45
53
|
else if (relativePosition === RelativePosition.Inside)
|
46
|
-
height
|
54
|
+
height.clear().addLayoutSize(position.row.height);
|
47
55
|
}
|
48
56
|
else if (relativePosition === RelativePosition.Bottom)
|
49
|
-
y
|
57
|
+
y.addLayoutSize(position.column.height);
|
50
58
|
else if (relativePosition === RelativePosition.Inside)
|
51
|
-
height
|
59
|
+
height.clear().addLayoutSize(position.column.height);
|
52
60
|
}
|
53
61
|
else if (relativePosition === RelativePosition.Bottom)
|
54
|
-
y
|
62
|
+
y.addLayoutSize(position.pageArea.height);
|
55
63
|
else if (relativePosition === RelativePosition.Inside)
|
56
|
-
height
|
64
|
+
height.clear().addLayoutSize(position.pageArea.height);
|
57
65
|
}
|
58
66
|
else if (relativePosition === RelativePosition.Bottom)
|
59
|
-
y
|
67
|
+
y.addLayoutSize(position.page.height);
|
60
68
|
else if (relativePosition === RelativePosition.Inside)
|
61
|
-
height
|
69
|
+
height.clear().addLayoutSize(position.page.height);
|
62
70
|
if (relativePosition === RelativePosition.Bottom)
|
63
|
-
y
|
64
|
-
y
|
71
|
+
y.subtractUISize(this.sizes.getVisibleAreaHeight(false));
|
72
|
+
y.addUISize(canvasState.getVerticalOffset(this.sizes));
|
65
73
|
if (relativePosition === RelativePosition.Inside) {
|
66
74
|
let scrollTop = this.canvas.scrollTop;
|
67
75
|
const scrollVisibleAreaHeight = this.sizes.getVisibleAreaHeight(false);
|
68
|
-
if (y < scrollTop)
|
69
|
-
this.canvas.scrollTop = y;
|
70
|
-
else if (y + height > scrollVisibleAreaHeight + scrollTop)
|
71
|
-
this.canvas.scrollTop = y + height - scrollVisibleAreaHeight;
|
76
|
+
if (y.UISize < scrollTop)
|
77
|
+
this.canvas.scrollTop = y.UISize;
|
78
|
+
else if (y.UISize + height.UISize > scrollVisibleAreaHeight + scrollTop)
|
79
|
+
this.canvas.scrollTop = y.UISize + height.UISize - scrollVisibleAreaHeight;
|
72
80
|
}
|
73
81
|
else
|
74
|
-
this.canvas.scrollTop = y;
|
82
|
+
this.canvas.scrollTop = y.UISize;
|
75
83
|
}
|
76
84
|
NotifyScrollPositionChanged(canvasState) {
|
77
85
|
if (this.updateScrollTimeoutId) {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { IControlHeightProvider } from './i-control-height-provider';
|
2
2
|
import { LayoutPage } from '../layout/main-structures/layout-page';
|
3
3
|
import { RenderPageVertivalInfo } from '../view-settings/views-settings';
|
4
|
+
import { IZoomLevelHolder } from '../interfaces/i-zoom-level-holder';
|
4
5
|
export declare class CanvasSizeInfo implements IControlHeightProvider {
|
5
6
|
topSpacing: number;
|
6
7
|
betweenPageSpacing: number;
|
@@ -8,11 +9,11 @@ export declare class CanvasSizeInfo implements IControlHeightProvider {
|
|
8
9
|
scrollYVisible: boolean;
|
9
10
|
private visibleAreaSize;
|
10
11
|
private scrollWidth;
|
12
|
+
private zoomLevelHolder;
|
11
13
|
pageVerticalInfo: RenderPageVertivalInfo;
|
12
|
-
constructor();
|
14
|
+
constructor(zoomLevelHolder: IZoomLevelHolder);
|
13
15
|
isInitialized(): boolean;
|
14
16
|
initialize(page: HTMLElement, canvas: HTMLDivElement): void;
|
15
|
-
findPageIndexByOffsetY(pages: LayoutPage[], offsetY: number): number;
|
16
17
|
getPageOffsetY(layoutPage: LayoutPage): number;
|
17
18
|
private setVisibleAreaSize;
|
18
19
|
getVisibleAreaWidth(includeScrollBars: boolean): number;
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import { RenderPageVertivalInfo } from '../view-settings/views-settings';
|
2
2
|
import { Size } from '@devexpress/utils/lib/geometry/size';
|
3
|
-
import { SearchUtils } from '@devexpress/utils/lib/utils/search';
|
4
3
|
import { DomUtils } from '@devexpress/utils/lib/utils/dom';
|
5
4
|
import { SizeUtils } from '../utils/size-utils';
|
6
5
|
export class CanvasSizeInfo {
|
7
|
-
constructor() {
|
6
|
+
constructor(zoomLevelHolder) {
|
8
7
|
this.topSpacing = -1;
|
9
8
|
this.betweenPageSpacing = 1;
|
10
9
|
this.visibleAreaSize = new Size(-1, -1);
|
11
10
|
this.scrollWidth = -1;
|
12
11
|
this.pageVerticalInfo = new RenderPageVertivalInfo();
|
12
|
+
this.zoomLevelHolder = zoomLevelHolder;
|
13
13
|
this.scrollWidth = DomUtils.getVerticalScrollBarWidth();
|
14
14
|
}
|
15
15
|
isInitialized() {
|
@@ -21,11 +21,9 @@ export class CanvasSizeInfo {
|
|
21
21
|
this.betweenPageSpacing = this.pageVerticalInfo.betweenPageSpacing;
|
22
22
|
this.setVisibleAreaSize(SizeUtils.getClientWidth(canvas), SizeUtils.getClientHeight(canvas));
|
23
23
|
}
|
24
|
-
findPageIndexByOffsetY(pages, offsetY) {
|
25
|
-
return Math.max(0, SearchUtils.normedInterpolationIndexOf(pages, (p) => this.getPageOffsetY(p), offsetY));
|
26
|
-
}
|
27
24
|
getPageOffsetY(layoutPage) {
|
28
|
-
|
25
|
+
const pageOffsetY = layoutPage.y + (this.topSpacing + layoutPage.index * this.betweenPageSpacing);
|
26
|
+
return pageOffsetY * this.zoomLevelHolder.zoomLevel;
|
29
27
|
}
|
30
28
|
setVisibleAreaSize(width, height) {
|
31
29
|
this.visibleAreaSize.width = width;
|
@@ -74,9 +74,9 @@ export class PrintLayoutViewCanvasListener extends CanvasListener {
|
|
74
74
|
Log.paramsHolder.visualizerManager.show(DebugVisualizerType.LayoutBounds, this.layout, p.index); }));
|
75
75
|
}
|
76
76
|
updateVisiblePages() {
|
77
|
-
|
78
|
-
this.viewManager.scroll.updatePageIndexesInfo(pages);
|
77
|
+
this.viewManager.scroll.updatePageIndexesInfo(this.layout);
|
79
78
|
const renderInterval = this.viewManager.scroll.renderPageIndexInterval();
|
79
|
+
const pages = this.layout.pages;
|
80
80
|
for (let pageIndex of this.handledPageIndexes)
|
81
81
|
if (!renderInterval.contains(pageIndex)) {
|
82
82
|
const page = pages[pageIndex];
|
@@ -25,8 +25,10 @@ import { Size } from '@devexpress/utils/lib/geometry/size';
|
|
25
25
|
import { CanvasManager } from '../../canvas-manager';
|
26
26
|
import { ViewManager } from '../view-manager';
|
27
27
|
import { IRichEditControl } from '../../../interfaces/i-rich-edit-core';
|
28
|
+
import { IModelChangesListener } from '../../../interfaces/model-changes-listener';
|
29
|
+
import { ModelChange } from '../../../model/changes/change';
|
28
30
|
export type GetSomeCanvasElementContainer = (node: Node) => Node;
|
29
|
-
export declare class SimpleViewCanvasSizeManager {
|
31
|
+
export declare class SimpleViewCanvasSizeManager implements IModelChangesListener {
|
30
32
|
protected canvasManager: CanvasManager;
|
31
33
|
protected size: Size;
|
32
34
|
private control;
|
@@ -36,6 +38,7 @@ export declare class SimpleViewCanvasSizeManager {
|
|
36
38
|
private resizeFrameId;
|
37
39
|
constructor(canvasManager: CanvasManager, control: IRichEditControl);
|
38
40
|
dispose(): void;
|
41
|
+
modelChanged(change: ModelChange): void;
|
39
42
|
changeSize(force: boolean): void;
|
40
43
|
setViewMode(val: boolean): void;
|
41
44
|
private changeSizeCore;
|