Skip to content
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Dock Spawn Authors

Ali Akbar <ali.akbar@gmail.com>
Marius Volkhart <marius@volkhart.com>
4 changes: 2 additions & 2 deletions lib/containers/fill_dock_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ class FillDockContainer implements IDockContainer {
}


int get width => element.clientWidth;
int get width => element.client.width;
set width(int value) => element.style.width = "${value}px";

int get height => element.clientHeight;
int get height => element.client.height;
set height(int value) => element.style.height = "${value}px";

}
8 changes: 4 additions & 4 deletions lib/containers/panel_dock_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ class PanelContainer implements IDockContainer {
elementContentHost.classes.add("panel-content");

// set the size of the dialog elements based on the panel's size
int panelWidth = elementContent.clientWidth;
int panelHeight = elementContent.clientHeight;
int titleHeight = elementTitle.clientHeight;
int panelWidth = elementContent.client.width;
int panelHeight = elementContent.client.height;
int titleHeight = elementTitle.client.height;
_setPanelDimensions(panelWidth, panelHeight + titleHeight);

// Add the panel to the body
Expand Down Expand Up @@ -179,7 +179,7 @@ class PanelContainer implements IDockContainer {
elementPanel.style.width = "${_width}px";


int titleBarHeight = elementTitle.clientHeight;
int titleBarHeight = elementTitle.client.height;
int contentHeight = _height - titleBarHeight;
elementContentHost.style.height = "${contentHeight}px";
elementContent.style.height = "${contentHeight}px";
Expand Down
4 changes: 2 additions & 2 deletions lib/containers/splitter_dock_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ abstract class SplitterDockContainer implements IDockContainer {

int get width {
if (_cachedWidth == null) {
_cachedWidth = splitterPanel.panelElement.clientWidth;
_cachedWidth = splitterPanel.panelElement.client.width;
}
return _cachedWidth;
// return splitterPanel.panelElement.clientWidth;
}

int get height {
if (_cachedHeight == null) {
_cachedHeight = splitterPanel.panelElement.clientHeight;
_cachedHeight = splitterPanel.panelElement.client.height;
}
return _cachedHeight; //splitterPanel.panelElement.clientHeight;
// return splitterPanel.panelElement.clientHeight;
Expand Down
8 changes: 4 additions & 4 deletions lib/decorators/draggable_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class DraggableContainer implements IDockContainer {
containerType = delegate.containerType;

mouseDownHandler = dragHandle.onMouseDown.listen(onMouseDown);
topLevelElement.style.marginLeft = "${topLevelElement.offsetLeft}";
topLevelElement.style.marginTop = "${topLevelElement.offsetTop}";
topLevelElement.style.marginLeft = "${topLevelElement.offset.left}";
topLevelElement.style.marginTop = "${topLevelElement.offset.top}";
}

void destroy() {
Expand Down Expand Up @@ -76,7 +76,7 @@ class DraggableContainer implements IDockContainer {

void onMouseDown(MouseEvent event) {
_startDragging(event);
previousMousePosition = new Point2(event.pageX, event.pageY);
previousMousePosition = new Point2(event.page.x, event.page.y);
if (mouseMoveHandler != null) {
mouseMoveHandler.cancel();
mouseMoveHandler = null;
Expand Down Expand Up @@ -114,7 +114,7 @@ class DraggableContainer implements IDockContainer {
}

void onMouseMove(MouseEvent event) {
Point2 currentMousePosition = new Point2(event.pageX, event.pageY);
Point2 currentMousePosition = new Point2(event.page.x, event.page.y);
int dx = (currentMousePosition.x - previousMousePosition.x).toInt();
int dy = (currentMousePosition.y - previousMousePosition.y).toInt();
_performDrag(dx, dy);
Expand Down
12 changes: 6 additions & 6 deletions lib/decorators/resizable_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class ResizableContainer implements IDockContainer {

ResizableContainer(this.dialog, this.delegate, this.topLevelElement) {
containerType = delegate.containerType;
topLevelElement.style.marginLeft = "${topLevelElement.offsetLeft}";
topLevelElement.style.marginTop = "${topLevelElement.offsetTop}";
topLevelElement.style.marginLeft = "${topLevelElement.offset.left}";
topLevelElement.style.marginTop = "${topLevelElement.offset.top}";
_buildResizeHandles();
}

Expand Down Expand Up @@ -143,7 +143,7 @@ class ResizableContainer implements IDockContainer {

// window.requestLayoutFrame(() {
dockManager.suspendLayout();
Point2 currentMousePosition = new Point2(e.pageX, e.pageY);
Point2 currentMousePosition = new Point2(e.page.x, e.page.y);
int dx = (currentMousePosition.x - previousMousePosition.x).toInt();
int dy = (currentMousePosition.y - previousMousePosition.y).toInt();
_performDrag(handle, dx, dy);
Expand All @@ -154,7 +154,7 @@ class ResizableContainer implements IDockContainer {
}

void onMouseDown(ResizeHandle handle, MouseEvent event) {
previousMousePosition = new Point2(event.pageX, event.pageY);
previousMousePosition = new Point2(event.page.x, event.page.y);
if (handle.mouseMoveHandlerSub != null) {
handle.mouseMoveHandlerSub.cancel();
}
Expand All @@ -181,8 +181,8 @@ class ResizableContainer implements IDockContainer {
var bounds = new BoundingBox();
bounds.left = getPixels(topLevelElement.style.marginLeft);
bounds.top = getPixels(topLevelElement.style.marginTop);
bounds.width = topLevelElement.clientWidth;
bounds.height = topLevelElement.clientHeight;
bounds.width = topLevelElement.client.width;
bounds.height = topLevelElement.client.height;

if (handle.east) _resizeEast(dx, bounds);
if (handle.west) _resizeWest(dx, bounds);
Expand Down
2 changes: 1 addition & 1 deletion lib/dialog/dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Dialog {

mouseDownHandler = elementDialog.onMouseDown.listen(onMouseDown);

resize(panel.elementPanel.clientWidth, panel.elementPanel.clientHeight);
resize(panel.elementPanel.client.width, panel.elementPanel.client.height);
bringToFront();
}

Expand Down
32 changes: 16 additions & 16 deletions lib/dock/dock_layout_engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ class DockLayoutEngine {
DockNode referenceParent = referenceNode.parent;

// Get the dimensions of the reference node, for resizing later on
int referenceNodeWidth = referenceNode.container.containerElement.clientWidth;
int referenceNodeHeight = referenceNode.container.containerElement.clientHeight;
int referenceNodeWidth = referenceNode.container.containerElement.client.width;
int referenceNodeHeight = referenceNode.container.containerElement.client.height;

// Get the dimensions of the reference node, for resizing later on
int referenceNodeParentWidth = referenceParent.container.containerElement.clientWidth;
int referenceNodeParentHeight = referenceParent.container.containerElement.clientHeight;
int referenceNodeParentWidth = referenceParent.container.containerElement.client.width;
int referenceNodeParentHeight = referenceParent.container.containerElement.client.height;

// Replace the reference node with a new composite node with the reference and new node as it's children
IDockContainer compositeContainer = _createDockContainer(direction, newNode, referenceNode);
Expand Down Expand Up @@ -159,14 +159,14 @@ class DockLayoutEngine {
}

// force resize the panel
int containerWidth = newNode.container.containerElement.clientWidth;
int containerHeight = newNode.container.containerElement.clientHeight;
int containerWidth = newNode.container.containerElement.client.width;
int containerHeight = newNode.container.containerElement.client.height;
newNode.container.resize(containerWidth, containerHeight);
}

void _forceResizeCompositeContainer(IDockContainer container) {
int width = container.containerElement.clientWidth;
int height = container.containerElement.clientHeight;
int width = container.containerElement.client.width;
int height = container.containerElement.client.height;
container.resize(width, height);
}

Expand Down Expand Up @@ -200,10 +200,10 @@ class DockLayoutEngine {
// TODO: Create a tab handle highlight to show that it's going to be docked in a tab
Element targetElement = referenceNode.container.containerElement;
Rectangle bounds = new Rectangle();
bounds.x = targetElement.offsetLeft;
bounds.y = targetElement.offsetTop;
bounds.width = targetElement.clientWidth;
bounds.height= targetElement.clientHeight;
bounds.x = targetElement.offset.left;
bounds.y = targetElement.offset.top;
bounds.width = targetElement.client.width;
bounds.height= targetElement.client.height;
return bounds;
}

Expand Down Expand Up @@ -255,13 +255,13 @@ class DockLayoutEngine {

Rectangle bounds = new Rectangle();
if (direction == "vertical") {
bounds.x = compositeNode.container.containerElement.offsetLeft;
bounds.y = compositeNode.container.containerElement.offsetTop + targetPanelStart;
bounds.x = compositeNode.container.containerElement.offset.left;
bounds.y = compositeNode.container.containerElement.offset.top + targetPanelStart;
bounds.width = compositeNode.container.width;
bounds.height = targetPanelSize;
} else if (direction == "horizontal") {
bounds.x = compositeNode.container.containerElement.offsetLeft + targetPanelStart;
bounds.y = compositeNode.container.containerElement.offsetTop;
bounds.x = compositeNode.container.containerElement.offset.left + targetPanelStart;
bounds.y = compositeNode.container.containerElement.offset.top;
bounds.width = targetPanelSize;
bounds.height = compositeNode.container.height;
}
Expand Down
14 changes: 7 additions & 7 deletions lib/dock/dock_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DockManager implements DialogEventListener {
context.model.documentManagerNode = documentNode;
setRootNode(context.model.rootNode);
// Resize the layout
resize(element.clientWidth, element.clientHeight);
resize(element.client.width, element.client.height);
dockWheel = new DockWheel(this);
layoutEngine = new DockLayoutEngine(this);

Expand All @@ -40,7 +40,7 @@ class DockManager implements DialogEventListener {
}

void invalidate() {
resize(element.clientWidth, element.clientHeight);
resize(element.client.width, element.client.height);
}

void resize(int width, int height) {
Expand Down Expand Up @@ -75,7 +75,7 @@ class DockManager implements DialogEventListener {


void onDialogDragStarted(Dialog sender, MouseEvent e) {
dockWheel.activeNode = _findNodeOnPoint(e.pageX, e.pageY);
dockWheel.activeNode = _findNodeOnPoint(e.page.x, e.page.y);
dockWheel.activeDialog = sender;
dockWheel.showWheel();
if (mouseMoveHandler != null) {
Expand All @@ -95,7 +95,7 @@ class DockManager implements DialogEventListener {
}

void onMouseMoved(MouseEvent e) {
dockWheel.activeNode = _findNodeOnPoint(e.pageX, e.pageY);
dockWheel.activeNode = _findNodeOnPoint(e.page.x, e.page.y);
}

/**
Expand Down Expand Up @@ -218,13 +218,13 @@ class DockManager implements DialogEventListener {
var dialog = new Dialog(node.container, this);

// Adjust the relative position
num dialogWidth = dialog.elementDialog.clientWidth;
num dialogWidth = dialog.elementDialog.client.width;
if (dragOffset.x > dialogWidth) {
dragOffset.x = 0.75 * dialogWidth;
}
dialog.setPosition(
event.pageX - dragOffset.x,
event.pageY - dragOffset.y);
event.page.x - dragOffset.x,
event.page.y - dragOffset.y);
dialog.draggable.onMouseDown(event);

return dialog;
Expand Down
4 changes: 2 additions & 2 deletions lib/dock/dock_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class DockNode {
childNode.parent = this;

int referenceIndex = children.indexOf(referenceNode);
List<DockNode> preList = children.getRange(0, referenceIndex);
List<DockNode> postList = children.getRange(referenceIndex + 1, children.length - (referenceIndex + 1));
List<DockNode> preList = children.sublist(0, referenceIndex);
List<DockNode> postList = children.sublist(referenceIndex + 1, children.length);

children = new List<DockNode>();
children.addAll(preList);
Expand Down
20 changes: 10 additions & 10 deletions lib/dock/dock_wheel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,20 @@ class DockWheel {
return;
}
Element element = activeNode.container.containerElement;
int containerWidth = element.clientWidth;
int containerHeight = element.clientHeight;
int baseX = containerWidth ~/ 2 + element.offsetLeft;
int baseY = containerHeight ~/ 2 + element.offsetTop;
int containerWidth = element.client.width;
int containerHeight = element.client.height;
int baseX = containerWidth ~/ 2 + element.offset.left;
int baseY = containerHeight ~/ 2 + element.offset.top;
elementMainWheel.style.left = "${baseX}px";
elementMainWheel.style.top = "${baseY}px";

// The positioning of the main dock wheel buttons is done automatically through CSS
// Dynamically calculate the positions of the buttons on the extreme sides of the dock manager
num sideMargin = 20;
num dockManagerWidth = dockManager.element.clientWidth;
num dockManagerHeight = dockManager.element.clientHeight;
num dockManagerOffsetX = dockManager.element.offsetLeft;
num dockManagerOffsetY = dockManager.element.offsetTop;
num dockManagerWidth = dockManager.element.client.width;
num dockManagerHeight = dockManager.element.client.height;
num dockManagerOffsetX = dockManager.element.offset.left;
num dockManagerOffsetY = dockManager.element.offset.top;

elementMainWheel.remove();
elementSideWheel.remove();
Expand All @@ -98,8 +98,8 @@ class DockWheel {

void _setWheelButtonPosition(String wheelId, num left, num top) {
DockWheelItem item = wheelItems[wheelId];
num itemHalfWidth = item.element.clientWidth / 2;
num itemHalfHeight = item.element.clientHeight / 2;
num itemHalfWidth = item.element.client.width / 2;
num itemHalfHeight = item.element.client.height / 2;

int x = (left - itemHalfWidth).toInt();
int y = (top - itemHalfHeight).toInt();
Expand Down
12 changes: 6 additions & 6 deletions lib/splitter/splitter_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ class SplitterBar {
readyToProcessNextDrag = false;
var dockManager = previousContainer.dockManager;
dockManager.suspendLayout();
int dx = e.pageX - previousMouseEvent.pageX;
int dy = e.pageY - previousMouseEvent.pageY;
int dx = e.page.x - previousMouseEvent.page.x;
int dy = e.page.y - previousMouseEvent.page.y;
_performDrag(dx, dy);
previousMouseEvent = e;
readyToProcessNextDrag = true;
dockManager.resumeLayout();
}

void _performDrag(int dx, int dy) {
int previousWidth = previousContainer.containerElement.clientWidth;
int previousHeight = previousContainer.containerElement.clientHeight;
int nextWidth = nextContainer.containerElement.clientWidth;
int nextHeight = nextContainer.containerElement.clientHeight;
int previousWidth = previousContainer.containerElement.client.width;
int previousHeight = previousContainer.containerElement.client.height;
int nextWidth = nextContainer.containerElement.client.width;
int nextHeight = nextContainer.containerElement.client.height;

int previousPanelSize = stackedVertical ? previousHeight : previousWidth;
int nextPanelSize = stackedVertical ? nextHeight : nextWidth;
Expand Down
12 changes: 6 additions & 6 deletions lib/splitter/splitter_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ class SplitterPanel {
* The percentage is specified in [ratio] and is between 0..1
*/
void setContainerRatio(IDockContainer container, num ratio) {
num splitPanelSize = stackedVertical ? panelElement.clientHeight : panelElement.clientWidth;
num splitPanelSize = stackedVertical ? panelElement.client.height : panelElement.client.width;
num newContainerSize = splitPanelSize * ratio;
int barSize = stackedVertical ? spiltterBars[0].barElement.clientHeight : spiltterBars[0].barElement.clientWidth;
int barSize = stackedVertical ? spiltterBars[0].barElement.client.height : spiltterBars[0].barElement.client.width;

num otherPanelSizeQuota = splitPanelSize - newContainerSize - barSize * spiltterBars.length;
num otherPanelScaleMultipler = otherPanelSizeQuota / splitPanelSize;

childContainers.forEach((child) {
num size;
if (child != container) {
size = stackedVertical ? child.containerElement.clientHeight : child.containerElement.clientWidth;
size = stackedVertical ? child.containerElement.client.height : child.containerElement.client.width;
size *= otherPanelScaleMultipler;
} else {
size = newContainerSize;
Expand Down Expand Up @@ -129,7 +129,7 @@ class SplitterPanel {
});

// Get the thickness of the bar
int barSize = stackedVertical ? spiltterBars[0].barElement.clientHeight : spiltterBars[0].barElement.clientWidth;
int barSize = stackedVertical ? spiltterBars[0].barElement.client.height : spiltterBars[0].barElement.client.width;

// Find out how much space existing child containers will take after being resized (excluding the splitter bars)
int targetTotalChildPanelSize = stackedVertical ? height : width;
Expand All @@ -144,8 +144,8 @@ class SplitterPanel {
for (int i = 0; i < childContainers.length; i++) {
var child = childContainers[i];
int original = stackedVertical ?
child.containerElement.clientHeight :
child.containerElement.clientWidth;
child.containerElement.client.height :
child.containerElement.client.width;

int newSize = (original * scaleMultiplier).toInt();
updatedTotalChildPanelSize += newSize;
Expand Down
4 changes: 2 additions & 2 deletions lib/tab/tab_host.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class TabHost {
hostElement.style.width = "${width}px";
hostElement.style.height = "${height}px";

int tabHeight = tabListElement.clientHeight;
int separatorHeight = separatorElement.clientHeight;
int tabHeight = tabListElement.client.height;
int separatorHeight = separatorElement.client.height;
int contentHeight = height - tabHeight - separatorHeight;
contentElement.style.height = "${contentHeight}px";

Expand Down
4 changes: 2 additions & 2 deletions lib/tab/tab_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class TabPage {
if (selected) {
host.contentElement.nodes.add(containerElement);
// force a resize again
int width = host.contentElement.clientWidth;
int height = host.contentElement.clientHeight;
int width = host.contentElement.client.width;
int height = host.contentElement.client.height;
container.resize(width, height);
} else {
containerElement.remove();
Expand Down
Loading