diff options
author | Dennis Francis <dennis.francis@collabora.com> | 2022-04-11 10:34:44 +0530 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-04-14 10:12:53 +0200 |
commit | af163fbdf141e6833ee45e0cd4a77cb4fd58d91c (patch) | |
tree | 7d920e2d1e436de937520de625acf252b8e54e14 | |
parent | don't set cursor to IBeam unless textinput has the focus (diff) | |
download | online-af163fbdf141e6833ee45e0cd4a77cb4fd58d91c.tar.gz online-af163fbdf141e6833ee45e0cd4a77cb4fd58d91c.zip |
enable eslint for CDarkOverlay.ts
* Use unix line endings.
* Use tabs instead of spaces to indent.
* Remove eslint-disable flag.
Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Change-Id: Ic7fe77097c0e1b652636e5771fd4835d547ffa90
-rw-r--r-- | browser/src/layer/vector/CDarkOverlay.ts | 132 |
1 files changed, 65 insertions, 67 deletions
diff --git a/browser/src/layer/vector/CDarkOverlay.ts b/browser/src/layer/vector/CDarkOverlay.ts index 7d9140731f..ce08904c73 100644 --- a/browser/src/layer/vector/CDarkOverlay.ts +++ b/browser/src/layer/vector/CDarkOverlay.ts @@ -1,67 +1,65 @@ -/* eslint-disable */
-
-/*
- * CDarkOverlay is used to render a dark overlay around an OLE object when selected
- */
-
-import Bounds = cool.Bounds;
-
-class CDarkOverlay extends CPathGroup{
-
- private rectangles: CRectangle[] = [];
- private options: any;
-
- constructor(pointSet: CPointSet, options: any) {
- super([]);
- this.options = options;
- this.rectangles = this.createRectangles(4);
- this.setPointSet(pointSet);
- }
-
- private setPointSet(pointSet: CPointSet) {
- var points = pointSet.getPointArray();
- if (!points) {
- for (var i = 0; i < this.rectangles.length; i++){
- this.rectangles[i].setBounds(
- new cool.Bounds(new cool.Point(0, 0), new cool.Point(0, 1)));
- this.push(this.rectangles[i]);
- }
- return;
- }
-
- var rectangleBounds = this.invertOleBounds(new cool.Bounds(points[0], points[2]));
-
- for (var i = 0; i < this.rectangles.length; i++){
- this.rectangles[i].setBounds(rectangleBounds[i]);
- this.push(this.rectangles[i]);
- }
- }
-
- private invertOleBounds(oleBounds: cool.Bounds): cool.Bounds[] {
- var rectanglesBounds: cool.Bounds[] = [];
-
- var minWidth = 0;
- var minHeight = 0;
- var fullWidth = 1000000;
- var fullHeight = 1000000;
-
- rectanglesBounds.push(new cool.Bounds(new cool.Point(minWidth, minHeight), new cool.Point(fullWidth, oleBounds.min.y)));
- rectanglesBounds.push(new cool.Bounds(new cool.Point(minWidth, oleBounds.min.y), oleBounds.getBottomLeft()));
- rectanglesBounds.push(new cool.Bounds(oleBounds.getTopRight(), new cool.Point(fullWidth, oleBounds.max.y)));
- rectanglesBounds.push(new cool.Bounds(new cool.Point(minWidth, oleBounds.max.y), new cool.Point(fullWidth, fullHeight)));
-
- return rectanglesBounds;
- }
-
- private createRectangles(quantity : number): CRectangle[] {
- var rectangles: CRectangle[] = [];
- for (var i = 0; i < quantity; i++){
- rectangles.push(
- new CRectangle(new cool.Bounds(
- new cool.Point(0, 0), new cool.Point(0, 1)
- ), this.options));
- }
-
- return rectangles;
- }
-}
\ No newline at end of file +/* + * CDarkOverlay is used to render a dark overlay around an OLE object when selected + */ + +import Bounds = cool.Bounds; + +class CDarkOverlay extends CPathGroup { + + private rectangles: CRectangle[] = []; + private options: any; + + constructor(pointSet: CPointSet, options: any) { + super([]); + this.options = options; + this.rectangles = this.createRectangles(4); + this.setPointSet(pointSet); + } + + private setPointSet(pointSet: CPointSet) { + var points = pointSet.getPointArray(); + if (!points) { + for (var i = 0; i < this.rectangles.length; i++) { + this.rectangles[i].setBounds( + new cool.Bounds(new cool.Point(0, 0), new cool.Point(0, 1))); + this.push(this.rectangles[i]); + } + return; + } + + var rectangleBounds = this.invertOleBounds(new cool.Bounds(points[0], points[2])); + + for (var i = 0; i < this.rectangles.length; i++) { + this.rectangles[i].setBounds(rectangleBounds[i]); + this.push(this.rectangles[i]); + } + } + + private invertOleBounds(oleBounds: cool.Bounds): cool.Bounds[] { + var rectanglesBounds: cool.Bounds[] = []; + + var minWidth = 0; + var minHeight = 0; + var fullWidth = 1000000; + var fullHeight = 1000000; + + rectanglesBounds.push(new cool.Bounds(new cool.Point(minWidth, minHeight), new cool.Point(fullWidth, oleBounds.min.y))); + rectanglesBounds.push(new cool.Bounds(new cool.Point(minWidth, oleBounds.min.y), oleBounds.getBottomLeft())); + rectanglesBounds.push(new cool.Bounds(oleBounds.getTopRight(), new cool.Point(fullWidth, oleBounds.max.y))); + rectanglesBounds.push(new cool.Bounds(new cool.Point(minWidth, oleBounds.max.y), new cool.Point(fullWidth, fullHeight))); + + return rectanglesBounds; + } + + private createRectangles(quantity: number): CRectangle[] { + var rectangles: CRectangle[] = []; + for (var i = 0; i < quantity; i++) { + rectangles.push( + new CRectangle(new cool.Bounds( + new cool.Point(0, 0), new cool.Point(0, 1) + ), this.options)); + } + + return rectangles; + } +} |