-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
local link type added #247
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, just some small comments there :)
const d = buildLinkPathDefinition({ source: { x: x1, y: y1 }, target: { x: x2, y: y2 } }, config.link.type); | ||
const d = buildLinkPathDefinition( | ||
{ source: { x: x1, y: y1 }, target: { x: x2, y: y2 }, linktype }, | ||
config.link.type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type is already being passed to buildLinkPathDefinition
, there's no need to duplicate the paramenter. I would go with:
const type = linkType || config.link.type;
const d = buildLinkPathDefinition(
{ source: { x: x1, y: y1 }, target: { x: x2, y: y2 }, linktype },
type,
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o well i over did it i kept thinking that type argument is global scoped now i realized what was wrong haha thanks a lot i have made the changes
src/components/link/link.helper.js
Outdated
@@ -68,10 +68,10 @@ function getRadiusStrategy(type) { | |||
* @returns {string} the path definition for the requested link | |||
* @memberof Link/helper | |||
*/ | |||
function buildLinkPathDefinition({ source = {}, target = {} }, type = LINE_TYPES.STRAIGHT) { | |||
function buildLinkPathDefinition({ source = {}, target = {}, linktype }, type = LINE_TYPES.STRAIGHT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you take my previous suggestion, you don't need to modify the function signature. The type
is already passed in the second parameter, this function was already ready to receive a type from the exterior :)
src/components/link/link.helper.js
Outdated
const { x: sx, y: sy } = source; | ||
const { x: tx, y: ty } = target; | ||
const validType = LINE_TYPES[type] || LINE_TYPES.STRAIGHT; | ||
const validType = LINE_TYPES[linktype] || LINE_TYPES[type]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here, in fact, no need to update this function at all, it should work just fine with the previous implementation.
Just taking a second look at it, It is much better to have constant naming as type so i am not destructuring it anymore rather accessing it like this.
Now inside the local properties the changes can be seen with type only distinctively locally and globally |
Hey @gopherine makes sense to me. |
Note, this PR refers to issue #234. |
I have added local link type i dont know if i used the right naming convention. I did not wanted to break anything so for now i have just named it linktype but locallink and globallink sounds more sensible or may be if we can add config hirarchy inside the local itself