Using Vue.JS to integrate custom shapes into my mxGraph library

Currently in the process of developing a flowchart editor using MXGraph, I recently integrated it into my Vue.JS project. To do this, I utilized NPM to install the mxgraph library and incorporated the following code to acquire the necessary references in each file:

import * as mxgraph from 'mxgraph';

const {
    mxClient, mxGraph, mxUtils, mxEvent, mxConstraintHandler, mxConnectionHandler, mxEditor, mxGraphModel, mxKeyHandler, mxConstants, mxGraphView
} = mxgraph();

I imported the flowchart editor into Vue.js as a plugin:

import Vue from 'vue'
import flowchartEditor from './plugins/flowchartEditor/flowchartEditor';


import App from './App.vue'
import store from './store/store'
import router from './router/router'

Vue.config.productionTip = false
Vue.use(flowchartEditor);

new Vue({
  store,
  router,
  render: h => h(App)
}).$mount('#app')

The Vue view for the flowchart tool has a route set up, and upon navigating to that route, the flowchart editor displays correctly. However, the issue arises with my custom registered shapes not functioning as intended. The Start node is meant to be round, but instead, all custom shapes appear square: https://i.sstatic.net/Y7p3Z.png

The image below showcases the same code running outside of Vue.JS, solely with Webpack: https://i.sstatic.net/hiwiv.png

This snippet depicts how the custom shapes are created and registered:

addCustomShapes(graph) {
        //Ellipse representing the start node
        function ellipse() {};
        ellipse.prototype = new mxEllipse();
        ellipse.prototype.constructor = ellipse;

        registerCustomShape(graph, ellipse, 'start');
    },

function registerCustomShape(graph, shape, name) {    
    mxCellRenderer.registerShape(name, shape);

    let style = graph.getStylesheet().getDefaultVertexStyle();
    style[mxConstants.STYLE_SHAPE] = name;
    style[mxConstants.STYLE_FILLCOLOR] = '#ffffff';
    style[mxConstants.STYLE_STROKECOLOR] = '#000000';
    style[mxConstants.STYLE_FONTCOLOR] = '#000000';
    style[mxConstants.STYLE_FONTSIZE] = '16';

    style = graph.getStylesheet().getDefaultEdgeStyle();
    style[mxConstants.STYLE_STROKECOLOR] = '#000000';
    style[mxConstants.STYLE_FONTCOLOR] = '#000000';
    style[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR] = '#ffffff';
    style['fontStyle'] = '0';
    style['fontStyle'] = '0';
    style[mxConstants.STYLE_FONTSIZE] = '16';
    style['startSize'] = '8';
    style['endSize'] = '8';
}

Below is the code that sets the newly registered shape as the default shape to generate the start node:

setCustomShape(graph, name) {
        var style = graph.getStylesheet().getDefaultVertexStyle();
        style[mxConstants.STYLE_SHAPE] = "4";

        return style
    }

I have already followed the MXGraph tutorial (tutorial) without success. This situation is quite perplexing to me, and any assistance would be greatly appreciated.

Apologies for the lengthy post, but I am struggling with this and hoping someone can offer guidance.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Cannot utilize remote.require() in TypeScript due to compatibility issues

Recently, I've been facing a frustrating issue while developing an Electron application in TypeScript. I've been trying to execute a module from a renderer process using the code snippet below: import { remote } from 'electron' const ...

Unforeseen issue within Vuejs-nuxt (SSR Mode) is preventing the retrieval of the UserUUID through the getter in plugins, resulting in an unexpected '

In my vuejs-nuxt project using SSR mode, I encountered an issue when trying to call a socket event. I need to pass the userID to the socket from the store. The GetUserUUID getter functions properly in all other APIs except when called from the "plugin/sock ...

Unusual JavaScript AJAX antics

