From 842db9432c78a6f5d022e15cf28321fe63f8ece8 Mon Sep 17 00:00:00 2001 From: etowahadams Date: Thu, 6 Jun 2024 17:45:54 -0400 Subject: [PATCH 1/4] feat: move mouseEvents out of experimental --- src/gosling-schema/gosling.schema.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gosling-schema/gosling.schema.ts b/src/gosling-schema/gosling.schema.ts index d36ff29b..2fde9d50 100644 --- a/src/gosling-schema/gosling.schema.ts +++ b/src/gosling-schema/gosling.schema.ts @@ -418,13 +418,13 @@ interface SingleTrackBase extends CommonTrackDef { // Tooltip tooltip?: Tooltip[]; + /* + * Determine whether to use mouse events, such as click and mouse over on marks. __Default__: `false` + */ + mouseEvents?: boolean | MouseEventsDeep; + // Experimental experimental?: { - /* - * Determine whether to use mouse events, such as click and mouse over on marks. __Default__: `false` - */ - mouseEvents?: boolean | MouseEventsDeep; - /** * Render visual marks with less smooth curves to increase rendering performance. * Only supported for `elliptical` `linkStyle` `withinLink` currently. From bdb59bf8332c4f528c73ce85cdb51b5225b6e416 Mon Sep 17 00:00:00 2001 From: etowahadams Date: Thu, 6 Jun 2024 17:47:28 -0400 Subject: [PATCH 2/4] fix: remove experimental from mouseEvents in goslingTrack --- src/tracks/gosling-track/gosling-track.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tracks/gosling-track/gosling-track.ts b/src/tracks/gosling-track/gosling-track.ts index e761fc3f..aa361623 100644 --- a/src/tracks/gosling-track/gosling-track.ts +++ b/src/tracks/gosling-track/gosling-track.ts @@ -1126,7 +1126,7 @@ const factory: PluginTrackFactory = (HGC, context, op this.#mouseDownY = mouseY; // Determine whether to activate a range brush - const mouseEvents = this.options.spec.experimental?.mouseEvents; + const mouseEvents = this.options.spec.mouseEvents; const rangeSelectEnabled = !!mouseEvents || (IsMouseEventsDeep(mouseEvents) && !!mouseEvents.rangeSelect); this.#isRangeBrushActivated = rangeSelectEnabled && isAltPressed; @@ -1148,7 +1148,7 @@ const factory: PluginTrackFactory = (HGC, context, op // `trackClick` API this.#publishTrackEvents('trackClick', mouseX, mouseY); - const mouseEvents = this.options.spec.experimental?.mouseEvents; + const mouseEvents = this.options.spec.mouseEvents; const clickEnabled = !!mouseEvents || (IsMouseEventsDeep(mouseEvents) && !!mouseEvents.click); const isDrag = Math.sqrt((this.#mouseDownX - mouseX) ** 2 + (this.#mouseDownY - mouseY) ** 2) > 1; @@ -1205,7 +1205,7 @@ const factory: PluginTrackFactory = (HGC, context, op // TODO: `Omit` this properties in the schema of individual overlaid tracks. // These should be defined only once for a group of overlaid traks (09-May-2022) // See https://github.com/gosling-lang/gosling.js/issues/677 - const mouseEvents = this.options.spec.experimental?.mouseEvents; + const mouseEvents = this.options.spec.mouseEvents; const multiHovering = IsMouseEventsDeep(mouseEvents) && mouseEvents.enableMouseOverOnMultipleMarks; const idField = IsMouseEventsDeep(mouseEvents) && mouseEvents.groupMarksByField; @@ -1289,7 +1289,7 @@ const factory: PluginTrackFactory = (HGC, context, op // Deselect marks if their siblings are not selected. // e.g., if only one exon is selected in a gene, we do not select it. - const mouseEvents = this.options.spec.experimental?.mouseEvents; + const mouseEvents = this.options.spec.mouseEvents; const idField = IsMouseEventsDeep(mouseEvents) && mouseEvents.groupMarksByField; if (capturedElements.length !== 0 && idField) { models.forEach(model => { @@ -1404,7 +1404,7 @@ const factory: PluginTrackFactory = (HGC, context, op } if (capturedElements.length !== 0) { - const mouseEvents = this.options.spec.experimental?.mouseEvents; + const mouseEvents = this.options.spec.mouseEvents; const mouseOverEnabled = !!mouseEvents || (IsMouseEventsDeep(mouseEvents) && !!mouseEvents.mouseOver); if (mouseOverEnabled) { // Display mouse over effects @@ -1598,7 +1598,7 @@ const factory: PluginTrackFactory = (HGC, context, op (acc, spec) => acc && stretchableMarks.includes(spec.mark), true ); - const noMouseInteractions = !this.options.spec.experimental?.mouseEvents; + const noMouseInteractions = !this.options.spec.mouseEvents; return isFirstTrack1D && isNotCircularLayout && hasStretchableMark && noMouseInteractions; } From 6510a940d3eecad791f8b1c36315a30f9b80b24a Mon Sep 17 00:00:00 2001 From: etowahadams Date: Thu, 6 Jun 2024 17:49:13 -0400 Subject: [PATCH 3/4] fix: change mouseEvent in spec --- editor/example/json-spec/mouse-event.ts | 50 ++++++++++--------------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/editor/example/json-spec/mouse-event.ts b/editor/example/json-spec/mouse-event.ts index f3a4da12..2e908c50 100644 --- a/editor/example/json-spec/mouse-event.ts +++ b/editor/example/json-spec/mouse-event.ts @@ -43,11 +43,9 @@ export const EX_SPEC_MOUSE_EVENT: GoslingSpec = { { title: 'Individual Marks', ...BAR, - experimental: { - mouseEvents: { - mouseOver: true, - rangeSelect: true - } + mouseEvents: { + mouseOver: true, + rangeSelect: true }, style: { mouseOver: { @@ -72,12 +70,10 @@ export const EX_SPEC_MOUSE_EVENT: GoslingSpec = { { title: 'Group Marks By Sample', ...BAR, - experimental: { - mouseEvents: { - mouseOver: true, - rangeSelect: true, - groupMarksByField: 'sample' - } + mouseEvents: { + mouseOver: true, + rangeSelect: true, + groupMarksByField: 'sample' }, style: { mouseOver: { @@ -102,12 +98,10 @@ export const EX_SPEC_MOUSE_EVENT: GoslingSpec = { { title: 'Group Marks By Genomic Position', ...BAR, - experimental: { - mouseEvents: { - mouseOver: true, - rangeSelect: true, - groupMarksByField: 'position' - } + mouseEvents: { + mouseOver: true, + rangeSelect: true, + groupMarksByField: 'position' }, style: { mouseOver: { @@ -167,12 +161,10 @@ export const EX_SPEC_MOUSE_EVENT: GoslingSpec = { tooltip: [{ field: 'name', type: 'nominal' }], width: BAR.width, height: BAR.height, - experimental: { - mouseEvents: { - mouseOver: true, - rangeSelect: true, - groupMarksByField: 'name' - } + mouseEvents: { + mouseOver: true, + rangeSelect: true, + groupMarksByField: 'name' }, style: { mouseOver: { @@ -200,13 +192,11 @@ export const EX_SPEC_MOUSE_EVENT: GoslingSpec = { size: { value: 20 }, height: 60, tooltip: [{ field: 'Chr.', type: 'nominal' }], - experimental: { - mouseEvents: { - click: true, - mouseOver: true, - rangeSelect: true, - groupMarksByField: 'Chr.' - } + mouseEvents: { + click: true, + mouseOver: true, + rangeSelect: true, + groupMarksByField: 'Chr.' }, style: { mouseOver: { From 706235a549f461d3121d34ddb66a1495eed3d1fc Mon Sep 17 00:00:00 2001 From: etowahadams Date: Thu, 6 Jun 2024 17:49:57 -0400 Subject: [PATCH 4/4] feat: updated schema --- src/gosling-schema/gosling.schema.json | 320 ++++++++++++------------- 1 file changed, 160 insertions(+), 160 deletions(-) diff --git a/src/gosling-schema/gosling.schema.json b/src/gosling-schema/gosling.schema.json index 4a1c1eba..5c1b8d9f 100644 --- a/src/gosling-schema/gosling.schema.json +++ b/src/gosling-schema/gosling.schema.json @@ -1258,16 +1258,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -1311,6 +1301,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -1419,16 +1419,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -1472,6 +1462,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -2044,16 +2044,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -2097,6 +2087,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -2205,16 +2205,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -2258,6 +2248,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -2887,16 +2887,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -2940,6 +2930,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -4137,16 +4137,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -4182,6 +4172,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -4464,16 +4464,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -4517,6 +4507,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -4829,16 +4829,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -4882,6 +4872,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -5212,16 +5212,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -5257,6 +5247,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -5555,16 +5555,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -5618,6 +5608,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -6109,16 +6109,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -6162,6 +6152,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -6477,16 +6477,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -6530,6 +6520,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -6634,16 +6634,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -6687,6 +6677,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -7256,16 +7256,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -7309,6 +7299,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -7413,16 +7413,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -7466,6 +7456,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ { @@ -8088,16 +8088,6 @@ "experimental": { "additionalProperties": false, "properties": { - "mouseEvents": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/definitions/MouseEventsDeep" - } - ] - }, "performanceMode": { "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", @@ -8141,6 +8131,16 @@ "mark": { "$ref": "#/definitions/Mark" }, + "mouseEvents": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/definitions/MouseEventsDeep" + } + ] + }, "opacity": { "anyOf": [ {