You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openNG/src/client/components/window-manager/floating-window-area.jsx

38 lines
904 B
JavaScript

"use strict";
const React = require("react");
const Window = require("../window");
module.exports = function FloatingWindowArea({windows, onStartMove, onStartCornerResize, onClose, onFocus, onWindowRef}) {
return (
windows.map((window_) => {
let windowStyle = {
transform: `translate(${window_.x}px, ${window_.y}px)`,
width: window_.width,
height: window_.height,
zIndex: window_.zIndex
};
let handlers = {
onTitleMouseDown: (event) => {
onStartMove(window_, event);
},
onResizerMouseDown: (event) => {
onStartCornerResize(window_, event);
},
onMouseDown: () => {
onFocus(window_);
},
onClose: () => {
onClose(window_);
}
};
return (
<Window.Window elementRef={onWindowRef.bind(null, window_.id)} key={window_.id} style={windowStyle} window={window_} resizeDirection="both" {...handlers} />
);
})
);
};