I have a situation that looks like this: elFinder.prototype.commands.info = function() { this.exec = function(hashes) { var temp_array = new Array(), temp_html = new String(); var request = new XMLHttpRequest(); ...

Ajax is not able to trigger a POST request to a PHP form

My form is not posting for some unknown reason, despite everything else on my server functioning properly. Below is the code snippet in question: PHP <?php if(isset($_POST['field1']) && isset($_POST['field2'])) { $data ...

Fancybox displaying error message: "Sorry, we are unable to load the requested content at this time. Please try again later."

Utilizing Fancybox for the purpose of displaying YouTube videos in a modal box. I am encountering an issue where I consistently receive the error message "The requested content cannot be loaded. Please try again later." The fact that the modal box is app ...

Vue i18n does not support dynamic changing of locales

I'm currently working on a small Vue application where I am trying to incorporate the vue-i18n plugin for multilingual support. I successfully installed the vue-i18n plugin using the Vue CLI and configured it with two locales. Manually changing the lo ...

Accessing an array within a function from a separate .JS file

Currently, I am facing a somewhat awkward predicament where I have a function in main.js that requires an array that is populated in second.js... In simple terms, the function in main.js is designed to be reusable: function chug() { p1.innerHTML = st ...

What is the best method to extract the 'id' key from an object in an API endpoint with an array, to enable data updates using the PUT method in React?

Today, I encountered a situation where I needed to utilize the PUT method in React to modify a specific piece of data within an API. The endpoint that led me to this scenario is as follows: { "pagination": { "sortDirectio ...

"Enhance Your Video Experience with a Personalized Play Button

Is it possible to customize the play icon for an embedded YouTube video? I came across a post discussing this topic: Can I change the play icon of embedded youtube videos? However, when trying to use something transparent as the new play button, the origin ...

Discovering the names of files in a directory with Angular

Looking for a solution in Angular JS within a ModX app to retrieve file names from the gallery package every time it is updated. Is there a way to achieve this using Angular? I've been searching for Javascript solutions to this issue, but most of the ...

Django AJAX: CSRF Token Missing Error - Failed CSRF Verification due to missing token

Attempting to fetch json serialized data from the Django web server has resulted in a 403 error, indicating that CSRF verification failed due to a missing or incorrect token. Below is the script in question: $(document).ready(function(){ var invsearc ...

Display the data returned from a computed property PromiseResult using VueJS

After calculating the property shown below, it will output res, which is a Promise object. The reason I cannot place this script inside the created() or mounted() hook is due to the fact that this.selectedObject is null at that time. I am satisfied with t ...

Slerping with quaternions in Three.js can produce undesirable outcomes when near the poles

Check out this video example: https://drive.google.com/file/d/18Ep4i1JMs7QvW9m-3U4oyQ4sM0CfIFzP/view In the demonstration, I showcase how I determine the world position of a ray hitting a globe under the mouse cursor. By utilizing lookAt() with a THREE.Gr ...

Cookies with HttpOnly are not included in the server request

Having developed an API in node express running on port :8000, I am consuming these APIs via a simple CRA on port :3000. The registration and login process includes setting an httpOnly cookie. Additionally, I have implemented middleware to verify each endp ...

Unable to construct React/Next project - identified page lacking a React Component as default export (context api file)

When attempting to compile my Next.js project, I encountered an error message in the terminal: Error: Build optimization failed: found page without a React Component as default export in pages/components/context/Context The file in question is utilizing ...

Uploading video files using XMLHttpRequest encountered an error on a particular Android device

One of our testers encountered an issue where they failed to upload a video file (.mp4) on a specific Android mobile phone. Interestingly, the same file uploaded successfully on an iPhone and another Android device. To investigate further, I attempted to ...

Ensure that a specific value is maintained for a property of an element throughout its animation

There are two distinct types of components that I am working with, which I will refer to as .a and .b. It is possible that these components have been assigned certain CSS animations. I do not have the ability to control these keyframes, whether they are a ...

Is your jQuery .on function failing to properly detect click events?

Seems like I'm missing something here. Why is the .on function not functioning as expected in this code snippet? <html> <head> </head> <body> <button type="button" class="close" data-test="test">TEST BUTTON< ...

I aim to utilize JavaScript to capture the constantly changing font color that is randomly generated

Is there a way to extract the font color from a table element? #FF0000 For example, it could be #568000 etc.. Here's my table <table class="mytable"> <th class=vertical bgcolor=#C0C0C0 align=center> <font color=#FF0000 size= ...

What sets apart a post API call from form submission using the post method?

Is it possible to call the payment gateway from Node.js using a POST API call? I understand that traditionally the payment gateway is called through form submission with the method set as post, which redirects to a new page. However, if I use a POST API ...