mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
tweaks to overlays
This commit is contained in:
parent
f7f695d145
commit
37bb85fca6
4 changed files with 16 additions and 13 deletions
|
@ -32,7 +32,7 @@ for (s = 0; s < numberOfSwatches; s++) {
|
|||
imageFromY = 55;
|
||||
}
|
||||
|
||||
swatches[s] = Overlays.addOverlay({
|
||||
swatches[s] = Overlays.addOverlay("image", {
|
||||
x: 100 + (30 * s),
|
||||
y: 200,
|
||||
width: 31,
|
||||
|
@ -44,7 +44,7 @@ for (s = 0; s < numberOfSwatches; s++) {
|
|||
});
|
||||
}
|
||||
|
||||
var toolA = Overlays.addOverlay({
|
||||
var toolA = Overlays.addOverlay("image", {
|
||||
x: 100,
|
||||
y: 100,
|
||||
width: 62,
|
||||
|
@ -56,7 +56,7 @@ var toolA = Overlays.addOverlay({
|
|||
visible: false
|
||||
});
|
||||
|
||||
var slider = Overlays.addOverlay({
|
||||
var slider = Overlays.addOverlay("image", {
|
||||
// alternate form of expressing bounds
|
||||
bounds: { x: 100, y: 300, width: 158, height: 35},
|
||||
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/slider.png",
|
||||
|
@ -67,7 +67,7 @@ var slider = Overlays.addOverlay({
|
|||
var minThumbX = 130;
|
||||
var maxThumbX = minThumbX + 65;
|
||||
var thumbX = (minThumbX + maxThumbX) / 2;
|
||||
var thumb = Overlays.addOverlay({
|
||||
var thumb = Overlays.addOverlay("image", {
|
||||
x: thumbX,
|
||||
y: 309,
|
||||
width: 18,
|
||||
|
|
|
@ -202,7 +202,6 @@ void ImageOverlay::setProperties(const QScriptValue& properties) {
|
|||
|
||||
if (properties.property("visible").isValid()) {
|
||||
setVisible(properties.property("visible").toVariant().toBool());
|
||||
qDebug() << "setting visible to " << getVisible();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,13 +27,17 @@ void Overlays::render() {
|
|||
}
|
||||
|
||||
// TODO: make multi-threaded safe
|
||||
unsigned int Overlays::addOverlay(const QScriptValue& properties) {
|
||||
unsigned int thisID = _nextOverlayID;
|
||||
_nextOverlayID++;
|
||||
ImageOverlay* thisOverlay = new ImageOverlay();
|
||||
thisOverlay->init(_parent);
|
||||
thisOverlay->setProperties(properties);
|
||||
_imageOverlays[thisID] = thisOverlay;
|
||||
unsigned int Overlays::addOverlay(const QString& type, const QScriptValue& properties) {
|
||||
unsigned int thisID = 0;
|
||||
|
||||
if (type == "image") {
|
||||
thisID = _nextOverlayID;
|
||||
_nextOverlayID++;
|
||||
ImageOverlay* thisOverlay = new ImageOverlay();
|
||||
thisOverlay->init(_parent);
|
||||
thisOverlay->setProperties(properties);
|
||||
_imageOverlays[thisID] = thisOverlay;
|
||||
}
|
||||
return thisID;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
public slots:
|
||||
/// adds an overlay with the specific properties
|
||||
unsigned int addOverlay(const QScriptValue& properties);
|
||||
unsigned int addOverlay(const QString& type, const QScriptValue& properties);
|
||||
|
||||
/// edits an overlay updating only the included properties, will return the identified OverlayID in case of
|
||||
/// successful edit, if the input id is for an unknown overlay this function will have no effect
|
||||
|
|
Loading…
Reference in a new issue