Skip to content

Commit

Permalink
Merge pull request #109 from lakhoune/lakhoune/issue104
Browse files Browse the repository at this point in the history
Lakhoune/issue104
  • Loading branch information
lakhoune authored Mar 14, 2023
2 parents a39e761 + 7187832 commit 74a9b6d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish to NPM on Release

on:
release:
types: [created]

env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install dependencies
run: |
cd widgets
npm install
- name: Build
run: |
cd widgets
npx rollup -c rollup.config.reduced.js --bundleConfigAsCjs
- name: Publish to NPM
env:
NODE_AUTH_TOKEN: ${{ env.NPM_AUTH_TOKEN }}
run: |
cd widgets
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > .npmrc
npm publish
12 changes: 11 additions & 1 deletion widgets/src/es6/canvas_widget/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2677,14 +2677,23 @@ export class AbstractNode extends AbstractEntity {
if (params.el.id !== this._$node.attr("id")) return true;
setTimeout(() => {
_$node.css({ opacity: "" });
// _$node.resizable("enable");
_canvas.bindMoveToolEvents();
var offsetX = Math.round(
(_$node.position().left - originalPos.left) / _canvas.getZoom()
);
var offsetY = Math.round(
(_$node.position().top - originalPos.top) / _canvas.getZoom()
);
// if offset is 0, no need to send the operation
if (offsetX === 0 && offsetY === 0) return;
// if offset bigger than canvas size, no need to send the operation
if (
Math.abs(offsetX) > _canvas.width ||
Math.abs(offsetY) > _canvas.height
) {
console.error(" offset bigger than canvas size");
return;
}

var operation = new NodeMoveOperation(
that.getEntityId(),
Expand Down Expand Up @@ -2885,6 +2894,7 @@ export class AbstractNode extends AbstractEntity {
square: true,
listeners: {
move(event) {
jsPlumbInstance.setDraggable(that._$node.get(0), false);
let { x, y } = event.target.dataset;

x = (parseFloat(x) || 0) + event.deltaRect.left;
Expand Down

0 comments on commit 74a9b6d

Please sign in to comment.