@Override
        public void mouseReleased(MouseEvent e) {
            int dungeonX = e.getX() / defaultBlockSize + panelOrigin.getX();
            int dungeonY = e.getY() / defaultBlockSize + panelOrigin.getY();

            DungeonTile tile = model.getArea().getTiles()[dungeonX][dungeonY];
            if (!model.getSelectedPattern().equals(Trigger) && !model.getSelectedPattern().equals(Select)) {
                tile.setTileType(model.getSelectedPattern());
            }

            if (model.getSelectedPattern() == Entry) {
                model.getArea().setEntryPoint(new Coordinates(dungeonX, dungeonY));
            }

            if (model.getSelectedPattern().equals(Trigger)) {
                if (model.getTriggerCoordinates() == null) {
                    model.setTriggerCoordinates(new Coordinates(dungeonX, dungeonY));
                } else {
                    DungeonTile triggerTile = area.getTiles()[model.getTriggerCoordinates().getX()][model.getTriggerCoordinates().getY()];
                    Effect effect = model.getTrigger().getEffect();
                    if (effect instanceof OneTargetTileEffect) {
                        // todo check if the target is a door
                        ((OneTargetTileEffect) effect).setTargetTile(new Coordinates(dungeonX, dungeonY));
                    }

                    if (effect instanceof MoveToAnotherMap){
                        JFileChooser openFile = new JFileChooser();
                        int result = openFile.showOpenDialog(null);
                        if (result == JFileChooser.APPROVE_OPTION) {
                            ((MoveToAnotherMap)effect).setTargetMap(openFile.getSelectedFile().getAbsolutePath());
                        }
                    }
                    triggerTile.setTrigger(model.getTrigger());
                    model.setTrigger(null);
                    model.setTriggerCoordinates(null);
                }
            }

            if (model.getSelectedPattern().equals(Select)) {
                model.setSelectedTile(new Coordinates(dungeonX, dungeonY));
                model.fireSelectedTile();
            }
            repaint();
        }