diff --git a/package.json b/package.json index a521c8de05a794369102e2be7a2f1cd8bdb914fd..fbbbe0ff7e528094ba0849c5442663a82ab5bad3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "medsurf-draw", - "version": "1.0.237", + "version": "1.0.238", "description": "Draw annotations on jpg/zoomify images, based on PIXI.js", "keywords": [ "draw", diff --git a/src/app/index.ts b/src/app/index.ts index f39749df4a7e16f34568b8a9fa00574c67241fe0..b58361d3004cc0d4086ffe6b339a532538a66cf1 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -19,15 +19,15 @@ import { PixiPlugin } from 'gsap/PixiPlugin.js'; - Toggle submenus -> change hitbox when open and reset selection when outside - Selektion der Fläche -> wird nicht geändert. scheint andere elemente zu ändern -> no events ??? - Fill unset line color creates black lines -> fix this - Selftest add new element only for selftest -> use ellipse for this (make ellipse smaller once clicked) - otherwise elements like arrow / rectangle / ... will be shown (not nice) - FillLine: "isPointInPolygon" and "getNearestPointForPoint" function wrong; - Line: Hitbox not defined -> HOW TO ??? - Interactions anpassen; siehe dazu CloneInteraction -> kann einfacher so umgesetzt werden (Scale auf Draw nicht mehr notwendig; ausbauen) -> Test: Move events in Draw / Copy / Selection Generator + - Selftest add new element only for selftest -> use ellipse for this (make ellipse smaller once clicked) - otherwise elements like arrow / rectangle / ... will be shown (not nice) + - FillLine: "isPointInPolygon" and "getNearestPointForPoint" function wrong; + - Line: Hitbox not defined -> HOW TO ??? + - Selftest selcet interaction available -> WHY? - Speicherfehler - Menu verschiebung auf LayerGruppe when Schrift angepasst wird (How to???) - --- + - Menu verschiebung auf LayerGruppe when Schrift angepasst wird (How to???) + Interactions anpassen; siehe dazu CloneInteraction -> kann einfacher so umgesetzt werden (Scale auf Draw nicht mehr notwendig; ausbauen) -> Test: Move events in Draw / Copy / Selection Generator Verpixelung ??? -> grössere Schrift - -- not possible -- Reset der position when contextmenu klicket (How TO????) + Create Behaviour/Interaction -> to eliminate/clean up the elements */ // Element Refs diff --git a/src/lib/elements/fills/FillCollection.ts b/src/lib/elements/fills/FillCollection.ts index 15f99e37b01ce4e82e4c4e8afa773a373825313b..87ccd0d16c649d16b7040bdc5ab891f51f01c21a 100644 --- a/src/lib/elements/fills/FillCollection.ts +++ b/src/lib/elements/fills/FillCollection.ts @@ -290,6 +290,7 @@ export class FillCollection extends BaseElementContainer<Models.FillCollection, // TODO remove this -> prevent some strange behaviour // line.on("draw", this.draw, this); line.on("onPointUpdate", this.draw.bind(this), this); + line.on("onPointUpdate", this.emit.bind(this, "onFillMove"), this); // line.on("positionPointAdded", this._positionPointAdded, this); // line.on("removed", this._onRemoveButton, this); }); @@ -302,6 +303,7 @@ export class FillCollection extends BaseElementContainer<Models.FillCollection, //<editor-fold desc="Events"> this.lines.forEach((line: MedsurfDraw.Line) => { line.on("onPointUpdate", this.draw.bind(this), this); + line.on("onPointUpdate", this.emit.bind(this, "onFillMove"), this); }); //</editor-fold> @@ -315,6 +317,7 @@ export class FillCollection extends BaseElementContainer<Models.FillCollection, //<editor-fold desc="Events"> this.lines.forEach((line) => { line.off("onPointUpdate", this.draw, this); + line.off("onPointUpdate", this.emit.bind(this, "onFillMove"), this); }); //</editor-fold> } @@ -793,6 +796,7 @@ export class FillCollection extends BaseElementContainer<Models.FillCollection, // Add events line.on("onPointUpdate", this.draw.bind(this), this); + line.on("onPointUpdate", this.emit.bind(this, "onFillMove"), this); } /** diff --git a/src/lib/elements/primitives/ArrowPrimitive.ts b/src/lib/elements/primitives/ArrowPrimitive.ts index f0575b13b9e93363456d1b41820324462b2841d5..ccc5ce911e3b39fab0dbc4e6d7af83c7d779fc2d 100644 --- a/src/lib/elements/primitives/ArrowPrimitive.ts +++ b/src/lib/elements/primitives/ArrowPrimitive.ts @@ -1570,8 +1570,14 @@ export class ArrowPrimitive extends BaseElementContainer<Models.ArrowPrimitive, */ public onHover(): void { // Setup - this._arrowElement.options.lineColor = Design.primitive.lineColorHover; - this._arrowElement.options.fillColor = Design.primitive.fillColorHover; + if (this.modeInteraction.lastMode !== 'selftest') { + this._arrowElement.options.lineColor = Design.primitive.lineColorHover; + this._arrowElement.options.fillColor = Design.primitive.fillColorHover; + } else { + this._selftestElement.options.lineColor = Design.primitive.lineColorHover; + this._selftestElement.options.fillColor = Design.primitive.fillColorHover; + } + // Draw this.emit("debounceDraw"); @@ -1583,6 +1589,7 @@ export class ArrowPrimitive extends BaseElementContainer<Models.ArrowPrimitive, public onOut(): void { // Setup this._arrowElement.options = Object.assign({}, this.model.options); + this._selftestElement.options = Object.assign({}, this.model.options); // Draw this.emit("debounceDraw"); diff --git a/src/lib/elements/primitives/EllipsePrimitive.ts b/src/lib/elements/primitives/EllipsePrimitive.ts index 106e7983817f2012aefd27e9b6a89fffc0e9ef2e..fd368b30289080691edd7b7eaa79d321da7a6145 100644 --- a/src/lib/elements/primitives/EllipsePrimitive.ts +++ b/src/lib/elements/primitives/EllipsePrimitive.ts @@ -1486,8 +1486,14 @@ export class EllipsePrimitive extends BaseElementContainer<Models.EllipsePrimiti */ public onHover(): void { // Setup - this._ellipseElement.options.lineColor = Design.primitive.lineColorHover; - this._ellipseElement.options.fillColor = Design.primitive.fillColorHover; + if (this.modeInteraction.lastMode !== 'selftest') { + this._ellipseElement.options.lineColor = Design.primitive.lineColorHover; + this._ellipseElement.options.fillColor = Design.primitive.fillColorHover; + } else { + this._selftestElement.options.lineColor = Design.primitive.lineColorHover; + this._selftestElement.options.fillColor = Design.primitive.fillColorHover; + } + // Draw this.emit("debounceDraw"); @@ -1499,6 +1505,7 @@ export class EllipsePrimitive extends BaseElementContainer<Models.EllipsePrimiti public onOut(): void { // Setup this._ellipseElement.options = Object.assign({}, this.model.options); + this._selftestElement.options = Object.assign({}, this.model.options); // Draw this.emit("debounceDraw"); diff --git a/src/lib/elements/primitives/RectanglePrimitive.ts b/src/lib/elements/primitives/RectanglePrimitive.ts index 52a89723008c3cc56e795bc08803cef6d56fb397..e87da7e0faa010eb6931adfa44bcd107cf4fbd00 100644 --- a/src/lib/elements/primitives/RectanglePrimitive.ts +++ b/src/lib/elements/primitives/RectanglePrimitive.ts @@ -1487,8 +1487,13 @@ export class RectanglePrimitive extends BaseElementContainer<Models.RectanglePri */ public onHover(): void { // Setup - this._rectangleElement.options.lineColor = Design.primitive.lineColorHover; - this._rectangleElement.options.fillColor = Design.primitive.fillColorHover; + if (this.modeInteraction.lastMode !== 'selftest') { + this._rectangleElement.options.lineColor = Design.primitive.lineColorHover; + this._rectangleElement.options.fillColor = Design.primitive.fillColorHover; + } else { + this._selftestElement.options.lineColor = Design.primitive.lineColorHover; + this._selftestElement.options.fillColor = Design.primitive.fillColorHover; + } // Draw this.emit("debounceDraw"); @@ -1500,6 +1505,7 @@ export class RectanglePrimitive extends BaseElementContainer<Models.RectanglePri public onOut(): void {; // Setup this._rectangleElement.options = Object.assign({}, this.model.options); + this._selftestElement.options = Object.assign({}, this.model.options); // Draw this.emit("debounceDraw"); diff --git a/src/lib/elements/primitives/TextPrimitive.ts b/src/lib/elements/primitives/TextPrimitive.ts index 61fcac92083f3baf24a04ed019af52e1d2427311..47718275e07d3e9e34cdcea938205f38e6b956c6 100644 --- a/src/lib/elements/primitives/TextPrimitive.ts +++ b/src/lib/elements/primitives/TextPrimitive.ts @@ -1649,7 +1649,12 @@ export class TextPrimitive extends BaseElementContainer<Models.TextPrimitive, Ba */ public onHover(): void { // Setup - this._textElement.style.fill = Design.primitive.lineColorHover; + if (this.modeInteraction.lastMode !== 'selftest') { + this._textElement.style.fill = Design.primitive.lineColorHover; + } else { + this._selftestElement.options.lineColor = Design.primitive.lineColorHover; + this._selftestElement.options.fillColor = Design.primitive.fillColorHover; + } // Draw this.emit("debounceDraw"); @@ -1674,6 +1679,8 @@ export class TextPrimitive extends BaseElementContainer<Models.TextPrimitive, Ba // Setup // @ts-ignore TODO ignore this._textElement.style = new PIXI.TextStyle(style); + this._selftestElement.options = {hasLine: true, lineColor: style.fill, lineAlpha: 1, + hasFill: true, fillColor: style.fill, fillAlpha: 1}; // Draw this.emit("debounceDraw");