Skip to content

Commit

Permalink
Merge pull request #351 from brmodeloweb/release/v0.1.2
Browse files Browse the repository at this point in the history
Release/v0.1.3
  • Loading branch information
miltonbsn authored Jun 23, 2022
2 parents 0e24c36 + 097573d commit 8f2156d
Show file tree
Hide file tree
Showing 27 changed files with 1,312 additions and 1,954 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## Web application for database modeling and teaching

![Hero shot](https://raw.githubusercontent.com/brmodeloweb/brmodelo-site/master/img/hero-shot.png)
![Hero shot](https://raw.githubusercontent.com/brmodeloweb/brmodelo-site/master/img/hero-shot-en.png)
> Released under the [Apache License 2.0](https://choosealicense.com/licenses/apache-2.0/)
## Dependencies
Expand Down
4 changes: 2 additions & 2 deletions app/angular/conceptual/conceptual.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
</header>

<div class="mainContent">
<section class="stencil-list" id="stencil-holder">
<!-- Insert elemes to be used in model constrution -->
<section class="elements-holder">
<!-- Insert elements to be used in model constrution -->
</section>

<section id="content" class="model-area">
Expand Down
74 changes: 29 additions & 45 deletions app/angular/conceptual/conceptual.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ import $ from "jquery";

import * as joint from "jointjs/dist/joint";

import "../../joint/joint.ui.stencil";
import "../../joint/joint.ui.stencil.css";
import "../../joint/joint.ui.selectionView";
import "../../joint/joint.ui.selectionView.css";
import "../../joint/joint.ui.halo.css";
import "../../joint/joint.ui.halo";
import "../../joint/br-scroller";
import "../../joint/joint.dia.command";
import "../editor/editorManager";
import "../editor/editorScroller";
import "../editor/editorActions";
import "../editor/elementActions";

import shapes from "../../joint/shapes";
joint.shapes.erd = shapes;

Expand Down Expand Up @@ -48,12 +45,11 @@ const controller = function (ModelAPI, $stateParams, $rootScope, $timeout, $uibM
user: $rootScope.loggeduser
}
ctrl.selectedElement = {};
ctrl.selectedHalo = {};
ctrl.selectedElementActions = {};
const configs = {
graph: {},
paper: {},
paperScroller: {},
commandManager: {},
editorActions: {},
keyboardController: null,
};

Expand Down Expand Up @@ -90,23 +86,23 @@ const controller = function (ModelAPI, $stateParams, $rootScope, $timeout, $uibM
}

ctrl.undoModel = () => {
configs.commandManager.undo();
configs.editorActions.undo();
}

ctrl.redoModel = () => {
configs.commandManager.redo();
configs.editorActions.redo();
}

ctrl.zoomIn = () => {
configs.paperScroller.zoom(0.1, { max: 2 });
configs.editorScroller.zoom(0.1, { max: 2 });
}

ctrl.zoomOut = () => {
configs.paperScroller.zoom(-0.1, { min: 0.2 });
configs.editorScroller.zoom(-0.1, { min: 0.2 });
}

ctrl.zoomNone = () => {
configs.paperScroller.zoom();
configs.editorScroller.zoom();
}

ctrl.duplicateModel = (model) => {
Expand Down Expand Up @@ -152,10 +148,9 @@ const controller = function (ModelAPI, $stateParams, $rootScope, $timeout, $uibM
ctrl.unselectAll = () => {
ctrl.showFeedback(false, "");
ctrl.onSelectElement(null);
configs.selectionView.cancelSelection();
if(configs.selectedHalo) {
configs.selectedHalo.remove();
configs.selectedHalo = null;
if(configs.selectedElementActions) {
configs.selectedElementActions.remove();
configs.selectedElementActions = null;
}
}

Expand Down Expand Up @@ -352,9 +347,9 @@ const controller = function (ModelAPI, $stateParams, $rootScope, $timeout, $uibM
paper.on('blank:pointerdown', (evt) => {
ctrl.unselectAll();
if(!configs.keyboardController.spacePressed){
configs.selectionView.startSelecting(evt);

} else {
configs.paperScroller.startPanning(evt);
configs.editorScroller.startPanning(evt);
}
});

Expand All @@ -364,29 +359,22 @@ const controller = function (ModelAPI, $stateParams, $rootScope, $timeout, $uibM

paper.on('element:pointerup', (cellView, evt, x, y) => {
ctrl.onSelectElement(cellView);
// if(x != null && y != null){
// $scope.conectElements(cellView, x, y)
// }
configs.selectionView.cancelSelection();

const halo = new joint.ui.Halo({
const elementActions = new joint.ui.ElementActions({
cellView: cellView,
boxContent: false
});

configs.selectedHalo = halo;
halo.on('action:link:add', function (link) {
configs.selectedElementActions = elementActions;
elementActions.on('action:link:add', function (link) {
ctrl.shapeLinker.onLink(link);
});

if (ctrl.shapeValidator.isAttribute(cellView.model) || ctrl.shapeValidator.isExtension(cellView.model)) {
halo.removeHandle('resize');
elementActions.removeAction('resize');
}

halo.removeHandle('clone');
halo.removeHandle('fork');
halo.removeHandle('rotate');
halo.render();
elementActions.render();
});

configs.paper.on('link:mouseenter', (linkView) => {
Expand Down Expand Up @@ -463,8 +451,6 @@ const controller = function (ModelAPI, $stateParams, $rootScope, $timeout, $uibM

registerGraphEvents(configs.graph);

configs.commandManager = new joint.dia.CommandManager({ graph: configs.graph })

const content = $("#content");

configs.paper = new joint.dia.Paper({
Expand All @@ -481,23 +467,23 @@ const controller = function (ModelAPI, $stateParams, $rootScope, $timeout, $uibM

registerPaperEvents(configs.paper);

configs.selectionView = new joint.ui.SelectionView({ paper: configs.paper, graph: configs.graph, model: new Backbone.Collection });

configs.paperScroller = new joint.ui.PaperScroller({
configs.editorScroller = new joint.ui.EditorScroller({
paper: configs.paper,
cursor: "grabbing",
autoResizePaper: true,
});
content.append(configs.paperScroller.render().el);
content.append(configs.editorScroller.render().el);

const stencil = new joint.ui.Stencil({
const enditorManager = new joint.ui.EditorManager({
graph: configs.graph,
paper: configs.paper,
});

$("#stencil-holder").append(stencil.render().el);
configs.editorActions = new joint.ui.EditorActions({ graph: configs.graph });

$(".elements-holder").append(enditorManager.render().el);

stencil.load([
enditorManager.loadElements([
ctrl.shapeFactory.createEntity({ position: { x: 25, y: 10 } }),
ctrl.shapeFactory.createIsa({ position: { x: 40, y: 70 } }),
ctrl.shapeFactory.createRelationship({ position: { x: 25, y: 130 } }),
Expand Down Expand Up @@ -543,8 +529,6 @@ const controller = function (ModelAPI, $stateParams, $rootScope, $timeout, $uibM
ctrl.entityExtensor = null;
configs.graph = null;
configs.paper = null;
configs.paperScroller = null;
configs.commandManager = null;
configs.keyboardController.unbindAll();
configs.keyboardController = null;
preventExitService.cleanup(ctrl)()
Expand Down
Loading

0 comments on commit 8f2156d

Please sign in to comment.